Index: src/devices/uan/uan-tx-mode.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/src/devices/uan/uan-tx-mode.h |
@@ -0,0 +1,166 @@ |
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
+/* |
+ * Copyright (c) 2009 University of Washington |
+ * |
+ * This program is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation, either version 3 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. |
+ * |
+ * Author: Leonard Tracy <lentracy@u.washington.edu> |
+ * |
+ * |
+ */ |
+ |
+#ifndef UANTXMODE_H_ |
+#define UANTXMODE_H_ |
+ |
+#include "ns3/object.h" |
+#include <map> |
+ |
+namespace ns3 |
+{ |
+class UanTxModeFactory; |
+class UanTxMode; |
+ |
+/** |
+ * \class UanTxMode |
+ * \brief Abstraction of packet modulation information |
+ * |
+ */ |
+class UanTxMode |
+{ |
+public: |
+ UanTxMode (); |
+ ~UanTxMode (); |
+ //static TypeId GetTypeId(void); |
+ |
+ typedef enum {PSK, QAM, FSK, OTHER} ModulationType; |
craigdo1
2009/07/11 00:10:52
Doxygen
|
+ ModulationType GetModType (void) const; |
+ uint32_t GetDataRateBps (void) const; |
+ uint32_t GetPhyRateSps (void) const; |
+ uint32_t GetCenterFreqHz (void) const; |
+ uint32_t GetBandwidthHz (void) const; |
+ uint32_t GetConstellationSize (void) const; |
+ std::string GetName (void) const; |
+ uint32_t GetUid (void) const { return m_uid; } |
+ |
+private: |
+ friend class UanTxModeFactory; |
+ friend std::ostream &operator<< (std::ostream & os, const UanTxMode &mode); |
+ friend std::istream &operator>> (std::istream & is, UanTxMode &mode); |
+ |
+ |
+ uint32_t m_uid; |
+ |
+}; |
+ |
+std::ostream & operator << (std::ostream & os, const UanTxMode &mode); |
+std::istream & operator >> (std::istream & is, const UanTxMode &mode); |
+ |
+class UanTxModeFactory |
+{ |
+public: |
+ |
+ UanTxModeFactory (); |
+ ~UanTxModeFactory (); |
+ |
+ /** |
+ * |
+ * \param dataRateBps Data rate in BPS |
+ * \param phyRateSps Symbol rate in symbols per second |
+ * \param cfHz Center frequency in Hz |
+ * \param bwHz Bandwidth in Hz |
+ * \param constSize Modulation constellation size (2 for BPSK, 4 for QPSK) |
+ * \param name Unique string name for this transmission mode |
+ */ |
+ static UanTxMode CreateMode (UanTxMode::ModulationType type, |
+ uint32_t dataRateBps, |
+ uint32_t phyRateSps, |
+ uint32_t cfHz, |
+ uint32_t bwHz, |
+ uint32_t constSize, |
+ std::string name); |
+ |
+ static UanTxMode GetMode (std::string name); |
+ static UanTxMode GetMode (uint32_t uid); |
+private: |
+ friend class UanTxMode; |
+ uint32_t m_nextUid; |
+ |
+ struct UanTxModeItem |
+ { |
+ UanTxMode::ModulationType m_type; |
+ uint32_t m_cfHz; |
+ uint32_t m_bwHz; |
+ uint32_t m_dataRateBps; |
+ uint32_t m_phyRateSps; |
+ uint32_t m_constSize; |
+ uint32_t m_uid; |
+ std::string m_name; |
+ }; |
+ |
+ std::map<uint32_t, UanTxModeItem> m_modes; |
+ bool NameUsed (std::string name); |
+ static UanTxModeFactory &GetFactory (void); |
+ UanTxModeItem &GetModeItem (uint32_t uid); |
+ UanTxModeItem &GetModeItem (std::string name); |
+ UanTxMode MakeModeFromItem (const UanTxModeItem &item); |
+ |
+}; |
+ |
+/** |
+ * \class UanModesList |
+ * \brief Container for UanTxModes |
+ */ |
+class UanModesList : public ns3::Object |
+{ |
+public: |
+ UanModesList (); |
+ virtual ~UanModesList (); |
+ static TypeId GetTypeId (void); |
+ |
+ /** |
+ * \param mode Add mode to list |
+ */ |
+ void AppendMode (UanTxMode mode); |
+ /** |
+ * \brief delete mode at given index |
+ * \param num Index of mode to delete |
+ */ |
+ void DeleteMode (uint32_t num); |
+ /** |
+ * \param index Mode index |
+ * \returns mode at given index |
+ */ |
+ UanTxMode operator[] (uint32_t index) const; |
+ /** |
+ * \returns Number of modes in list |
+ */ |
+ uint32_t GetNModes(void) const; |
+ |
+ |
+private: |
+ std::vector<UanTxMode> m_modes; |
+ friend std::ostream &operator << (std::ostream &os, const UanModesList &ml); |
+ friend std::istream &operator >> (std::istream &is, UanModesList &ml); |
+protected: |
+ virtual void DoDispose (); |
+}; |
+ |
+std::ostream &operator << (std::ostream &os, const UanModesList &ml); |
+std::istream &operator >> (std::istream &is, UanModesList &ml); |
+ATTRIBUTE_HELPER_HEADER (UanModesList); |
+ |
+ |
+} //namespace ns3 |
+ |
+#endif /*UANTXMODE_H_*/ |