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< bool, const WifiTxVector & > AllowedCallback
 Typedef for callback used to check whether a given combination is allowed. More...
 
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, const WifiTxVector &, uint16_t > DataRateCallback
 Typedef for callback used to calculate data rate of a WifiMode from a TXVECTOR. 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, const WifiTxVector &, uint16_t > PhyRateCallback
 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, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, DataRateCallback dataRateCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, AllowedCallback isAllowedCallback)
 
static WifiMode CreateWifiMode (std::string uniqueName, WifiModulationClass modClass, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, DataRateCallback dataRateCallback, AllowedCallback isAllowedCallback)
 

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 274 of file wifi-mode.h.

Member Typedef Documentation

◆ AllowedCallback

Typedef for callback used to check whether a given combination is allowed.

Parameters
txVectorthe TXVECTOR containing the combination to check
Returns
true if combination of current WifiMode and TXVECTOR is allowed.

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

◆ CodeRateCallback

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

Returns
the code rate of the WifiMode.

Definition at line 282 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 287 of file wifi-mode.h.

◆ DataRateCallback

typedef Callback<uint64_t, const WifiTxVector& , uint16_t > ns3::WifiModeFactory::DataRateCallback

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

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

Definition at line 307 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 315 of file wifi-mode.h.

◆ PhyRateCallback

typedef Callback<uint64_t, const WifiTxVector& , uint16_t > ns3::WifiModeFactory::PhyRateCallback

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

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

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

◆ WifiModeItemList

typedef for a vector of WifiModeItem.

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

Constructor & Destructor Documentation

◆ WifiModeFactory()

ns3::WifiModeFactory::WifiModeFactory ( )
private

Definition at line 265 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 383 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,
bool  isMandatory,
CodeRateCallback  codeRateCallback,
ConstellationSizeCallback  constellationSizeCallback,
PhyRateCallback  phyRateCallback,
DataRateCallback  dataRateCallback,
NonHtReferenceRateCallback  nonHtReferenceRateCallback,
AllowedCallback  isAllowedCallback 
)
static
Parameters
uniqueNamethe name of the associated WifiMode. This name must be unique across all instances.
mcsValuethe MCS value
modClassthe class of modulation
isMandatorytrue if this WifiMode is mandatory, false otherwise.
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.
dataRateCallbacka callback function to calculate the data rate (in bps) of this WifiMode.
nonHtReferenceRateCallbacka callback function to calculate the rate (in bps) of the non-HT Reference Rate of this WifiMode.
isAllowedCallbacka callback function to calculate whether a given combination of is allowed for this WifiMode.
Returns
WifiMode

Create a HT or later WifiMode.

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

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

Referenced by ns3::EhtPhy::CreateEhtMcs(), 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,
DataRateCallback  dataRateCallback,
AllowedCallback  isAllowedCallback 
)
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.
dataRateCallbacka callback function to calculate the data rate (in bps) of this WifiMode.
isAllowedCallbacka callback function to check whether a specific combination of this WifiMode is allowed.
Returns
WifiMode

Create a non-HT WifiMode.

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

References AllocateUid(), Get(), ns3::WifiModeFactory::WifiModeItem::GetCodeRateCallback, ns3::WifiModeFactory::WifiModeItem::GetConstellationSizeCallback, ns3::WifiModeFactory::WifiModeItem::GetDataRateCallback, GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetNonHtReferenceRateCallback, ns3::WifiModeFactory::WifiModeItem::GetPhyRateCallback, ns3::WifiModeFactory::WifiModeItem::IsAllowedCallback, ns3::WifiModeFactory::WifiModeItem::isMandatory, 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 350 of file wifi-mode.cc.

References m_itemList, NS_FATAL_ERROR, NS_LOG_UNCOND, and WifiMode.

Referenced by 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 59 of file wifi-mode.cc.

◆ WifiMode

friend class WifiMode
friend

allow WifiMode class access

Definition at line 392 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 459 of file wifi-mode.h.

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


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