A Discrete-Event Network Simulator
API
ns3::WifiModeFactory Class Reference

create WifiMode class instances and keep track of them. More...

#include "wifi-mode.h"

+ Collaboration diagram for ns3::WifiModeFactory:

Classes

struct  WifiModeItem
 This is the data associated to a unique WifiMode. More...
 

Public Types

typedef Callback< WifiCodeRateCodeRateCallback
 Typedef for callback used to retrieve code rate of a WifiMode. More...
 
typedef Callback< uint16_t > ConstellationSizeCallback
 Typedef for callback used to retrieve constellation size of a WifiMode. More...
 
typedef Callback< uint64_t, uint16_t, uint16_t, uint8_t > DataRateCallback
 Typedef for callback used to calculate data rate of a WifiMode. More...
 
typedef Callback< uint64_t, const WifiTxVector &, uint16_t > DataRateFromTxVectorCallback
 Typedef for callback used to calculate data rate of a WifiMode from a TXVECTOR. More...
 
typedef Callback< bool, uint16_t, uint8_t > ModeAllowedCallback
 Typedef for callback used to check whether the combination of <current WifiMode, channel width (in MHz), number of stream> is allowed. More...
 
typedef Callback< uint64_t > NonHtReferenceRateCallback
 Typedef for callback used to calculate Non-HT Reference Rate of an MCS defined in HT or later amendment. More...
 
typedef Callback< uint64_t, uint16_t, uint16_t, uint8_t > PhyRateCallback
 Typedef for callback used to calculate PHY rate of a WifiMode. More...
 
typedef Callback< uint64_t, const WifiTxVector &, uint16_t > PhyRateFromTxVectorCallback
 Typedef for callback used to calculate PHY rate of a WifiMode from a TXVECTOR. More...
 

Static Public Member Functions

static WifiMode CreateWifiMcs (std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, PhyRateFromTxVectorCallback phyRateFromTxVectorCallback, DataRateCallback dataRateCallback, DataRateFromTxVectorCallback dataRateFromTxVectorCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, ModeAllowedCallback isModeAllowedCallback)
 
static WifiMode CreateWifiMode (std::string uniqueName, WifiModulationClass modClass, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, PhyRateFromTxVectorCallback phyRateFromTxVectorCallback, DataRateCallback dataRateCallback, DataRateFromTxVectorCallback dataRateFromTxVectorCallback, ModeAllowedCallback isModeAllowedCallback)
 

Private Types

typedef std::vector< WifiModeItemWifiModeItemList
 typedef for a vector of WifiModeItem. More...
 

Private Member Functions

 WifiModeFactory ()
 
uint32_t AllocateUid (std::string uniqueUid)
 Allocate a WifiModeItem from a given uniqueUid. More...
 
WifiModeItemGet (uint32_t uid)
 Return a WifiModeItem at the given UID index. More...
 
WifiMode Search (std::string name) const
 Search and return WifiMode from a given name. More...
 

Static Private Member Functions

static WifiModeFactoryGetFactory ()
 Return a WifiModeFactory. More...
 

Private Attributes

WifiModeItemList m_itemList
 item list More...
 

Friends

std::istream & operator>> (std::istream &is, WifiMode &mode)
 Serialize WifiMode from istream (human-readable). More...
 
class WifiMode
 allow WifiMode class access More...
 

Detailed Description

create WifiMode class instances and keep track of them.

This factory ensures that each WifiMode created has a unique name and assigns to each of them a unique integer.

Definition at line 266 of file wifi-mode.h.

Member Typedef Documentation

◆ CodeRateCallback

Typedef for callback used to retrieve code rate of a WifiMode.

Returns
the code rate of the WifiMode.

Definition at line 274 of file wifi-mode.h.

◆ ConstellationSizeCallback

Typedef for callback used to retrieve constellation size of a WifiMode.

Returns
the size of modulation constellation of the WifiMode.

Definition at line 279 of file wifi-mode.h.

◆ DataRateCallback

typedef Callback<uint64_t, uint16_t , uint16_t , uint8_t > ns3::WifiModeFactory::DataRateCallback

Typedef for callback used to calculate data rate of a WifiMode.

Parameters
channelWidththe channel width in MHz
guardIntervalthe guard interval duration in nanoseconds
nssthe number of streams
Returns
the data rate of the signal in bps.

Definition at line 307 of file wifi-mode.h.

◆ DataRateFromTxVectorCallback

Typedef for callback used to calculate data rate of a WifiMode from a TXVECTOR.

This is mostly useful in HE or later amendments. For the others it's a simple wrapper of

See also
DataRateCallback.
Parameters
txVectorthe TXVECTOR used for the transmission
staIdthe station ID
Returns
the data rate of the signal in bps.

Definition at line 317 of file wifi-mode.h.

◆ ModeAllowedCallback

