A Discrete-Event Network Simulator
API
ns3::EnumChecker< T > Class Template Reference

#include "enum.h"

+ Inheritance diagram for ns3::EnumChecker< T >:
+ Collaboration diagram for ns3::EnumChecker< T >:

Public Member Functions

 EnumChecker ()
 
void Add (T value, std::string name)
 Add a new value. More...
 
void AddDefault (T value, std::string name)
 Add a default value. More...
 
bool Check (const AttributeValue &value) const override
 
bool Copy (const AttributeValue &src, AttributeValue &dst) const override
 Copy the source to the destination. More...
 
Ptr< AttributeValueCreate () const override
 
std::string GetName (T value) const
 Get the enum symbol name by value. More...
 
std::string GetUnderlyingTypeInformation () const override
 
GetValue (const std::string name) const
 Get the enum value by name. More...
 
std::string GetValueTypeName () const override
 
bool HasUnderlyingTypeInformation () const override
 
- Public Member Functions inherited from ns3::AttributeChecker
 AttributeChecker ()
 
virtual ~AttributeChecker ()
 
Ptr< AttributeValueCreateValidValue (const AttributeValue &value) const
 Create a valid value from the argument value, or reinterpret the argument as a string. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeChecker >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Private Types

using Value = std::pair< T, std::string >
 Type for the pair value, name. More...
 
using ValueSet = std::list< Value >
 Type of container for storing Enum values and symbol names. More...
 

Private Attributes

ValueSet m_valueSet
 The stored Enum values and symbol names. More...
 

Detailed Description

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

Definition at line 123 of file enum.h.

Member Typedef Documentation

◆ Value

template<typename T >
using ns3::EnumChecker< T >::Value = std::pair<T, std::string>
private

Type for the pair value, name.

Definition at line 165 of file enum.h.

◆ ValueSet

template<typename T >
using ns3::EnumChecker< T >::ValueSet = std::list<Value>
private

Type of container for storing Enum values and symbol names.

Definition at line 167 of file enum.h.

Constructor & Destructor Documentation

◆ EnumChecker()

template<typename T >
ns3::EnumChecker< T >::EnumChecker

Definition at line 269 of file enum.h.

Member Function Documentation

◆ Add()

template<typename T >
void ns3::EnumChecker< T >::Add ( value,
std::string  name 
)

Add a new value.

Parameters
[in]valueThe value.
[in]nameThe enum symbol name.

Definition at line 282 of file enum.h.

◆ AddDefault()

template<typename T >
void ns3::EnumChecker< T >::AddDefault ( value,
std::string  name 
)

Add a default value.

Parameters
[in]valueThe value.
[in]nameThen enum symbol name.

Definition at line 275 of file enum.h.

◆ Check()

template<typename T >
bool ns3::EnumChecker< T >::Check ( const AttributeValue value) const
overridevirtual
Parameters
[in]valueA pointer to the value to check
Returns
true if the input value is both of the right type and if its value is within the requested range. Returns false otherwise.

Implements ns3::AttributeChecker.

Definition at line 331 of file enum.h.

References ns3::EnumValue< T >::Get(), and second::value.

+ Here is the call graph for this function:

◆ Copy()

template<typename T >
bool ns3::EnumChecker< T >::Copy ( const AttributeValue source,
AttributeValue destination 
) const
overridevirtual

Copy the source to the destination.

Parameters
[in]sourceSource AttributeValue
[out]destinationDestination AttributeValue
Returns
true if copy was successful

Implements ns3::AttributeChecker.

Definition at line 382 of file enum.h.

◆ Create()

template<typename T >
Ptr< AttributeValue > ns3::EnumChecker< T >::Create ( ) const
overridevirtual
Returns
a new instance of an AttributeValue (wrapper in an Attribute instance) which matches the type of the underlying attribute.

This method is typically used to create a temporary variable prior to calling Attribute::DeserializeFromString.

Implements ns3::AttributeChecker.

Definition at line 375 of file enum.h.

◆ GetName()

template<typename T >
std::string ns3::EnumChecker< T >::GetName ( value) const

Get the enum symbol name by value.

Parameters
[in]valueThe value.
Returns
The enum symbol name.

Definition at line 289 of file enum.h.

References NS_ASSERT_MSG.

◆ GetUnderlyingTypeInformation()

template<typename T >
std::string ns3::EnumChecker< T >::GetUnderlyingTypeInformation ( ) const
overridevirtual
Returns
a human-readable representation of information about the underlying C++ type.

Implements ns3::AttributeChecker.

Definition at line 361 of file enum.h.

◆ GetValue()

template<typename T >
T ns3::EnumChecker< T >::GetValue ( const std::string  name) const

Get the enum value by name.

Parameters
[in]nameThen enum symbol name.
Returns
The enum value.

Definition at line 303 of file enum.h.

References NS_ASSERT_MSG.

◆ GetValueTypeName()

template<typename T >
std::string ns3::EnumChecker< T >::GetValueTypeName ( ) const
overridevirtual
Returns
the c++ fully-qualified typename of the subclass of the ns3::AttributeValue base class which is associated to this checker.

A typical return value here is FooValue where Foo is the name of the type being wrapped.

Implements ns3::AttributeChecker.

Definition at line 347 of file enum.h.

◆ HasUnderlyingTypeInformation()

template<typename T >
bool ns3::EnumChecker< T >::HasUnderlyingTypeInformation ( ) const
overridevirtual
Returns
true if this checker has information about the underlying C++ type, false otherwise.

If this method returns false, the return value of the GetUnderlyingTypeInformation method cannot be relied upon.

Implements ns3::AttributeChecker.

Definition at line 354 of file enum.h.

Member Data Documentation

◆ m_valueSet

template<typename T >
ValueSet ns3::EnumChecker< T >::m_valueSet
private

The stored Enum values and symbol names.

Definition at line 169 of file enum.h.


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