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

AttributeChecker implementation for EnumValue. More...

#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.
 
void AddDefault (T value, std::string name)
 Add a default value.
 
bool Check (const AttributeValue &value) const override
 
bool Copy (const AttributeValue &src, AttributeValue &dst) const override
 Copy the source to the destination.
 
Ptr< AttributeValueCreate () const override
 
std::string GetName (T value) const
 Get the enum symbol name by value.
 
std::string GetUnderlyingTypeInformation () const override
 
GetValue (const std::string name) const
 Get the enum value by name.
 
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.
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeChecker >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Types

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

Private Attributes

ValueSet m_valueSet
 The stored Enum values and symbol names.
 

Detailed Description

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

AttributeChecker implementation for EnumValue.

See also
AttributeChecker

Definition at line 108 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 150 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 152 of file enum.h.

Constructor & Destructor Documentation

◆ EnumChecker()

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

Definition at line 254 of file enum.h.

Member Function Documentation

◆ Add()

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

Add a new value.

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

Definition at line 267 of file enum.h.

◆ AddDefault()

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

Add a default value.

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

Definition at line 260 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 316 of file enum.h.

References ns3::EnumValue< T >::Get().

+ 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 367 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 360 of file enum.h.

References ns3::Create().

+ Here is the call graph for this function:

◆ GetName()

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

Get the enum symbol name by value.

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

Definition at line 274 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 346 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 288 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 332 of file enum.h.

References ns3::Demangle().

+ Here is the call graph for this function:

◆ 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 339 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 154 of file enum.h.


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