A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
uan-tx-mode.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_TX_MODE_H
22 #define UAN_TX_MODE_H
23 
24 #include "ns3/object.h"
25 #include <map>
26 
27 namespace ns3 {
28 
29 class UanTxModeFactory;
30 class UanTxMode;
31 
36 class UanTxMode
37 {
38 public:
39  UanTxMode ();
40  ~UanTxMode ();
41 
45  typedef enum {
46  PSK, QAM, FSK, OTHER
51  ModulationType GetModType (void) const;
55  uint32_t GetDataRateBps (void) const;
59  uint32_t GetPhyRateSps (void) const;
63  uint32_t GetCenterFreqHz (void) const;
67  uint32_t GetBandwidthHz (void) const;
71  uint32_t GetConstellationSize (void) const;
75  std::string GetName (void) const;
79  uint32_t GetUid (void) const;
80 
81 private:
82  friend class UanTxModeFactory;
83  friend std::ostream &operator<< (std::ostream & os, const UanTxMode &mode);
84  friend std::istream &operator>> (std::istream & is, UanTxMode &mode);
85 
86 
87  uint32_t m_uid;
88 
89 };
93 std::ostream & operator << (std::ostream & os, const UanTxMode &mode);
97 std::istream & operator >> (std::istream & is, const UanTxMode &mode);
98 
100 {
101 public:
102  UanTxModeFactory ();
103  ~UanTxModeFactory ();
104 
116  uint32_t dataRateBps,
117  uint32_t phyRateSps,
118  uint32_t cfHz,
119  uint32_t bwHz,
120  uint32_t constSize,
121  std::string name);
122 
127  static UanTxMode GetMode (std::string name);
132  static UanTxMode GetMode (uint32_t uid);
133 private:
134  friend class UanTxMode;
135  uint32_t m_nextUid;
136 
138  {
140  uint32_t m_cfHz;
141  uint32_t m_bwHz;
142  uint32_t m_dataRateBps;
143  uint32_t m_phyRateSps;
144  uint32_t m_constSize;
145  uint32_t m_uid;
146  std::string m_name;
147  };
148 
149  std::map<uint32_t, UanTxModeItem> m_modes;
150  bool NameUsed (std::string name);
151  static UanTxModeFactory &GetFactory (void);
152  UanTxModeItem &GetModeItem (uint32_t uid);
153  UanTxModeItem &GetModeItem (std::string name);
154  UanTxMode MakeModeFromItem (const UanTxModeItem &item);
155 
156 };
157 
163 {
164 public:
165  UanModesList ();
166  virtual ~UanModesList ();
167 
171  void AppendMode (UanTxMode mode);
176  void DeleteMode (uint32_t num);
181  UanTxMode operator[] (uint32_t index) const;
185  uint32_t GetNModes (void) const;
186 
187 
188 private:
189  std::vector<UanTxMode> m_modes;
190  friend std::ostream &operator << (std::ostream &os, const UanModesList &ml);
191  friend std::istream &operator >> (std::istream &is, UanModesList &ml);
192 };
193 
197 std::ostream &operator << (std::ostream &os, const UanModesList &ml);
201 std::istream &operator >> (std::istream &is, UanModesList &ml);
202 
205 
206 } // namespace ns3
207 
208 #endif /* UAN_TX_MODE_H */
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:49
uint32_t GetNModes(void) const
Definition: uan-tx-mode.cc:259
std::string GetName(void) const
Definition: uan-tx-mode.cc:75
static UanTxMode GetMode(std::string name)
Definition: uan-tx-mode.cc:194
Container for UanTxModes.
Definition: uan-tx-mode.h:162
ModulationType GetModType(void) const
Definition: uan-tx-mode.cc:39
static UanTxMode CreateMode(UanTxMode::ModulationType type, uint32_t dataRateBps, uint32_t phyRateSps, uint32_t cfHz, uint32_t bwHz, uint32_t constSize, std::string name)
Definition: uan-tx-mode.cc:132
friend std::ostream & operator<<(std::ostream &os, const UanModesList &ml)
Write UanModesList to stream os.
Definition: uan-tx-mode.cc:265
uint32_t GetDataRateBps(void) const
Definition: uan-tx-mode.cc:45
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:36
#define ATTRIBUTE_HELPER_HEADER(type)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:43
UanTxMode operator[](uint32_t index) const
Definition: uan-tx-mode.cc:252
uint32_t GetCenterFreqHz(void) const
Definition: uan-tx-mode.cc:57
uint32_t GetPhyRateSps(void) const
Definition: uan-tx-mode.cc:51
friend std::istream & operator>>(std::istream &is, UanModesList &ml)
Read UanModesList from stream is.
Definition: uan-tx-mode.cc:277
void AppendMode(UanTxMode mode)
Definition: uan-tx-mode.cc:232
uint32_t GetConstellationSize(void) const
Definition: uan-tx-mode.cc:69
uint32_t GetBandwidthHz(void) const
Definition: uan-tx-mode.cc:63
friend std::ostream & operator<<(std::ostream &os, const UanTxMode &mode)
Writes tx mode entry to stream os.
Definition: uan-tx-mode.cc:87
uint32_t GetUid(void) const
Definition: uan-tx-mode.cc:81
void DeleteMode(uint32_t num)
delete mode at given index
Definition: uan-tx-mode.cc:238