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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #ifndef WIFI_MODE_H
23 #define WIFI_MODE_H
24 
25 #include <stdint.h>
26 #include <string>
27 #include <vector>
28 #include <ostream>
29 #include "ns3/attribute-helper.h"
30 #include "ns3/wifi-phy-standard.h"
31 
32 namespace ns3 {
33 
39 {
63 };
64 
73 {
84 };
85 
97 class WifiMode
98 {
99 public:
111  uint64_t GetPhyRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
120  uint64_t GetDataRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
127  enum WifiCodeRate GetCodeRate (uint8_t nss) const;
134  uint16_t GetConstellationSize (uint8_t nss) const;
138  uint8_t GetMcsValue (void) const;
143  std::string GetUniqueName (void) const;
148  bool IsMandatory (void) const;
156  uint32_t GetUid (void) const;
163 
170  WifiMode ();
177  WifiMode (std::string name);
178 
179 
180 private:
181  friend class WifiModeFactory;
187  WifiMode (uint32_t uid);
188  uint32_t m_uid;
189 };
190 
191 bool operator == (const WifiMode &a, const WifiMode &b);
192 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
193 std::istream & operator >> (std::istream &is, WifiMode &mode);
194 
196 
203 typedef std::vector<WifiMode> WifiModeList;
207 typedef WifiModeList::const_iterator WifiModeListIterator;
208 
216 {
217 public:
234  static WifiMode CreateWifiMode (std::string uniqueName,
235  enum WifiModulationClass modClass,
236  bool isMandatory,
237  enum WifiCodeRate codingRate,
238  uint16_t constellationSize);
239 
250  static WifiMode CreateWifiMcs (std::string uniqueName,
251  uint8_t mcsValue,
252  enum WifiModulationClass modClass);
253 
254 
255 private:
256  friend class WifiMode;
257  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
258 
264  static WifiModeFactory* GetFactory ();
265  WifiModeFactory ();
266 
273  {
274  std::string uniqueUid;
279  uint8_t mcsValue;
280  };
281 
289  WifiMode Search (std::string name);
297  uint32_t AllocateUid (std::string uniqueUid);
305  WifiModeItem* Get (uint32_t uid);
306 
310  typedef std::vector<struct WifiModeItem> WifiModeItemList;
311  WifiModeItemList m_itemList;
312 };
313 
314 } //namespace ns3
315 
316 #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:381
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:56
enum WifiCodeRate GetCodeRate(uint8_t nss) const
Definition: wifi-mode.cc:227
WifiCodeRate
This enumeration defines the various convolutional coding rates used for the OFDM transmission modes ...
Definition: wifi-mode.h:72
uint16_t GetConstellationSize(uint8_t nss) const
Definition: wifi-mode.cc:282
DSSS-OFDM PHY (19.7)
Definition: wifi-mode.h:54
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:375
VHT PHY (Clause 22)
Definition: wifi-mode.h:62
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:50
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:52
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
bool IsMandatory(void) const
Definition: wifi-mode.cc:346
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, enum WifiModulationClass modClass)
Definition: wifi-mode.cc:441
Modulation class unknown or unspecified.
Definition: wifi-mode.h:42
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given uid index.
Definition: wifi-mode.cc:517
uint64_t GetPhyRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:73
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:46
uint32_t m_uid
Definition: wifi-mode.h:188
HT PHY (Clause 20)
Definition: wifi-mode.h:60
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:353
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:338
WifiModeItemList m_itemList
Definition: wifi-mode.h:311
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:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:207
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:195
std::vector< struct WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:310
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, enum WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:403
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:75
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:215
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:38
OFDM PHY (Clause 17)
Definition: wifi-mode.h:58
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:95
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:524
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:499
enum WifiModulationClass modClass
Definition: wifi-mode.h:275
uint32_t GetUid(void) const
Definition: wifi-mode.cc:369
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:64
WifiMode Search(std::string name)
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:464
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type.
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:272
DSSS PHY (Clause 15)
Definition: wifi-mode.h:48