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)
181 int v2, std::string n2,
182 int v3, std::string n3,
183 int v4, std::string n4,
184 int v5, std::string n5,
185 int v6, std::string n6,
186 int v7, std::string n7,
187 int v8, std::string n8,
188 int v9, std::string n9,
189 int v10, std::string n10,
190 int v11, std::string n11,
191 int v12, std::string n12,
192 int v13, std::string n13,
193 int v14, std::string n14,
194 int v15, std::string n15,
195 int v16, std::string n16,
196 int v17, std::string n17,
197 int v18, std::string n18,
198 int v19, std::string n19,
199 int v20, std::string n20,
200 int v21, std::string n21,
201 int v22, std::string n22)
203 NS_LOG_FUNCTION (v1 << n1 << v2 << n2 << v3 << n3 << v4 << n4 << v5 << n5 <<
204 v6 << n6 << v7 << n7 << v8 << n8 << v9 << n9 << v10 << n10 <<
205 v11 << n11 << v12 << n12 << v13 << n13 << v14 << n14 <<
206 v15 << n15 << v16 << n16 << v17 << n17 << v18 << n18 <<
207 v19 << n19 << v20 << n20 << v21 << n21 << v22 << n22);
214 checker->
Add (v2, n2);
219 checker->
Add (v3, n3);
224 checker->
Add (v4, n4);
229 checker->
Add (v5, n5);
234 checker->
Add (v6, n6);
239 checker->
Add (v7, n7);
244 checker->
Add (v8, n8);
249 checker->
Add (v9, n9);
254 checker->
Add (v10, n10);
259 checker->
Add (v11, n11);
264 checker->
Add (v12, n12);
269 checker->
Add (v13, n13);
274 checker->
Add (v14, n14);
279 checker->
Add (v15, n15);
284 checker->
Add (v16, n16);
289 checker->
Add (v17, n17);
294 checker->
Add (v18, n18);
299 checker->
Add (v19, n19);
304 checker->
Add (v20, n20);
309 checker->
Add (v21, n21);
314 checker->
Add (v22, n22);
NS_FATAL_x macro definitions.
int GetValue(const std::string name) const
Get the enum value by name.
void AddDefault(int value, std::string name)
Add a default value.
std::pair< int, std::string > Value
Type for the pair value, name.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual std::string GetUnderlyingTypeInformation(void) const
virtual Ptr< AttributeValue > Create(void) const
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold a value for an Attribute.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
U * PeekPointer(const Ptr< U > &p)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual bool Copy(const AttributeValue &src, AttributeValue &dst) const
Copy the source to the destination.
void Add(int value, std::string name)
Add a new value.
Hold variables of type enum.
int m_value
The stored integer value.
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
ns3::EnumValue attribute value declarations.
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Set(int value)
Set the value.
virtual bool Check(const AttributeValue &value) const
AttributeChecker implementation for EnumValue.
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
virtual std::string GetValueTypeName(void) const
ValueSet m_valueSet
The stored Enum values and symbol names.
virtual bool HasUnderlyingTypeInformation(void) const
std::string GetName(int value) const
Get the enum symbol name by value.
virtual Ptr< AttributeValue > Copy(void) const