template<typename T>
class ns3::EnumValue< T >
Hold variables of type enum
.
This class can be used to hold variables of any kind of enum.
This is often used with ObjectFactory and Config to bind the value of a particular enum to an Attribute or Config name. For example,
Ptr<RateErrorModel> model = CreateObjectWithAttributes<RateErrorModel> (
"ErrorRate", DoubleValue (0.05),
@ NO_SPLIT_HORIZON
No Split Horizon.
void SetDefault(std::string name, const AttributeValue &value)
Definition at line 61 of file enum.h.
- Parameters
-
[in] | value | A string representation of the value |
[in] | checker | A pointer to the checker associated to the attribute. |
- Returns
- true if the input string was correctly-formatted and could be successfully deserialized, false otherwise.
Upon return of this function, this AttributeValue instance contains the deserialized value. In most cases, this method will not make any use of the checker argument. However, in a very limited set of cases, the checker argument is needed to perform proper serialization. A nice example of code which needs it is the EnumValue::SerializeToString code.
Implements ns3::AttributeValue.
Definition at line 260 of file enum.h.
References NS_ASSERT, and ns3::PeekPointer().
- Parameters
-
[in] | checker | The checker associated to the attribute |
- Returns
- A string representation of this value.
In most cases, this method will not make any use of the checker argument. However, in a very limited set of cases, the checker argument is needed to perform proper serialization. A nice example of code which needs it is the EnumValue::SerializeToString code.
Implements ns3::AttributeValue.
Definition at line 250 of file enum.h.
References NS_ASSERT, and ns3::PeekPointer().