A Discrete-Event Network Simulator
API
wifi-mode.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef WIFI_MODE_H
21 #define WIFI_MODE_H
22 
23 #include <stdint.h>
24 #include <string>
25 #include <vector>
26 #include <ostream>
27 #include "ns3/attribute-helper.h"
28 #include "ns3/wifi-phy-standard.h"
29 
30 namespace ns3 {
31 
37 {
57 };
58 
59 
68 {
79 
80 };
81 
93 class WifiMode
94 {
95 public:
99  uint32_t GetBandwidth (void) const;
106  uint64_t GetPhyRate (void) const;
110  uint64_t GetDataRate (void) const;
114  enum WifiCodeRate GetCodeRate (void) const;
118  uint8_t GetConstellationSize (void) const;
119 
124  std::string GetUniqueName (void) const;
125 
130  bool IsMandatory (void) const;
131 
139  uint32_t GetUid (void) const;
140 
147 
154  WifiMode ();
161  WifiMode (std::string name);
162 private:
163  friend class WifiModeFactory;
169  WifiMode (uint32_t uid);
170  uint32_t m_uid;
171 };
172 
173 bool operator == (const WifiMode &a, const WifiMode &b);
174 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
175 std::istream & operator >> (std::istream &is, WifiMode &mode);
176 
178 
185 typedef std::vector<WifiMode> WifiModeList;
189 typedef WifiModeList::const_iterator WifiModeListIterator;
190 
194 typedef std::vector<uint8_t> WifiMcsList;
198 typedef WifiMcsList::const_iterator WifiMcsListIterator;
199 
207 {
208 public:
227  static WifiMode CreateWifiMode (std::string uniqueName,
228  enum WifiModulationClass modClass,
229  bool isMandatory,
230  uint32_t bandwidth,
231  uint32_t dataRate,
232  enum WifiCodeRate codingRate,
233  uint8_t constellationSize);
234 
235 private:
236  friend class WifiMode;
237  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
238 
244  static WifiModeFactory* GetFactory ();
245  WifiModeFactory ();
246 
253  {
254  std::string uniqueUid;
255  uint32_t bandwidth;
256  uint32_t dataRate;
257  uint32_t phyRate;
262  };
263 
270  WifiMode Search (std::string name);
277  uint32_t AllocateUid (std::string uniqueUid);
284  WifiModeItem* Get (uint32_t uid);
285 
289  typedef std::vector<struct WifiModeItem> WifiModeItemList;
290  WifiModeItemList m_itemList;
291 };
292 
293 } // namespace ns3
294 
295 #endif /* WIFI_MODE_H */
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:48
WifiMode()
Create an invalid WifiMode.
Definition: wifi-mode.cc:120
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:52
WifiCodeRate
This enumeration defines the various convolutional coding rates used for the OFDM transmission modes ...
Definition: wifi-mode.h:67
DSSS-OFDM PHY (19.7)
Definition: wifi-mode.h:50
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:115
WifiMcsList::const_iterator WifiMcsListIterator
An iterator for WifiMcsList vector.
Definition: wifi-mode.h:198
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:48
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
bool IsMandatory(void) const
Definition: wifi-mode.cc:104
Modulation class unknown or unspecified.
Definition: wifi-mode.h:40
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given uid index.
Definition: wifi-mode.cc:254
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:44
uint32_t m_uid
Definition: wifi-mode.h:170
enum WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:85
HT PHY (Clause 20)
Definition: wifi-mode.h:56
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:97
WifiModeItemList m_itemList
Definition: wifi-mode.h:290
std::vector< uint8_t > WifiMcsList
A list of Wi-Fi Modulation and Coding Scheme (MCS).
Definition: wifi-mode.h:194
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, enum WifiCodeRate codingRate, uint8_t constellationSize)
Definition: wifi-mode.cc:141
uint32_t GetBandwidth(void) const
Definition: wifi-mode.cc:67
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Infrared (IR) (Clause 16)
Definition: wifi-mode.h:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t GetConstellationSize(void) const
Definition: wifi-mode.cc:91
uint64_t GetPhyRate(void) const
Definition: wifi-mode.cc:73
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:189
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:177
std::vector< struct WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:289
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:70
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:206
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:36
OFDM PHY (Clause 17)
Definition: wifi-mode.h:54
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:95
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:261
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:236
enum WifiModulationClass modClass
Definition: wifi-mode.h:258
uint32_t GetUid(void) const
Definition: wifi-mode.cc:110
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:58
WifiMode Search(std::string name)
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:201
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type.
uint64_t GetDataRate(void) const
Definition: wifi-mode.cc:79
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:252
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:46