AttributeChecker implementation for EnumValue. More...
#include "enum.h"
Public Member Functions | |
EnumChecker () | |
void | Add (int value, std::string name) |
Add a new value. More... | |
void | AddDefault (int value, std::string name) |
Add a default value. More... | |
virtual bool | Check (const AttributeValue &value) const |
virtual bool | Copy (const AttributeValue &src, AttributeValue &dst) const |
Copy the source to the destination. More... | |
virtual Ptr< AttributeValue > | Create (void) const |
std::string | GetName (int value) const |
Get the enum symbol name by value. More... | |
virtual std::string | GetUnderlyingTypeInformation (void) const |
int | GetValue (const std::string name) const |
Get the enum value by name. More... | |
virtual std::string | GetValueTypeName (void) const |
virtual bool | HasUnderlyingTypeInformation (void) const |
Public Member Functions inherited from ns3::AttributeChecker | |
AttributeChecker () | |
virtual | ~AttributeChecker () |
Ptr< AttributeValue > | CreateValidValue (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 (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Private Types | |
typedef std::pair< int, std::string > | Value |
Type for the pair value, name. More... | |
typedef std::list< Value > | ValueSet |
Type of container for storing Enum values and symbol names. More... | |
Private Attributes | |
ValueSet | m_valueSet |
The stored Enum values and symbol names. More... | |
AttributeChecker implementation for EnumValue.
|
private |
|
private |
ns3::EnumChecker::EnumChecker | ( | ) |
Definition at line 84 of file enum.cc.
References NS_LOG_FUNCTION.
void ns3::EnumChecker::Add | ( | int | value, |
std::string | name | ||
) |
Add a new value.
[in] | value | The value. |
[in] | name | The enum symbol name. |
Definition at line 96 of file enum.cc.
References m_valueSet, and NS_LOG_FUNCTION.
void ns3::EnumChecker::AddDefault | ( | int | value, |
std::string | name | ||
) |
Add a default value.
[in] | value | The value. |
[in] | name | Then enum symbol name. |
Definition at line 90 of file enum.cc.
References m_valueSet, and NS_LOG_FUNCTION.
|
virtual |
[in] | value | A pointer to the value to check |
Implements ns3::AttributeChecker.
Definition at line 130 of file enum.cc.
References ns3::EnumValue::Get(), and NS_LOG_FUNCTION.
|
virtual |
Copy the source to the destination.
[in] | source | Source AttributeValue |
[out] | destination | Destination AttributeValue |
Implements ns3::AttributeChecker.
Definition at line 176 of file enum.cc.
References NS_LOG_FUNCTION.
|
virtual |
This method is typically used to create a temporary variable prior to calling Attribute::DeserializeFromString.
Implements ns3::AttributeChecker.
Definition at line 169 of file enum.cc.
References NS_LOG_FUNCTION.
std::string ns3::EnumChecker::GetName | ( | int | value | ) | const |
Get the enum symbol name by value.
[in] | value | The value. |
Definition at line 102 of file enum.cc.
References m_valueSet, and NS_ASSERT_MSG.
Referenced by ns3::EnumValue::SerializeToString().
|
virtual |
Implements ns3::AttributeChecker.
Definition at line 156 of file enum.cc.
References NS_LOG_FUNCTION.
int ns3::EnumChecker::GetValue | ( | const std::string | name | ) | const |
Get the enum value by name.
[in] | name | Then enum symbol name. |
Definition at line 111 of file enum.cc.
References m_valueSet, and NS_ASSERT_MSG.
Referenced by ns3::EnumValue::DeserializeFromString().
|
virtual |
A typical return value here is FooValue where Foo is the name of the type being wrapped.
Implements ns3::AttributeChecker.
Definition at line 144 of file enum.cc.
References NS_LOG_FUNCTION.
|
virtual |
If this method returns false, the return value of the GetUnderlyingTypeInformation method cannot be relied upon.
Implements ns3::AttributeChecker.
Definition at line 150 of file enum.cc.
References NS_LOG_FUNCTION.
|
private |
The stored Enum values and symbol names.
Definition at line 131 of file enum.h.
Referenced by Add(), AddDefault(), GetName(), and GetValue().