diff --git a/samples/main-grid-topology.cc b/samples/main-grid-topology.cc index 69a0349d2..c9c6a655a 100644 --- a/samples/main-grid-topology.cc +++ b/samples/main-grid-topology.cc @@ -33,7 +33,7 @@ int main (int argc, char *argv[]) "MinY", FpValue (-100.0), "DeltaX", FpValue (5.0), "DeltaY", FpValue (20.0), - "GridWidth", UintValue (20), + "GridWidth", Uinteger (20), "LayoutType", "RowFirst"); // each object will be attached a static position. // i.e., once set by the "position allocator", the diff --git a/src/core/initial-value.cc b/src/core/initial-value.cc index 11e7f9741..71321109f 100644 --- a/src/core/initial-value.cc +++ b/src/core/initial-value.cc @@ -96,8 +96,8 @@ InitialValue::GetVector (void) namespace { static ns3::InitialValue g_uint = ns3::InitialValue ("TestUint", "help text", - ns3::UintValue (10), - ns3::MakeUintChecker ()); + ns3::Uinteger (10), + ns3::MakeUintegerChecker ()); } @@ -120,7 +120,7 @@ InitialValueTests::RunTests (void) { bool result = true; - NS_TEST_ASSERT_EQUAL (10, UintValue (g_uint.GetValue ()).Get ()); + NS_TEST_ASSERT_EQUAL (10, Uinteger (g_uint.GetValue ()).Get ()); return result; } diff --git a/src/core/int-value.cc b/src/core/int-value.cc index 30f068c5e..3a4f9f08c 100644 --- a/src/core/int-value.cc +++ b/src/core/int-value.cc @@ -4,80 +4,65 @@ namespace ns3 { -IntValue::IntValue (int64_t value) +Integer::Integer (int64_t value) : m_value (value) {} -Attribute -IntValue::Copy (void) const -{ - return Attribute::Create (*this); -} - +Integer::Integer () + : m_value (0) +{} void -IntValue::Set (int64_t value) +Integer::Set (int64_t value) { m_value = value; } int64_t -IntValue::Get (void) const +Integer::Get (void) const { return m_value; } -std::string -IntValue::SerializeToString (Ptr checker) const + +Integer::operator int64_t () const { - std::ostringstream oss; - oss << m_value; - return oss.str (); + return m_value; } -bool -IntValue::DeserializeFromString (std::string value, Ptr checker) + +ATTRIBUTE_VALUE_IMPLEMENT (Integer); + +std::ostream &operator << (std::ostream &os, const Integer &integer) +{ + os << integer.Get (); + return os; +} +std::istream &operator >> (std::istream &is, Integer &integer) { int64_t v; - std::istringstream iss; - iss.str (value); - iss >> v; - bool ok = !iss.bad () && !iss.fail (); - if (ok) - { - m_value = v; - } - return ok; + is >> v; + integer.Set (v); + return is; } -IntValue::IntValue (Attribute value) -{ - const IntValue *v = value.DynCast (); - if (v == 0) - { - NS_FATAL_ERROR ("assigning non-Int value to Int value."); - } - m_value = v->m_value; -} -IntValue::operator Attribute () const -{ - return Attribute::Create (*this); -} +ATTRIBUTE_CONVERTER_IMPLEMENT (Integer); + Ptr -MakeIntChecker (int64_t min, int64_t max) +MakeIntegerChecker (int64_t min, int64_t max) { - struct IntChecker : public AttributeChecker + struct IntegerChecker : public AttributeChecker { - IntChecker (int64_t minValue, int64_t maxValue) + IntegerChecker (int64_t minValue, int64_t maxValue) : m_minValue (minValue), m_maxValue (maxValue) {} virtual bool Check (Attribute value) const { - const IntValue *v = value.DynCast (); + const IntegerValue *v = value.DynCast (); if (v == 0) { return false; } - return v->Get () >= m_minValue && v->Get () <= m_maxValue; + return v->Get ().Get () >= m_minValue && v->Get ().Get() <= m_maxValue; } int64_t m_minValue; int64_t m_maxValue; - } *checker = new IntChecker (min, max); + } *checker = new IntegerChecker (min, max); return Ptr (checker, false); } diff --git a/src/core/int-value.h b/src/core/int-value.h index 82c01e9ef..28fac4d27 100644 --- a/src/core/int-value.h +++ b/src/core/int-value.h @@ -1,65 +1,49 @@ -#ifndef INT_VALUE_H -#define INT_VALUE_H +#ifndef INTEGER_H +#define INTEGER_H #include "attribute.h" -#include "param-spec-helper.h" +#include "value-helper.h" #include namespace ns3 { -class IntValue : public AttributeValue +class Integer { public: - IntValue (int64_t value); + Integer (int64_t value); + Integer (); void Set (int64_t value); int64_t Get (void) const; - virtual Attribute Copy (void) const; - virtual std::string SerializeToString (Ptr checker) const; - virtual bool DeserializeFromString (std::string value, Ptr checker); - - IntValue (Attribute value); - operator Attribute () const; + operator int64_t () const; + ATTRIBUTE_CONVERTER_DEFINE (Integer); private: int64_t m_value; }; -class IntAccessor : public AttributeAccessor {}; +std::ostream &operator << (std::ostream &os, const Integer &integer); +std::istream &operator >> (std::istream &is, Integer &integer); -template -Ptr MakeIntAccessor (T1 a1); -template -Ptr MakeIntAccessor (T1 a1, T2 a2); +ATTRIBUTE_VALUE_DEFINE(Integer); +ATTRIBUTE_ACCESSOR_DEFINE(Integer); template -Ptr MakeIntChecker (void); +Ptr MakeIntegerChecker (void); -Ptr MakeIntChecker (int64_t min, int64_t max); +Ptr MakeIntegerChecker (int64_t min, int64_t max); } // namespace ns3 namespace ns3 { -template -Ptr -MakeIntAccessor (T1 a1) -{ - return MakeAccessorHelper (a1); -} -template -Ptr MakeIntAccessor (T1 a1, T2 a2) -{ - return MakeAccessorHelper (a1, a2); -} - template Ptr -MakeIntChecker (void) +MakeIntegerChecker (void) { - return MakeIntChecker (std::numeric_limits::min (), - std::numeric_limits::max ()); + return MakeIntegerChecker (std::numeric_limits::min (), + std::numeric_limits::max ()); } } // namespace ns3 -#endif /* INT_VALUE_H */ +#endif /* INTEGER_H */ diff --git a/src/core/random-variable.cc b/src/core/random-variable.cc index 1e3929cfe..28255ebd9 100644 --- a/src/core/random-variable.cc +++ b/src/core/random-variable.cc @@ -52,7 +52,7 @@ public: RandomVariableBase (const RandomVariableBase &o); virtual ~RandomVariableBase(); virtual double GetValue() = 0; - virtual uint32_t GetIntValue(); + virtual uint32_t GetInteger(); virtual RandomVariableBase* Copy(void) const = 0; virtual void GetSeed(uint32_t seed[6]); @@ -127,7 +127,7 @@ RandomVariableBase::~RandomVariableBase() delete m_generator; } -uint32_t RandomVariableBase::GetIntValue() +uint32_t RandomVariableBase::GetInteger() { return (uint32_t)GetValue(); } @@ -269,9 +269,9 @@ RandomVariable::GetValue (void) const } uint32_t -RandomVariable::GetIntValue (void) const +RandomVariable::GetInteger (void) const { - return m_variable->GetIntValue (); + return m_variable->GetInteger (); } void RandomVariable::GetSeed(uint32_t seed[6]) const @@ -455,7 +455,7 @@ public: * \return The constant value specified */ virtual double GetValue(); - virtual uint32_t GetIntValue(); + virtual uint32_t GetInteger(); virtual RandomVariableBase* Copy(void) const; private: double m_const; @@ -478,7 +478,7 @@ double ConstantVariableImpl::GetValue() return m_const; } -uint32_t ConstantVariableImpl::GetIntValue() +uint32_t ConstantVariableImpl::GetInteger() { return (uint32_t)m_const; } @@ -1276,7 +1276,7 @@ public: /** * \return An integer value from this empirical distribution */ - virtual uint32_t GetIntValue(); + virtual uint32_t GetInteger(); private: virtual double Interpolate(double, double, double, double, double); }; @@ -1284,7 +1284,7 @@ private: IntEmpiricalVariableImpl::IntEmpiricalVariableImpl() { } -uint32_t IntEmpiricalVariableImpl::GetIntValue() +uint32_t IntEmpiricalVariableImpl::GetInteger() { return (uint32_t)GetValue(); } diff --git a/src/core/random-variable.h b/src/core/random-variable.h index d4f4e9afa..939680ba7 100644 --- a/src/core/random-variable.h +++ b/src/core/random-variable.h @@ -72,7 +72,7 @@ public: * \brief Returns a random integer integer from the underlying distribution * \return Integer cast of ::GetValue() */ - uint32_t GetIntValue (void) const; + uint32_t GetInteger (void) const; /** * \brief Get the internal state of the RNG diff --git a/src/core/uint-value.cc b/src/core/uint-value.cc index bc7727b9e..1bc850783 100644 --- a/src/core/uint-value.cc +++ b/src/core/uint-value.cc @@ -4,63 +4,43 @@ namespace ns3 { -UintValue::UintValue (uint64_t value) +Uinteger::Uinteger (uint64_t value) : m_value (value) {} -Attribute -UintValue::Copy (void) const -{ - return Attribute::Create (*this); -} - +Uinteger::Uinteger () +{} void -UintValue::Set (uint64_t value) +Uinteger::Set (uint64_t value) { m_value = value; } uint64_t -UintValue::Get (void) const +Uinteger::Get (void) const { return m_value; } -std::string -UintValue::SerializeToString (Ptr checker) const +Uinteger::operator uint64_t () const { - std::ostringstream oss; - oss << m_value; - return oss.str (); + return m_value; } -bool -UintValue::DeserializeFromString (std::string value, Ptr checker) +std::ostream & operator << (std::ostream &os, const Uinteger &uinteger) +{ + os << uinteger.Get (); + return os; +} +std::istream & operator >> (std::istream &is, Uinteger &uinteger) { uint64_t v; - std::istringstream iss; - iss.str (value); - iss >> v; - bool ok = !iss.bad () && !iss.fail (); - if (ok) - { - m_value = v; - } - return ok; + is >> v; + uinteger.Set (v); + return is; } -UintValue::UintValue (Attribute value) -{ - const UintValue *v = value.DynCast (); - if (v == 0) - { - NS_FATAL_ERROR ("assigning non-Uint value to Uint value."); - } - m_value = v->m_value; -} -UintValue::operator Attribute () const -{ - return Attribute::Create (*this); -} +ATTRIBUTE_CONVERTER_IMPLEMENT(Uinteger); +ATTRIBUTE_VALUE_IMPLEMENT(Uinteger); -Ptr MakeUintChecker (uint64_t min, uint64_t max) +Ptr MakeUintegerChecker (uint64_t min, uint64_t max) { struct Checker : public AttributeChecker { @@ -68,12 +48,12 @@ Ptr MakeUintChecker (uint64_t min, uint64_t max) : m_minValue (minValue), m_maxValue (maxValue) {} virtual bool Check (Attribute value) const { - const UintValue *v = value.DynCast (); + const UintegerValue *v = value.DynCast (); if (v == 0) { return false; } - return v->Get () >= m_minValue && v->Get () <= m_maxValue; + return v->Get ().Get () >= m_minValue && v->Get ().Get () <= m_maxValue; } uint64_t m_minValue; uint64_t m_maxValue; diff --git a/src/core/uint-value.h b/src/core/uint-value.h index 2775d84b8..4c7fb3124 100644 --- a/src/core/uint-value.h +++ b/src/core/uint-value.h @@ -1,65 +1,50 @@ -#ifndef UINT_VALUE_H -#define UINT_VALUE_H +#ifndef UINTEGER_H +#define UINTEGER_H #include "attribute.h" -#include "param-spec-helper.h" +#include "value-helper.h" #include namespace ns3 { -class UintValue : public AttributeValue +class Uinteger { public: - UintValue (uint64_t value); - virtual Attribute Copy (void) const; - virtual std::string SerializeToString (Ptr checker) const; - virtual bool DeserializeFromString (std::string value, Ptr checker); + Uinteger (uint64_t value); + Uinteger (); void Set (uint64_t value); uint64_t Get (void) const; - UintValue (Attribute value); - operator Attribute () const; + operator uint64_t () const; + + ATTRIBUTE_CONVERTER_DEFINE (Uinteger); private: uint64_t m_value; }; -class UintAccessor : public AttributeAccessor {}; +std::ostream & operator << (std::ostream &os, const Uinteger &uinteger); +std::istream & operator >> (std::istream &is, Uinteger &uinteger); -template -Ptr MakeUintAccessor (T1 a1); -template -Ptr MakeUintAccessor (T1 a1, T2 a2); +ATTRIBUTE_VALUE_DEFINE (Uinteger); +ATTRIBUTE_ACCESSOR_DEFINE (Uinteger); template -Ptr MakeUintChecker (void); +Ptr MakeUintegerChecker (void); -Ptr MakeUintChecker (uint64_t min, uint64_t max); +Ptr MakeUintegerChecker (uint64_t min, uint64_t max); } // namespace ns3 namespace ns3 { -template -Ptr -MakeUintAccessor (T1 a1) -{ - return MakeAccessorHelper (a1); -} - -template -Ptr MakeUintAccessor (T1 a1, T2 a2) -{ - return MakeAccessorHelper (a1, a2); -} - template -Ptr MakeUintChecker (void) +Ptr MakeUintegerChecker (void) { - return MakeUintChecker (std::numeric_limits::min (), - std::numeric_limits::max ()); + return MakeUintegerChecker (std::numeric_limits::min (), + std::numeric_limits::max ()); } } // namespace ns3 -#endif /* UINT_PARAMETER_H */ +#endif /* UINTEGER_H */ diff --git a/src/core/value-helper.h b/src/core/value-helper.h index b5c6283ef..84c983a67 100644 --- a/src/core/value-helper.h +++ b/src/core/value-helper.h @@ -3,39 +3,118 @@ #include "class-value-helper.h" -#define VALUE_HELPER_HEADER_1(type) \ - type (Attribute value); \ - operator Attribute () const; -#define VALUE_HELPER_HEADER_2(type) \ - class type##Value : public AttributeValue {}; \ +#define ATTRIBUTE_ACCESSOR_DEFINE(type) \ class type##Accessor : public AttributeAccessor {}; \ - Ptr Make##type##Checker (void); \ template \ Ptr Make##type##Accessor (T1 a1) \ { \ - return MakeClassValueHelperAccessor< type , \ - type##Value, type##Accessor> (a1); \ + return MakeAccessorHelper (a1); \ } \ template \ Ptr Make##type##Accessor (T1 a1, T2 a2) \ { \ - return MakeClassValueHelperAccessor (a1, a2); \ + return MakeAccessorHelper (a1, a2); \ } -#define VALUE_HELPER_CPP(type) \ +#define ATTRIBUTE_VALUE_DEFINE(type) \ + class type##Value : public AttributeValue \ + { \ + public: \ + type##Value (const type &value); \ + void Set (const type &value); \ + type Get (void) const; \ + virtual Attribute Copy (void) const; \ + virtual std::string SerializeToString (Ptr checker) const; \ + virtual bool DeserializeFromString (std::string value, Ptr checker); \ + type##Value (Attribute value); \ + operator Attribute () const; \ + private: \ + type m_value; \ + }; + +#define ATTRIBUTE_CONVERTER_DEFINE(type) \ + type (Attribute value); \ + operator Attribute () const; + +#define ATTRIBUTE_CHECKER_DEFINE(type) \ + Ptr Make##type##Checker (void); \ + +#define ATTRIBUTE_VALUE_IMPLEMENT(type) \ + type##Value::type##Value (const type &value) \ + : m_value (value) {} \ + void type##Value::Set (const type &v) { \ + m_value = v; \ + } \ + type type##Value::Get (void) const { \ + return m_value; \ + } \ + Attribute \ + type##Value::Copy (void) const { \ + return Attribute::Create (*this); \ + } \ + std::string \ + type##Value::SerializeToString (Ptr checker) const { \ + std::ostringstream oss; \ + oss << m_value; \ + return oss.str (); \ + } \ + bool \ + type##Value::DeserializeFromString (std::string value, Ptr checker) { \ + std::istringstream iss; \ + iss.str (value); \ + iss >> m_value; \ + return !iss.bad () && !iss.fail (); \ + } \ + type##Value::type##Value (Attribute value) \ + { \ + type##Value *v = value.DynCast (); \ + if (v == 0) \ + { \ + NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \ + } \ + m_value = v->Get (); \ + } \ + type##Value::operator Attribute () const \ + { \ + return Attribute::Create (*this); \ + } + +#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \ Ptr Make##type##Checker (void) \ { \ return MakeSimpleAttributeChecker (); \ } \ + +#define ATTRIBUTE_CONVERTER_IMPLEMENT(type) \ type::type (Attribute value) \ { \ - *this = ClassValueHelperExtractFrom (value); \ + const type##Value *v = value.DynCast (); \ + if (v == 0) \ + { \ + NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \ + } \ + *this = v->Get (); \ } \ type::operator Attribute () const \ { \ - return ClassValueHelperConvertTo (this); \ + return Attribute::Create (*this); \ } + +#define VALUE_HELPER_HEADER_1(type) \ + ATTRIBUTE_CONVERTER_DEFINE (type) + +#define VALUE_HELPER_HEADER_2(type) \ + ATTRIBUTE_VALUE_DEFINE (type); \ + ATTRIBUTE_ACCESSOR_DEFINE (type); \ + ATTRIBUTE_CHECKER_DEFINE (type); + +#define VALUE_HELPER_CPP(type) \ + ATTRIBUTE_CHECKER_IMPLEMENT (type); \ + ATTRIBUTE_CONVERTER_IMPLEMENT (type); \ + ATTRIBUTE_VALUE_IMPLEMENT (type); + + + #endif /* VALUE_HELPER_H */ diff --git a/src/core/value-test.cc b/src/core/value-test.cc index 681e87419..95970a51a 100644 --- a/src/core/value-test.cc +++ b/src/core/value-test.cc @@ -55,22 +55,22 @@ public: MakePtrAccessor (&AccessorObjectTest::m_derived), MakePtrChecker ()) .AddParameter ("TestInt16", "help text", - IntValue (-2), - MakeIntAccessor (&AccessorObjectTest::m_int16), - MakeIntChecker ()) + Integer (-2), + MakeIntegerAccessor (&AccessorObjectTest::m_int16), + MakeIntegerChecker ()) .AddParameter ("TestInt16WithBounds", "help text", - IntValue (-2), - MakeIntAccessor (&AccessorObjectTest::m_int16WithBounds), - MakeIntChecker (-5, 10)) + Integer (-2), + MakeIntegerAccessor (&AccessorObjectTest::m_int16WithBounds), + MakeIntegerChecker (-5, 10)) .AddParameter ("TestInt16SetGet", "help text", - IntValue (6), - MakeIntAccessor (&AccessorObjectTest::DoSetInt16, + Integer (6), + MakeIntegerAccessor (&AccessorObjectTest::DoSetInt16, &AccessorObjectTest::DoGetInt16), - MakeIntChecker ()) + MakeIntegerChecker ()) .AddParameter ("TestUint8", "help text", - UintValue (1), - MakeUintAccessor (&AccessorObjectTest::m_uint8), - MakeUintChecker ()) + Uinteger (1), + MakeUintegerAccessor (&AccessorObjectTest::m_uint8), + MakeUintegerChecker ()) .AddParameter ("TestEnum", "help text", EnumValue (TEST_A), MakeEnumAccessor (&AccessorObjectTest::m_enum), @@ -152,8 +152,7 @@ private: { \ const type expected = value; \ type got = value; \ - Attribute v = p->Get (name); \ - NS_TEST_ASSERT (v.DynCast () != 0); \ + Attribute v = p->Get (name); \ got = v; \ NS_TEST_ASSERT_EQUAL (got.Get (), expected.Get ()); \ } @@ -218,72 +217,72 @@ AccessorTest::RunTests (void) NS_TEST_ASSERT (derived != 0); CHECK_GET_STR (p, "TestInt16", "-2"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, -2); + CHECK_GET_PARAM (p, "TestInt16", Integer, -2); NS_TEST_ASSERT (p->Set ("TestInt16", "-5")); CHECK_GET_STR (p, "TestInt16", "-5"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, -5); + CHECK_GET_PARAM (p, "TestInt16", Integer, -5); - NS_TEST_ASSERT (p->Set ("TestInt16", IntValue (+2))); + NS_TEST_ASSERT (p->Set ("TestInt16", Integer (+2))); CHECK_GET_STR (p, "TestInt16", "2"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, +2); + CHECK_GET_PARAM (p, "TestInt16", Integer, +2); - NS_TEST_ASSERT (p->Set ("TestInt16", IntValue (-32768))); + NS_TEST_ASSERT (p->Set ("TestInt16", Integer (-32768))); CHECK_GET_STR (p, "TestInt16", "-32768"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, -32768); + CHECK_GET_PARAM (p, "TestInt16", Integer, -32768); - NS_TEST_ASSERT (!p->Set ("TestInt16", IntValue (-32769))); + NS_TEST_ASSERT (!p->Set ("TestInt16", Integer (-32769))); CHECK_GET_STR (p, "TestInt16", "-32768"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, -32768); + CHECK_GET_PARAM (p, "TestInt16", Integer, -32768); - NS_TEST_ASSERT (p->Set ("TestInt16", IntValue (32767))); + NS_TEST_ASSERT (p->Set ("TestInt16", Integer (32767))); CHECK_GET_STR (p, "TestInt16", "32767"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, 32767); + CHECK_GET_PARAM (p, "TestInt16", Integer, 32767); - NS_TEST_ASSERT (!p->Set ("TestInt16", IntValue (32768))); + NS_TEST_ASSERT (!p->Set ("TestInt16", Integer (32768))); CHECK_GET_STR (p, "TestInt16", "32767"); - CHECK_GET_PARAM (p, "TestInt16", IntValue, 32767); + CHECK_GET_PARAM (p, "TestInt16", Integer, 32767); - NS_TEST_ASSERT (p->Set ("TestInt16WithBounds", IntValue (10))); + NS_TEST_ASSERT (p->Set ("TestInt16WithBounds", Integer (10))); CHECK_GET_STR (p, "TestInt16WithBounds", "10"); - CHECK_GET_PARAM (p, "TestInt16WithBounds", IntValue, 10); - NS_TEST_ASSERT (!p->Set ("TestInt16WithBounds", IntValue (11))); + CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, 10); + NS_TEST_ASSERT (!p->Set ("TestInt16WithBounds", Integer (11))); CHECK_GET_STR (p, "TestInt16WithBounds", "10"); - CHECK_GET_PARAM (p, "TestInt16WithBounds", IntValue, 10); + CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, 10); - NS_TEST_ASSERT (p->Set ("TestInt16WithBounds", IntValue (-5))); + NS_TEST_ASSERT (p->Set ("TestInt16WithBounds", Integer (-5))); CHECK_GET_STR (p, "TestInt16WithBounds", "-5"); - CHECK_GET_PARAM (p, "TestInt16WithBounds", IntValue, -5); - NS_TEST_ASSERT (!p->Set ("TestInt16WithBounds", IntValue (-6))); + CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, -5); + NS_TEST_ASSERT (!p->Set ("TestInt16WithBounds", Integer (-6))); CHECK_GET_STR (p, "TestInt16WithBounds", "-5"); - CHECK_GET_PARAM (p, "TestInt16WithBounds", IntValue, -5); + CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, -5); CHECK_GET_STR (p, "TestInt16SetGet", "6"); - CHECK_GET_PARAM (p, "TestInt16SetGet", IntValue, 6); - NS_TEST_ASSERT (p->Set ("TestInt16SetGet", IntValue (0))); + CHECK_GET_PARAM (p, "TestInt16SetGet", Integer, 6); + NS_TEST_ASSERT (p->Set ("TestInt16SetGet", Integer (0))); CHECK_GET_STR (p, "TestInt16SetGet", "0"); - CHECK_GET_PARAM (p, "TestInt16SetGet", IntValue, 0); + CHECK_GET_PARAM (p, "TestInt16SetGet", Integer, 0); CHECK_GET_STR (p, "TestUint8", "1"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 1); - NS_TEST_ASSERT (p->Set ("TestUint8", UintValue (0))); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 1); + NS_TEST_ASSERT (p->Set ("TestUint8", Uinteger (0))); CHECK_GET_STR (p, "TestUint8", "0"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 0); - NS_TEST_ASSERT (p->Set ("TestUint8", UintValue (255))); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 0); + NS_TEST_ASSERT (p->Set ("TestUint8", Uinteger (255))); CHECK_GET_STR (p, "TestUint8", "255"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 255); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255); NS_TEST_ASSERT (p->Set ("TestUint8", "255")); CHECK_GET_STR (p, "TestUint8", "255"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 255); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255); NS_TEST_ASSERT (!p->Set ("TestUint8", "256")); CHECK_GET_STR (p, "TestUint8", "255"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 255); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255); NS_TEST_ASSERT (!p->Set ("TestUint8", "-1")); CHECK_GET_STR (p, "TestUint8", "255"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 255); - NS_TEST_ASSERT (!p->Set ("TestUint8", UintValue (-1))); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255); + NS_TEST_ASSERT (!p->Set ("TestUint8", Uinteger (-1))); CHECK_GET_STR (p, "TestUint8", "255"); - CHECK_GET_PARAM (p, "TestUint8", UintValue, 255); + CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255); CHECK_GET_STR (p, "TestFloat", "-1.1"); NS_TEST_ASSERT (p->Set ("TestFloat", FpValue ((float)+2.3))); diff --git a/src/mobility/position-allocator.cc b/src/mobility/position-allocator.cc index 30553dcb5..c8fbd44d6 100644 --- a/src/mobility/position-allocator.cc +++ b/src/mobility/position-allocator.cc @@ -54,9 +54,9 @@ GridPositionAllocator::GetTypeId (void) .SetGroupName ("Mobility") .AddConstructor () .AddParameter ("GridWidth", "The number of objects layed out on a line.", - IntValue (10), - MakeIntAccessor (&GridPositionAllocator::m_n), - MakeIntChecker ()) + Integer (10), + MakeIntegerAccessor (&GridPositionAllocator::m_n), + MakeIntegerChecker ()) .AddParameter ("MinX", "The x coordinate where the grid starts.", FpValue (1.0), MakeFpAccessor (&GridPositionAllocator::m_xMin), diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 913f9dacc..d9632c03b 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -33,9 +33,9 @@ TypeId DropTailQueue::GetTypeId (void) .SetParent () .AddConstructor () .AddParameter ("MaxPackets", "The maximum number of packets accepted by this DropTailQueue.", - UintValue (100), - MakeUintAccessor (&DropTailQueue::m_maxPackets), - MakeUintChecker ()) + Uinteger (100), + MakeUintegerAccessor (&DropTailQueue::m_maxPackets), + MakeUintegerChecker ()) ; return tid; @@ -133,7 +133,7 @@ DropTailQueueTest::RunTests (void) bool result = true; Ptr queue = CreateObject (); - NS_TEST_ASSERT (queue->Set ("MaxPackets", UintValue (3))); + NS_TEST_ASSERT (queue->Set ("MaxPackets", Uinteger (3))); Ptr p1, p2, p3, p4; p1 = Create ();