A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::OptFieldWithPresenceInd< T > Class Template Reference

OptFieldWithPresenceInd is a class modeling an optional field (in an Information Element, a management frame, etc.) having an associated Presence Indicator bit. More...

#include "wifi-opt-field.h"

Inheritance diagram for ns3::OptFieldWithPresenceInd< T >:
Collaboration diagram for ns3::OptFieldWithPresenceInd< T >:

Public Member Functions

 OptFieldWithPresenceInd (bool &presenceFlag)
 constructor
 OptFieldWithPresenceInd (const OptFieldWithPresenceInd &)=delete
 OptFieldWithPresenceInd (OptFieldWithPresenceInd &&)=delete
template<class... Args>
constexpr T & emplace (Args &&... args)
 Construct the contained value in-place.
constexpr bool has_value () const
 Check whether this object contains a value.
constexpr operator bool () const
 Operator bool.
constexpr T & operator* ()
constexpr const T & operator* () const
constexpr T * operator-> ()
constexpr const T * operator-> () const
OptFieldWithPresenceInd & operator= (const OptFieldWithPresenceInd &)=delete
constexpr OptFieldWithPresenceInd & operator= (const std::optional< T > &other)
 Assign the given value to the optional field.
OptFieldWithPresenceInd & operator= (OptFieldWithPresenceInd &&)=delete
constexpr OptFieldWithPresenceInd & operator= (std::nullopt_t)
 Destroy the value (if any) contained in the optional field.
constexpr OptFieldWithPresenceInd & operator= (std::optional< T > &&other)
 Assign the given value to the optional field.
constexpr void reset ()
 Destroy the value (if any) contained in the optional field.
constexpr std::optional< T > ToOptional () const
 This is a helper function commonly used in the copy/move constructors and copy/move assignment operators of the owner class to assign a member of OptFieldWithPresenceInd type.

Private Attributes

std::optional< T > m_field
 the optional field
std::reference_wrapper< bool > m_presenceFlag
 the Presence Indicator flag

Detailed Description

template<typename T>
class ns3::OptFieldWithPresenceInd< T >

OptFieldWithPresenceInd is a class modeling an optional field (in an Information Element, a management frame, etc.) having an associated Presence Indicator bit.

This class is a wrapper around std::optional (most of its functions are exposed, more can be added if needed) that additionally sets the Presence Indicator flag appropriately when operations like reset or assignment of a value are performed on the optional field.

Any class declaring a member of type OptFieldWithPresenceInd must provide a copy constructor and a copy assignment operator (and a move constructor and a move assignment operator, if needed) that correctly bind the Presence Indicator flag of the OptFieldWithPresenceInd member(s). The copy/move constructors and copy/move assignment operators of this class are deleted, so that the compiler will signal the need of adding copy/move constructors and/or copy/move assignment operators in the owner class.

Definition at line 35 of file wifi-opt-field.h.

Constructor & Destructor Documentation

◆ OptFieldWithPresenceInd() [1/3]

template<typename T>
ns3::OptFieldWithPresenceInd< T >::OptFieldWithPresenceInd ( bool & presenceFlag)

constructor

Parameters
presenceFlagthe Presence Indicator flag

Definition at line 120 of file wifi-opt-field.h.

References m_presenceFlag.

Referenced by OptFieldWithPresenceInd(), OptFieldWithPresenceInd(), operator bool(), operator=(), and operator=().

Here is the caller graph for this function:

◆ OptFieldWithPresenceInd() [2/3]

template<typename T>
ns3::OptFieldWithPresenceInd< T >::OptFieldWithPresenceInd ( const OptFieldWithPresenceInd< T > & )
delete

References OptFieldWithPresenceInd().

Here is the call graph for this function:

◆ OptFieldWithPresenceInd() [3/3]

template<typename T>
ns3::OptFieldWithPresenceInd< T >::OptFieldWithPresenceInd ( OptFieldWithPresenceInd< T > && )
delete

References OptFieldWithPresenceInd().

Here is the call graph for this function:

Member Function Documentation

◆ emplace()

template<typename T>
template<class... Args>
T & ns3::OptFieldWithPresenceInd< T >::emplace ( Args &&... args)
constexpr

Construct the contained value in-place.

Template Parameters
Argsthe type of arguments to pass to the constructor
Parameters
argsthe arguments to pass to the constructor
Returns
a reference to the new contained value

Definition at line 208 of file wifi-opt-field.h.

References m_field, and m_presenceFlag.

◆ has_value()

template<typename T>
bool ns3::OptFieldWithPresenceInd< T >::has_value ( ) const
constexpr

Check whether this object contains a value.

Returns
whether this object contains a value

Definition at line 165 of file wifi-opt-field.h.

