69 return ns3::Create<EnumValue>(*
this);
115 return v.first == value;
118 "invalid enum value " << value <<
"! Missed entry in MakeEnumChecker?");
126 return v.second == name;
132 <<
" is not a valid enum value. Missed entry in MakeEnumChecker?\nAvailable values: "
136 [](std::string a,
Value v) {
143 return std::move(a) +
", " + v.second;
158 auto pvalue = p->
Get();
159 auto it = std::find_if(m_valueSet.begin(), m_valueSet.end(), [pvalue](
Value v) {
160 return v.first == pvalue;
162 return (it != m_valueSet.end());
166EnumChecker::GetValueTypeName()
const
169 return "ns3::EnumValue";
173EnumChecker::HasUnderlyingTypeInformation()
const
180EnumChecker::GetUnderlyingTypeInformation()
const
183 std::ostringstream oss;
184 bool moreValues =
false;
185 for (
const auto& i : m_valueSet)
187 oss << (moreValues ?
"|" :
"") << i.second;
194EnumChecker::Create()
const
197 return ns3::Create<EnumValue>();
206 if (src ==
nullptr || dst ==
nullptr)
Hold a value for an Attribute.
AttributeChecker implementation for EnumValue.
std::pair< int, std::string > Value
Type for the pair value, name.
void Add(int value, std::string name)
Add a new value.
ValueSet m_valueSet
The stored Enum values and symbol names.
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.
void AddDefault(int value, std::string name)
Add a default value.
Hold variables of type enum.
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.
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)