typedef Callback<bool, uint16_t , uint8_t > ns3::WifiModeFactory::ModeAllowedCallback

Typedef for callback used to check whether the combination of <current WifiMode, channel width (in MHz), number of stream> is allowed.

Parameters
channelWidththe channel width in MHz
nssthe number of streams
Returns
true if combination of current WifiMode and supplied parameters is allowed.

Definition at line 334 of file wifi-mode.h.

◆ NonHtReferenceRateCallback

Typedef for callback used to calculate Non-HT Reference Rate of an MCS defined in HT or later amendment.

For Non-HT modes (DSSS, OFDM, etc) this should be defined as null.

Returns
the rate (in bps) of the non-HT Reference Rate.

Definition at line 325 of file wifi-mode.h.

◆ PhyRateCallback

typedef Callback<uint64_t, uint16_t , uint16_t , uint8_t > ns3::WifiModeFactory::PhyRateCallback

Typedef for callback used to calculate PHY rate of a WifiMode.

Parameters
channelWidththe channel width in MHz
guardIntervalthe guard interval duration in nanoseconds
nssthe number of streams
Returns
the physical bit rate of the signal in bps.

Definition at line 288 of file wifi-mode.h.

◆ PhyRateFromTxVectorCallback

Typedef for callback used to calculate PHY rate of a WifiMode from a TXVECTOR.

This is mostly useful in HE or later amendments. For the others it's a simple wrapper of

See also
PhyRateCallback.
Parameters
txVectorthe TXVECTOR used for the transmission
staIdthe station ID
Returns
the physical bit rate of the signal in bps.

Definition at line 298 of file wifi-mode.h.

◆ WifiModeItemList

typedef for a vector of WifiModeItem.

Definition at line 477 of file wifi-mode.h.

Constructor & Destructor Documentation

◆ WifiModeFactory()

ns3::WifiModeFactory::WifiModeFactory ( )
private

Definition at line 237 of file wifi-mode.cc.

Member Function Documentation

◆ AllocateUid()

uint32_t ns3::WifiModeFactory::AllocateUid ( std::string  uniqueUid)
private

Allocate a WifiModeItem from a given uniqueUid.

Parameters
uniqueUidthe unique UID
Returns
the allocated UID index

Definition at line 363 of file wifi-mode.cc.

References m_itemList.

Referenced by CreateWifiMcs(), CreateWifiMode(), and GetFactory().

+ Here is the caller graph for this function:

◆ CreateWifiMcs()

WifiMode ns3::WifiModeFactory::CreateWifiMcs ( std::string  uniqueName,
uint8_t  mcsValue,
WifiModulationClass  modClass,
CodeRateCallback  codeRateCallback,
ConstellationSizeCallback  constellationSizeCallback,
PhyRateCallback  phyRateCallback,
PhyRateFromTxVectorCallback  phyRateFromTxVectorCallback,
DataRateCallback  dataRateCallback,
DataRateFromTxVectorCallback  dataRateFromTxVectorCallback,
NonHtReferenceRateCallback  nonHtReferenceRateCallback,
ModeAllowedCallback  isModeAllowedCallback 
)
static
Parameters
uniqueNamethe name of the associated WifiMode. This name must be unique across all instances.
mcsValuethe MCS value
modClassthe class of modulation
codeRateCallbacka callback function that returns the coding rate of this WifiMode.
constellationSizeCallbacka callback function that returns the size of modulation constellation of this WifiMode.
phyRateCallbacka callback function to calculate the PHY rate (in bps) of this WifiMode.
phyRateFromTxVectorCallbacka callback function to calculate the PHY rate (in bps) of this WifiMode using a TXVECTOR as input.
dataRateCallbacka callback function to calculate the data rate (in bps) of this WifiMode.
dataRateFromTxVectorCallbacka callback function to calculate the data rate (in bps) of this WifiMode using a TXVECTOR as input.
nonHtReferenceRateCallbacka callback function to calculate the rate (in bps) of the non-HT Reference Rate of this WifiMode.
isModeAllowedCallbacka callback function to calculate whether a combination of <MCS index, channel width (MHz), number of spatial stream> is allowed for this WifiMode.
Returns
WifiMode

Create a HT or later WifiMode.

Definition at line 291 of file wifi-mode.cc.

References AllocateUid(), Get(), ns3::WifiModeFactory::WifiModeItem::GetCodeRateCallback, ns3::WifiModeFactory::WifiModeItem::GetConstellationSizeCallback, ns3::WifiModeFactory::WifiModeItem::GetDataRateCallback, ns3::WifiModeFactory::WifiModeItem::GetDataRateFromTxVectorCallback, GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetNonHtReferenceRateCallback, ns3::WifiModeFactory::WifiModeItem::GetPhyRateCallback, ns3::WifiModeFactory::WifiModeItem::GetPhyRateFromTxVectorCallback, ns3::WifiModeFactory::WifiModeItem::isMandatory, ns3::WifiModeFactory::WifiModeItem::IsModeAllowedCallback, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, ns3::WifiModeFactory::WifiModeItem::uniqueUid, ns3::WIFI_MOD_CLASS_HT, and WifiMode.