References m_field.

◆ operator bool()

template<typename T>
ns3::OptFieldWithPresenceInd< T >::operator bool ( ) const
explicitconstexpr

Operator bool.

Returns
whether this object contains a value

Definition at line 156 of file wifi-opt-field.h.

References OptFieldWithPresenceInd(), and m_field.

Here is the call graph for this function:

◆ operator*() [1/2]

template<typename T>
T & ns3::OptFieldWithPresenceInd< T >::operator* ( )
constexpr
Returns
a reference to the contained value

Definition at line 200 of file wifi-opt-field.h.

References m_field.

◆ operator*() [2/2]

template<typename T>
const T & ns3::OptFieldWithPresenceInd< T >::operator* ( ) const
constexpr
Returns
a reference to the contained value

Definition at line 193 of file wifi-opt-field.h.

References m_field.

◆ operator->() [1/2]

template<typename T>
T * ns3::OptFieldWithPresenceInd< T >::operator-> ( )
constexpr
Returns
a pointer to the contained value

Definition at line 186 of file wifi-opt-field.h.

◆ operator->() [2/2]

template<typename T>
const T * ns3::OptFieldWithPresenceInd< T >::operator-> ( ) const
constexpr
Returns
a pointer to the contained value

Definition at line 179 of file wifi-opt-field.h.

◆ operator=() [1/5]

template<typename T>
OptFieldWithPresenceInd & ns3::OptFieldWithPresenceInd< T >::operator= ( const OptFieldWithPresenceInd< T > & )
delete

References OptFieldWithPresenceInd().

Here is the call graph for this function:

◆ operator=() [2/5]

template<typename T>
OptFieldWithPresenceInd< T > & ns3::OptFieldWithPresenceInd< T >::operator= ( const std::optional< T > & other)
constexpr

Assign the given value to the optional field.

Parameters
otherthe given value
Returns
a reference to this object

Definition at line 137 of file wifi-opt-field.h.

References m_field, and m_presenceFlag.

◆ operator=() [3/5]

template<typename T>
OptFieldWithPresenceInd & ns3::OptFieldWithPresenceInd< T >::operator= ( OptFieldWithPresenceInd< T > && )
delete

References OptFieldWithPresenceInd().

Here is the call graph for this function:

◆ operator=() [4/5]

template<typename T>
OptFieldWithPresenceInd< T > & ns3::OptFieldWithPresenceInd< T >::operator= ( std::nullopt_t )
constexpr

Destroy the value (if any) contained in the optional field.

Returns
a reference to this object

Definition at line 128 of file wifi-opt-field.h.

References m_field, and m_presenceFlag.

◆ operator=() [5/5]

template<typename T>
OptFieldWithPresenceInd< T > & ns3::OptFieldWithPresenceInd< T >::operator= ( std::optional< T > && other)
constexpr

Assign the given value to the optional field.

Parameters
otherthe given value
Returns
a reference to this object

Definition at line 146 of file wifi-opt-field.h.

References m_field, and m_presenceFlag.

◆ reset()

template<typename T>
void ns3::OptFieldWithPresenceInd< T >::reset ( )
constexpr

Destroy the value (if any) contained in the optional field.

Definition at line 217 of file wifi-opt-field.h.

References m_field, and m_presenceFlag.

◆ ToOptional()

template<typename T>
std::optional< T > ns3::OptFieldWithPresenceInd< T >::ToOptional ( ) const
constexpr

This is a helper function commonly used in the copy/move constructors and copy/move assignment operators of the owner class to assign a member of OptFieldWithPresenceInd type.

OwnerClass::OwnerClass(const OwnerClass& other)
{
m_optField = other.m_optField.ToOptional();
}
Returns
the contained value wrapped in std::optional, if any

Definition at line 172 of file wifi-opt-field.h.

References m_field.

Referenced by ns3::FilsDiscHeader::FilsDiscHeader(), and ns3::FilsDiscHeader::operator=().

Here is the caller graph for this function:

Member Data Documentation

◆ m_field

template<typename T>
std::optional<T> ns3::OptFieldWithPresenceInd< T >::m_field
private

the optional field

Definition at line 106 of file wifi-opt-field.h.

Referenced by emplace(), has_value(), operator bool(), operator*(), operator*(), operator=(), operator=(), operator=(), reset(), and ToOptional().

◆ m_presenceFlag

template<typename T>
std::reference_wrapper<bool> ns3::OptFieldWithPresenceInd< T >::m_presenceFlag
private

the Presence Indicator flag

Definition at line 107 of file wifi-opt-field.h.

Referenced by OptFieldWithPresenceInd(), emplace(), operator=(), operator=(), operator=(), and reset().


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