62 return ns3::Create<EnumValue> (*
this);
92 m_valueSet.push_front (std::make_pair (value, name));
98 m_valueSet.push_back (std::make_pair (value, name));
104 [value] (
Value v) { return v.first == value; } );
106 "invalid enum value " << value <<
"! Missed entry in MakeEnumChecker?");
113 [name] (
Value v) { return v.second == name; } );
115 "name " << name <<
" not a valid enum value. Missed entry in MakeEnumChecker?");
127 auto pvalue = p->
Get ();
129 [pvalue] (
Value v) { return v.first == pvalue; } );
130 return (it !=
m_valueSet.end ()) ? true :
false;
136 return "ns3::EnumValue";
148 std::ostringstream oss;
149 bool moreValues =
false;
152 oss << (moreValues ?
"|" :
"") << i.second;
161 return ns3::Create<EnumValue> ();
170 if (src == 0 || dst == 0)
Hold a value for an Attribute.
AttributeChecker implementation for EnumValue.
virtual bool Copy(const AttributeValue &src, AttributeValue &dst) const
Copy the source to the destination.
virtual Ptr< AttributeValue > Create(void) const
void Add(int value, std::string name)
Add a new value.
virtual bool Check(const AttributeValue &value) const
ValueSet m_valueSet
The stored Enum values and symbol names.
int GetValue(const std::string name) const
Get the enum value by name.
virtual std::string GetUnderlyingTypeInformation(void) const
std::pair< int, std::string > Value
Type for the pair value, name.
std::string GetName(int value) const
Get the enum symbol name by value.
virtual std::string GetValueTypeName(void) const
void AddDefault(int value, std::string name)
Add a default value.
virtual bool HasUnderlyingTypeInformation(void) const
Hold variables of type enum.
void Set(int value)
Set the value.
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
int m_value
The stored integer value.
virtual Ptr< AttributeValue > Copy(void) const
Smart pointer class similar to boost::intrusive_ptr.
ns3::EnumValue attribute value declarations.
NS_FATAL_x macro definitions.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)