102 void Add(
int value, std::string name);
109 std::string
GetName(
int value)
const;
116 int GetValue(
const std::string name)
const;
128 typedef std::pair<int, std::string>
Value;
135template <
typename T1>
138template <
typename T1,
typename T2>
161template <
typename... Ts>
166 checker->AddDefault(v, n);
182template <
typename... Ts>
183Ptr<const AttributeChecker>
197inline Ptr<const AttributeChecker>
203template <
typename T1>
204Ptr<const AttributeAccessor>
207 return MakeAccessorHelper<EnumValue>(a1);
210template <
typename T1,
typename T2>
211Ptr<const AttributeAccessor>
214 return MakeAccessorHelper<EnumValue>(a1, a2);
ns3::MakeAccessorHelper declarations and template implementations.
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
Represent the type of an attribute.
Hold a value for an Attribute.
AttributeChecker implementation for EnumValue.
std::pair< int, std::string > Value
Type for the pair value, name.
bool Copy(const AttributeValue &src, AttributeValue &dst) const override
Copy the source to the destination.
void Add(int value, std::string name)
Add a new value.
ValueSet m_valueSet
The stored Enum values and symbol names.
Ptr< AttributeValue > Create() const override
int GetValue(const std::string name) const
Get the enum value by name.
std::string GetName(int value) const
Get the enum symbol name by value.
std::string GetUnderlyingTypeInformation() const override
void AddDefault(int value, std::string name)
Add a default value.
bool Check(const AttributeValue &value) const override
bool HasUnderlyingTypeInformation() const override
std::list< Value > ValueSet
Type of container for storing Enum values and symbol names.
std::string GetValueTypeName() const override
Hold variables of type enum.
bool GetAccessor(T &value) const
Access the Enum value as type T.
void Set(int value)
Set the value.
std::string SerializeToString(Ptr< const AttributeChecker > checker) const override
bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker) override
int m_value
The stored integer value.
Ptr< AttributeValue > Copy() const override
Smart pointer class similar to boost::intrusive_ptr.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.