Referenced by ns3::HePhy::CreateHeMcs(), ns3::HtPhy::CreateHtMcs(), and ns3::VhtPhy::CreateVhtMcs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateWifiMode()

WifiMode ns3::WifiModeFactory::CreateWifiMode ( std::string  uniqueName,
WifiModulationClass  modClass,
bool  isMandatory,
CodeRateCallback  codeRateCallback,
ConstellationSizeCallback  constellationSizeCallback,
PhyRateCallback  phyRateCallback,
PhyRateFromTxVectorCallback  phyRateFromTxVectorCallback,
DataRateCallback  dataRateCallback,
DataRateFromTxVectorCallback  dataRateFromTxVectorCallback,
ModeAllowedCallback  isModeAllowedCallback 
)
static
Parameters
uniqueNamethe name of the associated WifiMode. This name must be unique across all instances.
modClassthe class of modulation
isMandatorytrue if this WifiMode is mandatory, false otherwise.
codeRateCallbacka callback function to retrieve coding rate of this WifiMode. If convolutional coding is used for this rate then the callback returns the convolutional coding rate used. If there is no explicit convolutional coding step (e.g., for DSSS rates) then the callback should returns WIFI_CODE_RATE_UNDEFINED.
constellationSizeCallbacka callback function that returns the order of the constellation used.
phyRateCallbacka callback function to calculate the PHY rate (in bps) of this WifiMode.
phyRateFromTxVectorCallbacka callback function to calculate the PHY rate (in bps) of this WifiMode using a TXVECTOR as input.
dataRateCallbacka callback function to calculate the data rate (in bps) of this WifiMode.
dataRateFromTxVectorCallbacka callback function to calculate the data rate (in bps) of this WifiMode using a TXVECTOR as input.
isModeAllowedCallbacka callback function to check whether a specific combination of this WifiMode, channel width (MHz), and NSS are allowed.
Returns
WifiMode

Create a non-HT WifiMode.

Definition at line 242 of file wifi-mode.cc.

References AllocateUid(), Get(), ns3::WifiModeFactory::WifiModeItem::GetCodeRateCallback, ns3::WifiModeFactory::WifiModeItem::GetConstellationSizeCallback, ns3::WifiModeFactory::WifiModeItem::GetDataRateCallback, ns3::WifiModeFactory::WifiModeItem::GetDataRateFromTxVectorCallback, GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetNonHtReferenceRateCallback, ns3::WifiModeFactory::WifiModeItem::GetPhyRateCallback, ns3::WifiModeFactory::WifiModeItem::GetPhyRateFromTxVectorCallback, ns3::WifiModeFactory::WifiModeItem::isMandatory, ns3::WifiModeFactory::WifiModeItem::IsModeAllowedCallback, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, NS_FATAL_ERROR, ns3::WifiModeFactory::WifiModeItem::uniqueUid, ns3::WIFI_CODE_RATE_UNDEFINED, ns3::WIFI_MOD_CLASS_DSSS, ns3::WIFI_MOD_CLASS_HR_DSSS, ns3::WIFI_MOD_CLASS_HT, ns3::WIFI_MOD_CLASS_UNKNOWN, and WifiMode.

Referenced by ns3::DsssPhy::CreateDsssMode(), ns3::ErpOfdmPhy::CreateErpOfdmMode(), and ns3::OfdmPhy::CreateOfdmMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

◆ GetFactory()

◆ Search()

WifiMode ns3::WifiModeFactory::Search ( std::string  name) const
private

Search and return WifiMode from a given name.

Parameters
namehuman-readable WifiMode
Returns
the WifiMode

Definition at line 328 of file wifi-mode.cc.

References m_itemList, NS_FATAL_ERROR, NS_LOG_UNCOND, and WifiMode.

Referenced by ns3::operator>>(), and ns3::WifiMode::WifiMode().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  is,
WifiMode mode 
)
friend

Serialize WifiMode from istream (human-readable).

Parameters
isthe input stream
modethe WifiMode
Returns
std::istream

Definition at line 51 of file wifi-mode.cc.

◆ WifiMode

friend class WifiMode
friend

allow WifiMode class access

Definition at line 417 of file wifi-mode.h.

Referenced by CreateWifiMcs(), CreateWifiMode(), and Search().

Member Data Documentation

◆ m_itemList

WifiModeItemList ns3::WifiModeFactory::m_itemList
private

item list

Definition at line 478 of file wifi-mode.h.

Referenced by AllocateUid(), Get(), and Search().


The documentation for this class was generated from the following files: