--- a/src/applications/onoff/onoff-application.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/applications/onoff/onoff-application.cc Sun Feb 17 04:38:52 2008 +0100
@@ -45,7 +45,7 @@
// Defaults for rate/size
static DataRateDefaultValue g_defaultRate ("OnOffApplicationDataRate",
"The data rate in on state for OnOffApplication",
- DataRate ("500kb/s"));
+ MakeDataRate ("500kb/s"));
static NumericDefaultValue<uint32_t> g_defaultSize ("OnOffApplicationPacketSize",
"The size of packets sent in on state for OnOffApplication",
512, 1);
--- a/src/common/data-rate.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/common/data-rate.cc Sun Feb 17 04:38:52 2008 +0100
@@ -125,6 +125,8 @@
namespace ns3 {
+VALUE_HELPER_CPP (DataRate);
+
DataRate::DataRate ()
: m_bps (0)
{}
@@ -173,15 +175,6 @@
return m_bps;
}
-DataRate::DataRate (PValue value)
-{
- *this = ClassValueHelperExtractFrom<DataRate,DataRateValue> (value);
-}
-DataRate::operator PValue () const
-{
- return ClassValueHelperConvertTo<DataRate,DataRateValue> (this);
-}
-
DataRate MakeDataRate (std::string rate)
{
uint64_t bps;
--- a/src/common/data-rate.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/common/data-rate.h Sun Feb 17 04:38:52 2008 +0100
@@ -28,7 +28,7 @@
#include "ns3/nstime.h"
#include "ns3/default-value.h"
#include "ns3/value.h"
-#include "ns3/class-value-helper.h"
+#include "ns3/value-helper.h"
namespace ns3 {
@@ -80,9 +80,8 @@
* \return The underlying bitrate in bits per second
*/
uint64_t GetBitRate() const;
-
- DataRate (PValue value);
- operator PValue () const;
+
+ VALUE_HELPER_HEADER_1 (DataRate);
private:
uint64_t m_bps;
static uint64_t Parse(const std::string);
@@ -93,16 +92,7 @@
std::ostream &operator << (std::ostream &os, const DataRate &rate);
std::istream &operator >> (std::istream &is, DataRate &rate);
-class DataRateValue : public Value {};
-class DataRateParamSpec : public ParamSpec {};
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeDataRateParamSpec (T1 a1, DataRate initialValue);
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeDataRateParamSpec (T1 a1, T2 a2, DataRate initialValue);
+VALUE_HELPER_HEADER_2 (DataRate);
/**
* \param lhs
@@ -130,24 +120,4 @@
} //namespace ns3
-namespace ns3 {
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeDataRateParamSpec (T1 a1, DataRate initialValue)
-{
- return MakeClassValueHelperParamSpec<DataRate,DataRateValue,DataRateParamSpec>
- (a1, initialValue);
-}
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeDataRateParamSpec (T1 a1, T2 a2, DataRate initialValue)
-{
- return MakeClassValueHelperParamSpec<DataRate,DataRateValue,DataRateParamSpec>
- (a1, a2, initialValue);
-}
-
-} // namespace ns3
-
#endif /* DATA_RATE_H */
--- a/src/core/boolean-value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/boolean-value.h Sun Feb 17 04:38:52 2008 +0100
@@ -28,10 +28,10 @@
template <typename T1>
-Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, bool initialValue);
+Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1);
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, T2 a2, bool initialValue);
+Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, T2 a2);
} // namespace ns3
@@ -40,15 +40,15 @@
namespace ns3 {
template <typename T1>
-Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, bool initialValue)
+Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1)
{
- return MakeParamSpecHelper<BooleanParamSpec> (a1, BooleanValue (initialValue));
+ return MakeParamSpecHelper<BooleanParamSpec,BooleanValue> (a1);
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, T2 a2, bool initialValue)
+Ptr<ParamSpec> MakeBooleanParamSpec (T1 a1, T2 a2)
{
- return MakeParamSpecHelper<BooleanParamSpec> (a1, a2, BooleanValue (initialValue));
+ return MakeParamSpecHelper<BooleanParamSpec,BooleanValue> (a1, a2);
}
--- a/src/core/class-value-helper.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/class-value-helper.h Sun Feb 17 04:38:52 2008 +0100
@@ -78,17 +78,17 @@
template <typename T, typename U, typename BASE, typename T1>
Ptr<ParamSpec>
-MakeClassValueHelperParamSpec (T1 a1, const T &initialValue)
+MakeClassValueHelperParamSpec (T1 a1)
{
- return MakeParamSpecHelper<BASE> (a1, ClassValue<T,U> (initialValue));
+ return MakeParamSpecHelper<BASE,ClassValue<T,U> > (a1);
}
template <typename T, typename U, typename BASE, typename T1, typename T2>
Ptr<ParamSpec>
-MakeClassValueHelperParamSpec (T1 a1, T2 a2, const T &initialValue)
+MakeClassValueHelperParamSpec (T1 a1, T2 a2)
{
- return MakeParamSpecHelper<BASE> (a1, a2, ClassValue<T,U> (initialValue));
+ return MakeParamSpecHelper<BASE,ClassValue<T,U> > (a1, a2);
}
} // namespace ns3
--- a/src/core/enum-value.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/enum-value.cc Sun Feb 17 04:38:52 2008 +0100
@@ -127,19 +127,4 @@
return false;
}
-PValue
-EnumParamSpec::GetInitialValue (void) const
-{
- NS_ASSERT (!m_valueSet.empty ());
- return PValue::Create<EnumValue> (m_valueSet.front ().first);
-}
-
-PValue
-EnumParamSpec::CreateValue (void) const
-{
- return PValue::Create<EnumValue> (m_valueSet.front ().first);
-}
-
-
-
} // namespace ns3
--- a/src/core/enum-value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/enum-value.h Sun Feb 17 04:38:52 2008 +0100
@@ -36,8 +36,6 @@
virtual bool Get (const ObjectBase* object, PValue value) const;
virtual bool Check (PValue value) const;
- virtual PValue GetInitialValue (void) const;
- virtual PValue CreateValue (void) const;
private:
virtual bool DoSet (ObjectBase *object, const EnumValue *value) const = 0;
virtual bool DoGet (const ObjectBase *object, EnumValue *value) const = 0;
--- a/src/core/fp-value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/fp-value.h Sun Feb 17 04:38:52 2008 +0100
@@ -28,11 +28,9 @@
class FpParamSpec : public ParamSpec {};
template <typename T1>
-Ptr<ParamSpec> MakeFpParamSpec (T1 a1,
- double initialValue);
+Ptr<ParamSpec> MakeFpParamSpec (T1 a1);
template <typename T1, typename T2>
Ptr<ParamSpec> MakeFpParamSpec (T1 a1, T2 a2,
- double initialValue,
double minValue,
double maxValue);
@@ -68,36 +66,32 @@
template <typename T1>
Ptr<ParamSpec>
-MakeFpParamSpec (T1 a1,
- double initialValue)
+MakeFpParamSpec (T1 a1)
{
- return MakeParamSpecHelperWithChecker<FpParamSpec> (a1, FpValue (initialValue),
+ return MakeParamSpecHelperWithChecker<FpParamSpec,FpValue> (a1,
FpValueChecker::Create (a1));
}
template <typename T1>
Ptr<ParamSpec> MakeFpParamSpec (T1 a1,
- double initialValue,
double minValue,
double maxValue)
{
- return MakeParamSpecHelperWithChecker<FpParamSpec> (a1, FpValue (initialValue),
+ return MakeParamSpecHelperWithChecker<FpParamSpec,FpValue> (a1,
FpValueChecker (minValue, maxValue));
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeFpParamSpec (T1 a1, T2 a2,
- double initialValue)
+Ptr<ParamSpec> MakeFpParamSpec (T1 a1, T2 a2)
{
- return MakeParamSpecHelperWithChecker<FpParamSpec> (a1, a2, FpValue (initialValue),
+ return MakeParamSpecHelperWithChecker<FpParamSpec,FpValue> (a1, a2,
FpValueChecker::Create (a1));
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeFpParamSpec (T1 a1, T2 a2,
- double initialValue,
double minValue,
double maxValue)
{
- return MakeParamSpecHelperWithChecker<FpParamSpec> (a1, a2, FpValue (initialValue),
+ return MakeParamSpecHelperWithChecker<FpParamSpec,FpValue> (a1, a2,
FpValueChecker (minValue, maxValue));
}
--- a/src/core/int-value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/int-value.h Sun Feb 17 04:38:52 2008 +0100
@@ -27,19 +27,15 @@
class IntParamSpec : public ParamSpec {};
template <typename T1>
-Ptr<ParamSpec> MakeIntParamSpec (T1 a1,
- int64_t initialValue);
+Ptr<ParamSpec> MakeIntParamSpec (T1 a1);
template <typename T1>
Ptr<ParamSpec> MakeIntParamSpec (T1 a1,
- int64_t initialValue,
int64_t minValue,
int64_t maxValue);
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2,
- int64_t initialValue);
+Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2);
template <typename T1, typename T2>
Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2,
- int64_t initialValue,
int64_t minValue,
int64_t maxValue);
@@ -75,36 +71,32 @@
template <typename T1>
Ptr<ParamSpec>
-MakeIntParamSpec (T1 a1,
- int64_t initialValue)
+MakeIntParamSpec (T1 a1)
{
- return MakeParamSpecHelperWithChecker<IntParamSpec> (a1, IntValue (initialValue),
+ return MakeParamSpecHelperWithChecker<IntParamSpec,IntValue> (a1,
IntValueChecker::Create (a1));
}
template <typename T1>
Ptr<ParamSpec> MakeIntParamSpec (T1 a1,
- int64_t initialValue,
int64_t minValue,
int64_t maxValue)
{
- return MakeParamSpecHelperWithChecker<IntParamSpec> (a1, IntValue (initialValue),
+ return MakeParamSpecHelperWithChecker<IntParamSpec,IntValue> (a1,
IntValueChecker (minValue, maxValue));
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2,
- int64_t initialValue)
+Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2)
{
- return MakeParamSpecHelperWithChecker<IntParamSpec> (a1, a2, IntValue (initialValue),
+ return MakeParamSpecHelperWithChecker<IntParamSpec,IntValue> (a1, a2,
IntValueChecker::Create (a1));
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeIntParamSpec (T1 a1, T2 a2,
- int64_t initialValue,
int64_t minValue,
int64_t maxValue)
{
- return MakeParamSpecHelperWithChecker<IntParamSpec> (a1, a2, IntValue (initialValue),
+ return MakeParamSpecHelperWithChecker<IntParamSpec,IntValue> (a1, a2,
IntValueChecker (minValue, maxValue));
}
--- a/src/core/object-vector.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/object-vector.cc Sun Feb 17 04:38:52 2008 +0100
@@ -36,6 +36,11 @@
*this = v->Get ();
}
+ObjectVector::operator PValue () const
+{
+ return PValue::Create<ObjectVectorValue> ();
+}
+
ObjectVectorValue::ObjectVectorValue ()
: m_vector ()
{}
@@ -102,16 +107,5 @@
const ObjectVectorValue *v = value.DynCast<const ObjectVectorValue *> ();
return v != 0;
}
-PValue
-ObjectVectorParamSpec::GetInitialValue (void) const
-{
- return PValue::Create<ObjectVectorValue> ();
-}
-PValue
-ObjectVectorParamSpec::CreateValue (void) const
-{
- return PValue::Create<ObjectVectorValue> ();
-}
-
} // name
--- a/src/core/object-vector.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/object-vector.h Sun Feb 17 04:38:52 2008 +0100
@@ -21,6 +21,7 @@
Ptr<Object> Get (uint32_t i) const;
ObjectVector (PValue value);
+ operator PValue () const;
private:
friend class ObjectVectorParamSpec;
std::vector<Ptr<Object> > m_objects;
@@ -68,8 +69,6 @@
virtual bool Set (ObjectBase * object, PValue value) const;
virtual bool Get (const ObjectBase * object, PValue value) const;
virtual bool Check (PValue value) const;
- virtual PValue GetInitialValue (void) const;
- virtual PValue CreateValue (void) const;
private:
virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const = 0;
virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i) const = 0;
--- a/src/core/object.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/object.cc Sun Feb 17 04:38:52 2008 +0100
@@ -57,11 +57,12 @@
std::string name,
std::string help,
uint32_t flags,
+ ns3::PValue initialValue,
ns3::Ptr<const ns3::ParamSpec> spec);
uint32_t GetParametersN (uint16_t uid) const;
std::string GetParameterName (uint16_t uid, uint32_t i) const;
uint32_t GetParameterFlags (uint16_t uid, uint32_t i) const;
- uint32_t GetParameterUid (uint16_t uid, uint32_t i) const;
+ ns3::PValue GetParameterInitialValue (uint16_t uid, uint32_t i) const;
ns3::Ptr<const ns3::ParamSpec> GetParameterParamSpec (uint16_t uid, uint32_t i) const;
private:
struct ConstructorInformation {
@@ -72,7 +73,7 @@
std::string name;
std::string help;
uint32_t flags;
- uint32_t uid;
+ ns3::PValue initialValue;
ns3::Ptr<const ns3::ParamSpec> param;
};
struct IidInformation {
@@ -242,6 +243,7 @@
std::string name,
std::string help,
uint32_t flags,
+ ns3::PValue initialValue,
ns3::Ptr<const ns3::ParamSpec> spec)
{
struct IidInformation *information = LookupInformation (uid);
@@ -258,6 +260,7 @@
param.name = name;
param.help = help;
param.flags = flags;
+ param.initialValue = initialValue;
param.param = spec;
information->parameters.push_back (param);
}
@@ -283,6 +286,13 @@
NS_ASSERT (i < information->parameters.size ());
return information->parameters[i].flags;
}
+ns3::PValue
+IidManager::GetParameterInitialValue (uint16_t uid, uint32_t i) const
+{
+ struct IidInformation *information = LookupInformation (uid);
+ NS_ASSERT (i < information->parameters.size ());
+ return information->parameters[i].initialValue;
+}
ns3::Ptr<const ns3::ParamSpec>
IidManager::GetParameterParamSpec (uint16_t uid, uint32_t i) const
{
@@ -291,7 +301,6 @@
return information->parameters[i].param;
}
-
} // anonymous namespace
/*********************************************************************
@@ -427,6 +436,7 @@
{
info->spec = GetParameterParamSpec (i);
info->flags = GetParameterFlags (i);
+ info->initialValue = tid.GetParameterInitialValue (i);
return true;
}
}
@@ -448,6 +458,7 @@
{
info->spec = tid.GetParameterParamSpec (j);
info->flags = tid.GetParameterFlags (j);
+ info->initialValue = tid.GetParameterInitialValue (j);
return true;
}
cur++;
@@ -518,9 +529,10 @@
TypeId
TypeId::AddParameter (std::string name,
std::string help,
+ PValue initialValue,
Ptr<const ParamSpec> param)
{
- Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, PARAM_SGC, param);
+ Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, PARAM_SGC, initialValue, param);
return *this;
}
@@ -528,9 +540,10 @@
TypeId::AddParameter (std::string name,
std::string help,
uint32_t flags,
+ PValue initialValue,
Ptr<const ParamSpec> param)
{
- Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, flags, param);
+ Singleton<IidManager>::Get ()->AddParameter (m_tid, name, help, flags, initialValue, param);
return *this;
}
@@ -574,6 +587,12 @@
{
return GetName () + "::" + GetParameterName (i);
}
+PValue
+TypeId::GetParameterInitialValue (uint32_t i) const
+{
+ PValue value = Singleton<IidManager>::Get ()->GetParameterInitialValue (m_tid, i);
+ return value;
+}
Ptr<const ParamSpec>
TypeId::GetParameterParamSpec (uint32_t i) const
{
@@ -640,7 +659,7 @@
{
struct TypeId::ParameterInfo info;
TypeId::LookupParameterByFullName (name, &info);
- bool ok = DoSet (info.spec, value);
+ bool ok = DoSet (&info, value);
return ok;
}
void
@@ -648,14 +667,14 @@
{
struct TypeId::ParameterInfo info;
tid.LookupParameterByName (name, &info);
- DoSet (info.spec, value);
+ DoSet (&info, value);
}
void
Parameters::SetWithTid (TypeId tid, uint32_t position, PValue value)
{
struct TypeId::ParameterInfo info;
tid.LookupParameterByPosition (position, &info);
- DoSet (info.spec, value);
+ DoSet (&info, value);
}
void
@@ -678,23 +697,36 @@
m_parameters.push_back (p);
}
bool
-Parameters::DoSet (Ptr<const ParamSpec> spec, PValue value)
+Parameters::DoSet (struct TypeId::ParameterInfo *info, PValue value)
{
- if (spec == 0)
+ if (info->spec == 0)
{
return false;
}
- bool ok = spec->Check (value);
+ bool ok = info->spec->Check (value);
if (!ok)
{
- PValue v = spec->CreateValue ();
- ok = v.ConvertFrom (value, spec);
+ // attempt to convert to string.
+ const StringValue *str = value.DynCast<const StringValue *> ();
+ if (str == 0)
+ {
+ return false;
+ }
+ // attempt to convert back to value.
+ PValue v = info->initialValue.Copy ();
+ ok = v.DeserializeFromString (str->Get (), info->spec);
if (!ok)
{
return false;
}
+ ok = info->spec->Check (v);
+ if (!ok)
+ {
+ return false;
+ }
+ value = v;
}
- DoSetOne (spec, value);
+ DoSetOne (info->spec, value);
return true;
}
void
@@ -779,7 +811,7 @@
value = str.substr (equal+1, next - (equal+1));
cur++;
}
- PValue val = info.spec->CreateValue ();
+ PValue val = info.initialValue.Copy ();
bool ok = val.DeserializeFromString (value, info.spec);
if (!ok)
{
@@ -842,6 +874,7 @@
for (uint32_t i = 0; i < tid.GetParametersN (); i++)
{
Ptr<const ParamSpec> paramSpec = tid.GetParameterParamSpec (i);
+ PValue initial = tid.GetParameterInitialValue (i);
NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<<
tid.GetParameterName (i)<<"\"");
if (!(tid.GetParameterFlags (i) & TypeId::PARAM_CONSTRUCT))
@@ -856,7 +889,7 @@
if (j->spec == paramSpec)
{
// We have a matching parameter value.
- DoSet (paramSpec, j->value);
+ DoSet (paramSpec, initial, j->value);
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
tid.GetParameterName (i)<<"\"");
found = true;
@@ -872,7 +905,7 @@
if (j->spec == paramSpec)
{
// We have a matching parameter value.
- DoSet (paramSpec, j->value);
+ DoSet (paramSpec, initial, j->value);
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
tid.GetParameterName (i)<<"\" from global");
found = true;
@@ -883,7 +916,6 @@
if (!found)
{
// No matching parameter value so we set the default value.
- PValue initial = paramSpec->GetInitialValue ();
paramSpec->Set (this, initial);
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
tid.GetParameterName (i)<<"\" from local");
@@ -894,23 +926,30 @@
NotifyConstructionCompleted ();
}
bool
-Object::DoSet (Ptr<const ParamSpec> spec, PValue value)
+Object::DoSet (Ptr<const ParamSpec> spec, PValue initialValue, PValue value)
{
bool ok = spec->Check (value);
if (!ok)
{
- PValue v = spec->CreateValue ();
- ok = v.ConvertFrom (value, spec);
+ // attempt to convert to string
+ const StringValue *str = value.DynCast<const StringValue *> ();
+ if (str == 0)
+ {
+ return false;
+ }
+ // attempt to convert back from string.
+ PValue v = initialValue.Copy ();
+ ok = v.DeserializeFromString (str->Get (), spec);
+ if (!ok)
+ {
+ return false;
+ }
+ ok = spec->Check (v);
if (!ok)
{
return false;
}
value = v;
- ok = spec->Check (value);
- if (!ok)
- {
- return false;
- }
}
ok = spec->Set (this, value);
return ok;
@@ -927,7 +966,7 @@
{
return false;
}
- return DoSet (info.spec, value);
+ return DoSet (info.spec, info.initialValue, value);
}
bool
Object::Get (std::string name, std::string &value) const
@@ -941,7 +980,7 @@
{
return false;
}
- PValue v = info.spec->CreateValue ();
+ PValue v = info.initialValue.Copy ();
bool ok = info.spec->Get (this, v);
if (ok)
{
@@ -962,7 +1001,7 @@
{
return PValue ();
}
- PValue value = info.spec->CreateValue ();
+ PValue value = info.initialValue.Copy ();
bool ok = info.spec->Get (this, value);
if (!ok)
{
--- a/src/core/object.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/object.h Sun Feb 17 04:38:52 2008 +0100
@@ -141,6 +141,8 @@
*/
std::string GetParameterFullName (uint32_t i) const;
+ PValue GetParameterInitialValue (uint32_t i) const;
+
Ptr<Object> CreateObject (const Parameters ¶meters) const;
@@ -209,7 +211,9 @@
* Record in this TypeId the fact that a new parameter exists.
*/
TypeId AddParameter (std::string name,
- std::string help, Ptr<const ParamSpec> spec);
+ std::string help,
+ PValue initialValue,
+ Ptr<const ParamSpec> spec);
/**
* \param name the name of the new parameter
@@ -224,6 +228,7 @@
TypeId AddParameter (std::string name,
std::string help,
uint32_t flags,
+ PValue initialValue,
Ptr<const ParamSpec> spec);
// construct an invalid TypeId.
@@ -237,6 +242,7 @@
struct ParameterInfo {
Ptr<const ParamSpec> spec;
+ PValue initialValue;
uint32_t flags;
};
@@ -323,7 +329,7 @@
- bool DoSet (Ptr<const ParamSpec> spec, PValue param);
+ bool DoSet (struct TypeId::ParameterInfo *info, PValue param);
void DoSetOne (Ptr<const ParamSpec> spec, PValue param);
std::string LookupParameterFullNameByParamSpec (Ptr<const ParamSpec> spec) const;
@@ -463,7 +469,7 @@
friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
- bool DoSet (Ptr<const ParamSpec> spec, PValue value);
+ bool DoSet (Ptr<const ParamSpec> spec, PValue intialValue, PValue value);
Ptr<Object> DoGetObject (TypeId tid) const;
void DoCollectSources (std::string path, const TraceContext &context,
TraceResolver::SourceCollection *collection) const;
--- a/src/core/param-spec-helper.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/param-spec-helper.h Sun Feb 17 04:38:52 2008 +0100
@@ -3,21 +3,21 @@
namespace ns3 {
-template <typename BASE, typename T1, typename V>
+template <typename BASE, typename V, typename T1>
Ptr<ParamSpec>
-MakeParamSpecHelper (T1 a1, V initialValue);
+MakeParamSpecHelper (T1 a1);
-template <typename BASE, typename T1, typename T2, typename V>
+template <typename BASE, typename V, typename T1, typename T2>
Ptr<ParamSpec>
-MakeParamSpecHelper (T1 a1, T2 a2, V initialValue);
+MakeParamSpecHelper (T1 a1, T2 a2);
-template <typename BASE, typename T1, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T1, typename CHECKER>
Ptr<ParamSpec>
-MakeParamSpecHelperWithChecker (T1 a1, V initialValue, CHECKER checker);
+MakeParamSpecHelperWithChecker (T1 a1, CHECKER checker);
-template <typename BASE, typename T1, typename T2, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T1, typename T2, typename CHECKER>
Ptr<ParamSpec>
-MakeParamSpecHelperWithChecker (T1 a1, T2 a2, V initialValue, CHECKER checker);
+MakeParamSpecHelperWithChecker (T1 a1, T2 a2, CHECKER checker);
} // namespace ns3
@@ -33,9 +33,8 @@
class ParamSpecHelper : public BASE
{
public:
- ParamSpecHelper (PValue initialValue, CHECKER checker)
- : m_initialValue (initialValue),
- m_checker (checker) {}
+ ParamSpecHelper (CHECKER checker)
+ : m_checker (checker) {}
virtual bool Set (ObjectBase * object, PValue val) const {
const U *value = val.DynCast<const U*> ();
@@ -74,19 +73,10 @@
return m_checker.Check (val->Get ());
}
- virtual PValue GetInitialValue (void) const {
- return m_initialValue;
- }
-
- virtual PValue CreateValue (void) const {
- return m_initialValue.Copy ();
- }
-
private:
virtual bool DoSet (T *object, const U *v) const = 0;
virtual bool DoGet (const T *object, U *v) const = 0;
- PValue m_initialValue;
CHECKER m_checker;
};
@@ -97,15 +87,15 @@
bool Check (const T &value) const {return true;}
};
-template <typename BASE, typename T, typename U, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T, typename U, typename CHECKER>
Ptr<ParamSpec>
-DoMakeParamSpecHelperOne (U T::*memberVariable, V initialValue, CHECKER checker)
+DoMakeParamSpecHelperOne (U T::*memberVariable, CHECKER checker)
{
class MemberVariable : public ParamSpecHelper<BASE,T,V,CHECKER>
{
public:
- MemberVariable (U T::*memberVariable, V initialValue, CHECKER checker)
- : ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
+ MemberVariable (U T::*memberVariable, CHECKER checker)
+ : ParamSpecHelper<BASE,T,V,CHECKER> (checker),
m_memberVariable (memberVariable)
{}
private:
@@ -120,27 +110,27 @@
U T::*m_memberVariable;
};
- return Ptr<ParamSpec> (new MemberVariable (memberVariable, initialValue, checker), false);
+ return Ptr<ParamSpec> (new MemberVariable (memberVariable, checker), false);
}
-template <typename BASE, typename T, typename U, typename V>
+template <typename BASE, typename V, typename T, typename U>
Ptr<ParamSpec>
-DoMakeParamSpecHelperOne (U T::*memberVariable, V initialValue)
+DoMakeParamSpecHelperOne (U T::*memberVariable)
{
- return DoMakeParamSpecHelperOne<BASE> (memberVariable, initialValue, ParamSpecHelperSimpleChecker<U> ());
+ return DoMakeParamSpecHelperOne<BASE,V> (memberVariable, ParamSpecHelperSimpleChecker<U> ());
}
-template <typename BASE, typename T, typename U, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T, typename U, typename CHECKER>
Ptr<ParamSpec>
DoMakeParamSpecHelperOne (U (T::*getter) (void) const,
- V initialValue, CHECKER checker)
+ CHECKER checker)
{
class MemberMethod : public ParamSpecHelper<BASE,T,V,CHECKER>
{
public:
MemberMethod (U (T::*getter) (void) const,
- V initialValue, CHECKER checker)
- : ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
+ CHECKER checker)
+ : ParamSpecHelper<BASE,T,V,CHECKER> (checker),
m_getter (getter)
{}
private:
@@ -153,30 +143,29 @@
}
U (T::*m_getter) (void) const;
};
- return Ptr<ParamSpec> (new MemberMethod (getter, initialValue, checker), false);
+ return Ptr<ParamSpec> (new MemberMethod (getter, checker), false);
}
-template <typename BASE, typename T, typename U, typename V>
+template <typename BASE, typename V, typename T, typename U>
Ptr<ParamSpec>
-DoMakeParamSpecHelperOne (U (T::*getter) (void) const,
- V initialValue)
+DoMakeParamSpecHelperOne (U (T::*getter) (void) const)
{
- return DoMakeParamSpecHelperOne<BASE> (getter, initialValue, ParamSpecHelperSimpleChecker<U> ());
+ return DoMakeParamSpecHelperOne<BASE,V> (getter, ParamSpecHelperSimpleChecker<U> ());
}
-template <typename BASE, typename T, typename U, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T, typename U, typename CHECKER>
Ptr<ParamSpec>
DoMakeParamSpecHelperOne (void (T::*setter) (U),
- V initialValue, CHECKER checker)
+ CHECKER checker)
{
class MemberMethod : public ParamSpecHelper<BASE,T,V,CHECKER>
{
public:
MemberMethod (void (T::*setter) (U),
- V initialValue, CHECKER checker)
- : ParamSpecHelper<BASE,T,V,CHECKER> (initialValue, checker),
+ CHECKER checker)
+ : ParamSpecHelper<BASE,T,V,CHECKER> (checker),
m_setter (setter)
{}
private:
@@ -189,24 +178,22 @@
}
void (T::*m_setter) (U);
};
- return Ptr<ParamSpec> (new MemberMethod (setter, initialValue, checker), false);
+ return Ptr<ParamSpec> (new MemberMethod (setter, checker), false);
}
-template <typename BASE, typename T, typename U, typename V>
+template <typename BASE, typename V, typename T, typename U>
Ptr<ParamSpec>
-DoMakeParamSpecHelperOne (void (T::*setter) (U),
- V initialValue)
+DoMakeParamSpecHelperOne (void (T::*setter) (U))
{
- return DoMakeParamSpecHelperOne<BASE> (setter, initialValue,
+ return DoMakeParamSpecHelperOne<BASE,V> (setter,
ParamSpecHelperSimpleChecker<typename TypeTraits<U>::ReferencedType> ());
}
-template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
+template <typename BASE, typename W, typename T, typename U, typename V, typename CHECKER>
Ptr<ParamSpec>
DoMakeParamSpecHelperTwo (void (T::*setter) (U),
V (T::*getter) (void) const,
- W initialValue,
CHECKER checker = ParamSpecHelperSimpleChecker<V> ())
{
class MemberMethod : public ParamSpecHelper<BASE,T,W,CHECKER>
@@ -214,8 +201,8 @@
public:
MemberMethod (void (T::*setter) (U),
V (T::*getter) (void) const,
- W initialValue, CHECKER checker)
- : ParamSpecHelper<BASE,T,W,CHECKER> (initialValue, checker),
+ CHECKER checker)
+ : ParamSpecHelper<BASE,T,W,CHECKER> (checker),
m_setter (setter),
m_getter (getter)
{}
@@ -231,63 +218,60 @@
void (T::*m_setter) (U);
V (T::*m_getter) (void) const;
};
- return Ptr<ParamSpec> (new MemberMethod (setter, getter, initialValue, checker), false);
-}
-
-template <typename BASE, typename T, typename U, typename V, typename W>
-Ptr<ParamSpec>
-DoMakeParamSpecHelperTwo (void (T::*setter) (U),
- V (T::*getter) (void) const,
- W initialValue)
-{
- return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue, ParamSpecHelperSimpleChecker<V> ());
+ return Ptr<ParamSpec> (new MemberMethod (setter, getter, checker), false);
}
-template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
+template <typename BASE, typename W, typename T, typename U, typename V>
Ptr<ParamSpec>
-DoMakeParamSpecHelperTwo (V (T::*getter) (void) const,
- void (T::*setter) (U),
- W initialValue,
- CHECKER checker)
+DoMakeParamSpecHelperTwo (void (T::*setter) (U),
+ V (T::*getter) (void) const)
{
- return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue, checker);
+ return DoMakeParamSpecHelperTwo<BASE,W> (setter, getter, ParamSpecHelperSimpleChecker<V> ());
}
-template <typename BASE, typename T, typename U, typename V, typename W, typename CHECKER>
+template <typename BASE, typename W, typename T, typename U, typename V, typename CHECKER>
Ptr<ParamSpec>
DoMakeParamSpecHelperTwo (V (T::*getter) (void) const,
void (T::*setter) (U),
- W initialValue)
+ CHECKER checker)
{
- return DoMakeParamSpecHelperTwo<BASE> (setter, getter, initialValue);
+ return DoMakeParamSpecHelperTwo<BASE,W> (setter, getter, checker);
}
-template <typename BASE, typename T1, typename V>
+template <typename BASE, typename W, typename T, typename U, typename V, typename CHECKER>
Ptr<ParamSpec>
-MakeParamSpecHelper (T1 a1, V initialValue)
+DoMakeParamSpecHelperTwo (V (T::*getter) (void) const,
+ void (T::*setter) (U))
{
- return DoMakeParamSpecHelperOne<BASE> (a1, initialValue);
+ return DoMakeParamSpecHelperTwo<BASE,W> (setter, getter);
+}
+
+template <typename BASE, typename V, typename T1>
+Ptr<ParamSpec>
+MakeParamSpecHelper (T1 a1)
+{
+ return DoMakeParamSpecHelperOne<BASE,V> (a1);
}
-template <typename BASE, typename T1, typename T2, typename V>
+template <typename BASE, typename V, typename T1, typename T2>
Ptr<ParamSpec>
-MakeParamSpecHelper (T1 a1, T2 a2, V initialValue)
+MakeParamSpecHelper (T1 a1, T2 a2)
{
- return DoMakeParamSpecHelperTwo<BASE> (a1, a2, initialValue);
+ return DoMakeParamSpecHelperTwo<BASE,V> (a1, a2);
}
-template <typename BASE, typename T1, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T1, typename CHECKER>
Ptr<ParamSpec>
-MakeParamSpecHelperWithChecker (T1 a1, V initialValue, CHECKER checker)
+MakeParamSpecHelperWithChecker (T1 a1, CHECKER checker)
{
- return DoMakeParamSpecHelperOne<BASE> (a1, initialValue, checker);
+ return DoMakeParamSpecHelperOne<BASE,V> (a1, checker);
}
-template <typename BASE, typename T1, typename T2, typename V, typename CHECKER>
+template <typename BASE, typename V, typename T1, typename T2, typename CHECKER>
Ptr<ParamSpec>
-MakeParamSpecHelperWithChecker (T1 a1, T2 a2, V initialValue, CHECKER checker)
+MakeParamSpecHelperWithChecker (T1 a1, T2 a2, CHECKER checker)
{
- return DoMakeParamSpecHelperTwo<BASE> (a1, a2, initialValue, checker);
+ return DoMakeParamSpecHelperTwo<BASE,V> (a1, a2, checker);
}
} // namespace ns3
--- a/src/core/random-variable.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/random-variable.h Sun Feb 17 04:38:52 2008 +0100
@@ -669,11 +669,9 @@
class RandomVariableParamSpec : public ParamSpec {};
template <typename T1>
-Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1,
- RandomVariable initialValue);
+Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1);
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1, T2 a2,
- RandomVariable initialValue);
+Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1, T2 a2);
}//namespace ns3
@@ -682,19 +680,17 @@
namespace ns3 {
template <typename T1>
-Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1,
- RandomVariable initialValue)
+Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1)
{
return MakeClassValueHelperParamSpec<RandomVariable,
- RandomVariableValue, RandomVariableParamSpec> (a1, initialValue);
+ RandomVariableValue, RandomVariableParamSpec> (a1);
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1, T2 a2,
- RandomVariable initialValue)
+Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1, T2 a2)
{
return MakeClassValueHelperParamSpec<RandomVariable,
- RandomVariableValue,RandomVariableParamSpec> (a1, a2, initialValue);
+ RandomVariableValue,RandomVariableParamSpec> (a1, a2);
}
--- a/src/core/uint-value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/uint-value.h Sun Feb 17 04:38:52 2008 +0100
@@ -27,19 +27,15 @@
class UintParamSpec : public ParamSpec {};
template <typename T1>
-Ptr<ParamSpec> MakeUintParamSpec (T1 a1,
- uint64_t initialValue);
+Ptr<ParamSpec> MakeUintParamSpec (T1 a1);
template <typename T1>
Ptr<ParamSpec> MakeUintParamSpec (T1 a1,
- uint64_t initialValue,
uint64_t minValue,
uint64_t maxValue);
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2,
- uint64_t initialValue);
+Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2);
template <typename T1, typename T2>
Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2,
- uint64_t initialValue,
uint64_t minValue,
uint64_t maxValue);
@@ -75,36 +71,32 @@
template <typename T1>
Ptr<ParamSpec>
-MakeUintParamSpec (T1 a1,
- uint64_t initialValue)
+MakeUintParamSpec (T1 a1)
{
- return MakeParamSpecHelperWithChecker<UintParamSpec> (a1, UintValue (initialValue),
+ return MakeParamSpecHelperWithChecker<UintParamSpec,UintValue> (a1,
UintValueChecker::Create (a1));
}
template <typename T1>
Ptr<ParamSpec> MakeUintParamSpec (T1 a1,
- uint64_t initialValue,
uint64_t minValue,
uint64_t maxValue)
{
- return MakeParamSpecHelperWithChecker<UintParamSpec> (a1, UintValue (initialValue),
+ return MakeParamSpecHelperWithChecker<UintParamSpec,UintValue> (a1,
UintValueChecker (minValue, maxValue));
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2,
- uint64_t initialValue)
+Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2)
{
- return MakeParamSpecHelperWithChecker<UintParamSpec> (a1, a2, UintValue (initialValue),
+ return MakeParamSpecHelperWithChecker<UintParamSpec,UintValue> (a1, a2,
UintValueChecker::Create (a1));
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeUintParamSpec (T1 a1, T2 a2,
- uint64_t initialValue,
uint64_t minValue,
uint64_t maxValue)
{
- return MakeParamSpecHelperWithChecker<UintParamSpec> (a1, a2, UintValue (initialValue),
+ return MakeParamSpecHelperWithChecker<UintParamSpec,UintValue> (a1, a2,
UintValueChecker (minValue, maxValue));
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/value-helper.h Sun Feb 17 04:38:52 2008 +0100
@@ -0,0 +1,36 @@
+#ifndef VALUE_HELPER_H
+#define VALUE_HELPER_H
+
+#include "class-value-helper.h"
+
+#define VALUE_HELPER_HEADER_1(type) \
+ type (PValue value); \
+ operator PValue () const;
+
+#define VALUE_HELPER_HEADER_2(type) \
+ class type##Value : public Value {}; \
+ class type##ParamSpec : public ParamSpec {}; \
+ template <typename T1> \
+ Ptr<ParamSpec> Make##type##ParamSpec (T1 a1) \
+ { \
+ return MakeClassValueHelperParamSpec< type , \
+ type##Value, type##ParamSpec> (a1); \
+ } \
+ template <typename T1, typename T2> \
+ Ptr<ParamSpec> Make##type##ParamSpec (T1 a1, T2 a2) \
+ { \
+ return MakeClassValueHelperParamSpec<type, \
+ type##Value,type##ParamSpec> (a1, a2); \
+ }
+
+#define VALUE_HELPER_CPP(type) \
+ type::type (PValue value) \
+ { \
+ *this = ClassValueHelperExtractFrom<type,type##Value> (value); \
+ } \
+ type::operator PValue () const \
+ { \
+ return ClassValueHelperConvertTo<type,type##Value> (this); \
+ }
+
+#endif /* VALUE_HELPER_H */
--- a/src/core/value-test.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/value-test.cc Sun Feb 17 04:38:52 2008 +0100
@@ -42,39 +42,46 @@
static TypeId tid = TypeId ("ParamSpecObjectTest")
.SetParent<Object> ()
.AddParameter ("TestBoolName", "help text",
- MakeBooleanParamSpec (&ParamSpecObjectTest::m_boolTest, false))
+ BooleanValue (false),
+ MakeBooleanParamSpec (&ParamSpecObjectTest::m_boolTest))
.AddParameter ("TestBoolA", "help text",
+ BooleanValue (false),
MakeBooleanParamSpec (&ParamSpecObjectTest::DoSetTestB,
- &ParamSpecObjectTest::DoGetTestB,
- false))
+ &ParamSpecObjectTest::DoGetTestB))
.AddParameter ("TestPtr", "help text",
+ Ptr<Derived> (0),
MakePtrParamSpec (&ParamSpecObjectTest::m_derived))
.AddParameter ("TestInt16", "help text",
- MakeIntParamSpec (&ParamSpecObjectTest::m_int16,
- -2))
+ IntValue (-2),
+ MakeIntParamSpec (&ParamSpecObjectTest::m_int16))
.AddParameter ("TestInt16WithBounds", "help text",
+ IntValue (-2),
MakeIntParamSpec (&ParamSpecObjectTest::m_int16WithBounds,
- -2, -5, 10))
+ -5, 10))
.AddParameter ("TestInt16SetGet", "help text",
+ IntValue (6),
MakeIntParamSpec (&ParamSpecObjectTest::DoSetInt16,
- &ParamSpecObjectTest::DoGetInt16,
- 6))
+ &ParamSpecObjectTest::DoGetInt16))
.AddParameter ("TestUint8", "help text",
- MakeUintParamSpec (&ParamSpecObjectTest::m_uint8,
- 1))
+ UintValue (1),
+ MakeUintParamSpec (&ParamSpecObjectTest::m_uint8))
.AddParameter ("TestEnum", "help text",
+ EnumValue (TEST_A),
MakeEnumParamSpec (&ParamSpecObjectTest::m_enum,
TEST_A, "TestA",
TEST_B, "TestB",
TEST_C, "TestC"))
.AddParameter ("TestRandom", "help text",
- MakeRandomVariableParamSpec (&ParamSpecObjectTest::m_random,
- ConstantVariable (1.0)))
+ ConstantVariable (1.0),
+ MakeRandomVariableParamSpec (&ParamSpecObjectTest::m_random))
.AddParameter ("TestFloat", "help text",
- MakeFpParamSpec (&ParamSpecObjectTest::m_float, -1.1))
+ FpValue (-1.1),
+ MakeFpParamSpec (&ParamSpecObjectTest::m_float))
.AddParameter ("TestVector1", "help text",
+ ObjectVector (),
MakeObjectVectorParamSpec (&ParamSpecObjectTest::m_vector1))
.AddParameter ("TestVector2", "help text",
+ ObjectVector (),
MakeObjectVectorParamSpec (&ParamSpecObjectTest::DoGetVectorN,
&ParamSpecObjectTest::DoGetVector))
;
--- a/src/core/value.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/value.cc Sun Feb 17 04:38:52 2008 +0100
@@ -20,11 +20,6 @@
}
Value::~Value ()
{}
-bool
-Value::ConvertFrom (PValue value, Ptr<const ParamSpec> spec)
-{
- return false;
-}
/***************************************************************
* Big interesting warning.
@@ -117,16 +112,6 @@
{
return m_value->DeserializeFromString (value, spec);
}
-bool
-PValue::ConvertFrom (PValue value, Ptr<const ParamSpec> spec)
-{
- const StringValue *str = value.DynCast<const StringValue *> ();
- if (str == 0)
- {
- return false;
- }
- return DeserializeFromString (str->Get (), spec);
-}
PValue::PValue (const char *value)
: m_value (new StringValue (value))
--- a/src/core/value.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/value.h Sun Feb 17 04:38:52 2008 +0100
@@ -22,7 +22,6 @@
virtual PValue Copy (void) const = 0;
virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const = 0;
virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec) = 0;
- virtual bool ConvertFrom (PValue value, Ptr<const ParamSpec> spec);
private:
friend class PValue;
uint32_t m_count;
@@ -39,7 +38,6 @@
PValue Copy (void) const;
std::string SerializeToString (Ptr<const ParamSpec> spec) const;
bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec);
- bool ConvertFrom (PValue value, Ptr<const ParamSpec> spec);
template <typename T>
static PValue Create (void);
@@ -78,8 +76,6 @@
virtual bool Set (ObjectBase * object, PValue value) const = 0;
virtual bool Get (const ObjectBase * object, PValue value) const = 0;
virtual bool Check (PValue value) const = 0;
- virtual PValue GetInitialValue (void) const = 0;
- virtual PValue CreateValue (void) const = 0;
private:
mutable uint32_t m_count;
};
@@ -274,12 +270,6 @@
}
return true;
}
- virtual PValue GetInitialValue (void) const {
- return CreateValue ();
- }
- virtual PValue CreateValue (void) const {
- return PValue::Create<PtrValue<U> > (Ptr<U> (0));
- }
private:
virtual void DoSet (T *object, Ptr<U> value) const = 0;
virtual Ptr<U> DoGet (const T *object) const = 0;
--- a/src/core/wscript Sun Feb 17 04:38:41 2008 +0100
+++ b/src/core/wscript Sun Feb 17 04:38:52 2008 +0100
@@ -114,5 +114,6 @@
'enum-value.h',
'object-factory.h',
'class-value-helper.h',
+ 'value-helper.h',
]
--- a/src/devices/point-to-point/point-to-point-net-device.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/devices/point-to-point/point-to-point-net-device.cc Sun Feb 17 04:38:52 2008 +0100
@@ -37,7 +37,7 @@
DataRateDefaultValue PointToPointNetDevice::g_defaultRate(
"PointToPointLinkDataRate",
"The default data rate for point to point links",
- DataRate ("10Mb/s"));
+ MakeDataRate ("10Mb/s"));
PointToPointTraceType::PointToPointTraceType (enum Type type)
: m_type (type)
--- a/src/mobility/hierarchical-mobility-model.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/hierarchical-mobility-model.cc Sun Feb 17 04:38:52 2008 +0100
@@ -31,8 +31,10 @@
.SetParent<MobilityModel> ()
.AddConstructor<HierarchicalMobilityModel> ()
.AddParameter ("child", "The child mobility model.",
+ Ptr<MobilityModel> (0),
MakePtrParamSpec (&HierarchicalMobilityModel::SetChild))
.AddParameter ("parent", "The parent mobility model.",
+ Ptr<MobilityModel> (0),
MakePtrParamSpec (&HierarchicalMobilityModel::SetParent))
;
return tid;
--- a/src/mobility/mobility-model.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/mobility-model.cc Sun Feb 17 04:38:52 2008 +0100
@@ -30,14 +30,13 @@
.SetParent<Object> ()
.AddParameter ("position", "The current position of the mobility model.",
TypeId::PARAM_SGC,
+ Vector (0.0, 0.0, 0.0),
MakeVectorParamSpec (&MobilityModel::SetPosition,
- &MobilityModel::GetPosition,
- Vector (0.0, 0.0, 0.0)))
+ &MobilityModel::GetPosition))
.AddParameter ("velocity", "The current velocity of the mobility model.",
TypeId::PARAM_GET,
- MakeVectorParamSpec (&MobilityModel::GetVelocity,
- Vector (0.0, 0.0, 0.0) // ignored initial value.
- ))
+ Vector (0.0, 0.0, 0.0), // ignored initial value.
+ MakeVectorParamSpec (&MobilityModel::GetVelocity))
;
return tid;
}
--- a/src/mobility/position-allocator.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/position-allocator.cc Sun Feb 17 04:38:52 2008 +0100
@@ -54,16 +54,22 @@
.SetGroupName ("Mobility")
.AddConstructor<GridPositionAllocator> ()
.AddParameter ("GridWidth", "The number of objects layed out on a line.",
- MakeIntParamSpec (&GridPositionAllocator::m_n, 10))
+ IntValue (10),
+ MakeIntParamSpec (&GridPositionAllocator::m_n))
.AddParameter ("MinX", "The x coordinate where the grid starts.",
- MakeFpParamSpec (&GridPositionAllocator::m_xMin, 0.0))
+ FpValue (1.0),
+ MakeFpParamSpec (&GridPositionAllocator::m_xMin))
.AddParameter ("MinY", "The y coordinate where the grid starts.",
- MakeFpParamSpec (&GridPositionAllocator::m_yMin, 0.0))
+ FpValue (0.0),
+ MakeFpParamSpec (&GridPositionAllocator::m_yMin))
.AddParameter ("DeltaX", "The x space between objects.",
- MakeFpParamSpec (&GridPositionAllocator::m_deltaX, 1.0))
+ FpValue (1.0),
+ MakeFpParamSpec (&GridPositionAllocator::m_deltaX))
.AddParameter ("DeltaY", "The y space between objects.",
- MakeFpParamSpec (&GridPositionAllocator::m_deltaY, 1.0))
+ FpValue (1.0),
+ MakeFpParamSpec (&GridPositionAllocator::m_deltaY))
.AddParameter ("LayoutType", "The type of layout.",
+ EnumValue (ROW_FIRST),
MakeEnumParamSpec (&GridPositionAllocator::m_layoutType,
ROW_FIRST, "RowFirst",
COLUMN_FIRST, "ColumnFirst"))
@@ -104,12 +110,12 @@
.AddConstructor<RandomRectanglePositionAllocator> ()
.AddParameter ("X",
"A random variable which represents the x coordinate of a position in a random rectangle.",
- MakeRandomVariableParamSpec (&RandomRectanglePositionAllocator::m_x,
- UniformVariable (0.0, 1.0)))
+ UniformVariable (0.0, 1.0),
+ MakeRandomVariableParamSpec (&RandomRectanglePositionAllocator::m_x))
.AddParameter ("Y",
"A random variable which represents the y coordinate of a position in a random rectangle.",
- MakeRandomVariableParamSpec (&RandomRectanglePositionAllocator::m_y,
- UniformVariable (0.0, 1.0)));
+ UniformVariable (0.0, 1.0),
+ MakeRandomVariableParamSpec (&RandomRectanglePositionAllocator::m_y));
return tid;
}
@@ -136,18 +142,20 @@
.AddConstructor<RandomDiscPositionAllocator> ()
.AddParameter ("Theta",
"A random variable which represents the angle (gradients) of a position in a random disc.",
- MakeRandomVariableParamSpec (&RandomDiscPositionAllocator::m_theta,
- UniformVariable (0.0, 6.2830)))
+ UniformVariable (0.0, 6.2830),
+ MakeRandomVariableParamSpec (&RandomDiscPositionAllocator::m_theta))
.AddParameter ("Rho",
"A random variable which represents the radius of a position in a random disc.",
- MakeRandomVariableParamSpec (&RandomDiscPositionAllocator::m_rho,
- UniformVariable (0.0, 200.0)))
+ UniformVariable (0.0, 200.0),
+ MakeRandomVariableParamSpec (&RandomDiscPositionAllocator::m_rho))
.AddParameter ("X",
"The x coordinate of the center of the random position disc.",
- MakeFpParamSpec (&RandomDiscPositionAllocator::m_x, 0.0))
+ FpValue (0.0),
+ MakeFpParamSpec (&RandomDiscPositionAllocator::m_x))
.AddParameter ("Y",
"The y coordinate of the center of the random position disc.",
- MakeFpParamSpec (&RandomDiscPositionAllocator::m_y, 0.0));
+ FpValue (0.0),
+ MakeFpParamSpec (&RandomDiscPositionAllocator::m_y));
return tid;
}
--- a/src/mobility/random-direction-2d-mobility-model.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/random-direction-2d-mobility-model.cc Sun Feb 17 04:38:52 2008 +0100
@@ -42,14 +42,14 @@
.SetGroupName ("Mobility")
.AddConstructor<RandomDirection2dMobilityModel> ()
.AddParameter ("bounds", "The 2d bounding area",
- MakeRectangleParamSpec (&RandomDirection2dMobilityModel::m_bounds,
- Rectangle (-100, 100, -100, 100)))
+ Rectangle (-100, 100, -100, 100),
+ MakeRectangleParamSpec (&RandomDirection2dMobilityModel::m_bounds))
.AddParameter ("speed", "A random variable to control the speed (m/s).",
- MakeRandomVariableParamSpec (&RandomDirection2dMobilityModel::m_speed,
- UniformVariable (1.0, 2.0)))
+ UniformVariable (1.0, 2.0),
+ MakeRandomVariableParamSpec (&RandomDirection2dMobilityModel::m_speed))
.AddParameter ("pause", "A random variable to control the pause (s).",
- MakeRandomVariableParamSpec (&RandomDirection2dMobilityModel::m_pause,
- ConstantVariable (2.0)));
+ ConstantVariable (2.0),
+ MakeRandomVariableParamSpec (&RandomDirection2dMobilityModel::m_pause));
return tid;
}
--- a/src/mobility/random-walk-2d-mobility-model.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/random-walk-2d-mobility-model.cc Sun Feb 17 04:38:52 2008 +0100
@@ -39,30 +39,31 @@
.AddConstructor<RandomWalk2dMobilityModel> ()
.AddParameter ("bounds",
"Bounds of the area to cruise.",
- MakeRectangleParamSpec (&RandomWalk2dMobilityModel::m_bounds,
- Rectangle (0.0, 0.0, 100.0, 100.0)))
+ Rectangle (0.0, 0.0, 100.0, 100.0),
+ MakeRectangleParamSpec (&RandomWalk2dMobilityModel::m_bounds))
.AddParameter ("time",
"Change current direction and speed after moving for this delay.",
- MakeTimeParamSpec (&RandomWalk2dMobilityModel::m_modeTime,
- Seconds (1.0)))
+ Seconds (1.0),
+ MakeTimeParamSpec (&RandomWalk2dMobilityModel::m_modeTime))
.AddParameter ("distance",
"Change current direction and speed after moving for this distance.",
- MakeTimeParamSpec (&RandomWalk2dMobilityModel::m_modeTime,
- Seconds (1.0)))
+ Seconds (1.0),
+ MakeTimeParamSpec (&RandomWalk2dMobilityModel::m_modeTime))
.AddParameter ("mode",
"The mode indicates the condition used to "
"change the current speed and direction",
+ EnumValue (RandomWalk2dMobilityModel::MODE_DISTANCE),
MakeEnumParamSpec (&RandomWalk2dMobilityModel::m_mode,
RandomWalk2dMobilityModel::MODE_DISTANCE, "Distance",
RandomWalk2dMobilityModel::MODE_TIME, "Time"))
.AddParameter ("direction",
"A random variable used to pick the direction (gradients).",
- MakeRandomVariableParamSpec (&RandomWalk2dMobilityModel::m_direction,
- UniformVariable (0.0, 6.283184)))
+ UniformVariable (0.0, 6.283184),
+ MakeRandomVariableParamSpec (&RandomWalk2dMobilityModel::m_direction))
.AddParameter ("speed",
"A random variable used to pick the speed (m/s).",
- MakeRandomVariableParamSpec (&RandomWalk2dMobilityModel::m_speed,
- UniformVariable (2.0, 4.0)));
+ UniformVariable (2.0, 4.0),
+ MakeRandomVariableParamSpec (&RandomWalk2dMobilityModel::m_speed));
return tid;
}
--- a/src/mobility/random-waypoint-mobility-model.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/random-waypoint-mobility-model.cc Sun Feb 17 04:38:52 2008 +0100
@@ -38,14 +38,15 @@
.AddConstructor<RandomWaypointMobilityModel> ()
.AddParameter ("speed",
"A random variable used to pick the speed of a random waypoint model.",
- MakeRandomVariableParamSpec (&RandomWaypointMobilityModel::m_speed,
- UniformVariable (0.3, 0.7)))
+ UniformVariable (0.3, 0.7),
+ MakeRandomVariableParamSpec (&RandomWaypointMobilityModel::m_speed))
.AddParameter ("pause",
"A random variable used to pick the pause of a random waypoint model.",
- MakeRandomVariableParamSpec (&RandomWaypointMobilityModel::m_pause,
- ConstantVariable (2.0)))
+ ConstantVariable (2.0),
+ MakeRandomVariableParamSpec (&RandomWaypointMobilityModel::m_pause))
.AddParameter ("position",
"The position model used to pick a destination point.",
+ Ptr<PositionAllocator> (0),
MakePtrParamSpec (&RandomWaypointMobilityModel::m_position));
return tid;
--- a/src/mobility/rectangle.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/rectangle.cc Sun Feb 17 04:38:52 2008 +0100
@@ -119,14 +119,7 @@
}
-Rectangle::Rectangle (PValue value)
-{
- *this = ClassValueHelperExtractFrom<Rectangle,RectangleValue> (value);
-}
-Rectangle::operator PValue () const
-{
- return ClassValueHelperConvertTo<Rectangle,RectangleValue> (this);
-}
+VALUE_HELPER_CPP (Rectangle);
std::ostream &
operator << (std::ostream &os, const Rectangle &rectangle)
--- a/src/mobility/rectangle.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/rectangle.h Sun Feb 17 04:38:52 2008 +0100
@@ -21,7 +21,7 @@
#define RECTANGLE_H
#include "ns3/value.h"
-#include "ns3/class-value-helper.h"
+#include "ns3/value-helper.h"
namespace ns3 {
@@ -62,40 +62,13 @@
double yMin;
double yMax;
- Rectangle (PValue value);
- operator PValue () const;
+ VALUE_HELPER_HEADER_1 (Rectangle);
};
std::ostream &operator << (std::ostream &os, const Rectangle &rectangle);
std::istream &operator >> (std::istream &is, Rectangle &rectangle);
-
-class RectangleValue : public Value {};
-class RectangleParamSpec : public ParamSpec {};
-
-template <typename T1>
-Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1,
- Rectangle initialValue);
-template <typename T1, typename T2>
-Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1, T2 a2,
- Rectangle initialValue);
-
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T1>
-Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1,
- Rectangle initialValue)
-{
- return MakeClassValueHelperParamSpec<Rectangle,RectangleValue,RectangleParamSpec> (a1, initialValue);
-}
-template <typename T1, typename T2>
-Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1, T2 a2,
- Rectangle initialValue)
-{
- return MakeClassValueHelperParamSpec<Rectangle,RectangleValue,RectangleParamSpec> (a1, a2, initialValue);
-}
+VALUE_HELPER_HEADER_2 (Rectangle);
} // namespace ns3
--- a/src/mobility/vector.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/vector.cc Sun Feb 17 04:38:52 2008 +0100
@@ -24,6 +24,8 @@
namespace ns3 {
+VALUE_HELPER_CPP (Vector);
+
Vector::Vector (double _x, double _y, double _z)
: x (_x),
@@ -37,16 +39,6 @@
z (0.0)
{}
-Vector::Vector (PValue value)
-{
- *this = ClassValueHelperExtractFrom<Vector,VectorValue> (value);
-}
-Vector::operator PValue () const
-{
- return ClassValueHelperConvertTo<Vector,VectorValue> (this);
-}
-
-
double
CalculateDistance (const Vector &a, const Vector &b)
{
--- a/src/mobility/vector.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/mobility/vector.h Sun Feb 17 04:38:52 2008 +0100
@@ -21,7 +21,7 @@
#define VECTOR_H
#include "ns3/value.h"
-#include "ns3/class-value-helper.h"
+#include "ns3/value-helper.h"
namespace ns3 {
@@ -58,46 +58,16 @@
*/
double z;
- Vector (PValue value);
- operator PValue () const;
+ VALUE_HELPER_HEADER_1 (Vector);
};
double CalculateDistance (const Vector &a, const Vector &b);
-class VectorValue : public Value {};
-class VectorParamSpec : public ParamSpec {};
+VALUE_HELPER_HEADER_2 (Vector);
std::ostream &operator << (std::ostream &os, const Vector &vector);
std::istream &operator >> (std::istream &is, Vector &vector);
-template <typename T1>
-Ptr<ParamSpec>
-MakeVectorParamSpec (T1 a1, const Vector &initialValue);
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeVectorParamSpec (T1 a1, T2 a2,
- const Vector &initialValue);
-
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeVectorParamSpec (T1 a1, const Vector &initialValue)
-{
- return MakeClassValueHelperParamSpec<Vector,VectorValue,VectorParamSpec> (a1, initialValue);
-}
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeVectorParamSpec (T1 a1, T2 a2,
- const Vector &initialValue)
-{
- return MakeClassValueHelperParamSpec<Vector,VectorValue,VectorParamSpec> (a1, a2, initialValue);
-}
-
} // namespace ns3
#endif /* VECTOR_H */
--- a/src/node/address.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/node/address.h Sun Feb 17 04:38:52 2008 +0100
@@ -4,7 +4,7 @@
#include <stdint.h>
#include <ostream>
#include "ns3/value.h"
-#include "ns3/class-value-helper.h"
+#include "ns3/value-helper.h"
namespace ns3 {
@@ -154,8 +154,7 @@
*/
static uint8_t Register (void);
- Address (PValue value);
- operator PValue () const;
+ VALUE_HELPER_HEADER_1 (Address);
private:
friend bool operator == (const Address &a, const Address &b);
friend bool operator < (const Address &a, const Address &b);
@@ -166,46 +165,15 @@
uint8_t m_data[MAX_SIZE];
};
+VALUE_HELPER_HEADER_2 (Address);
+
bool operator == (const Address &a, const Address &b);
bool operator != (const Address &a, const Address &b);
bool operator < (const Address &a, const Address &b);
std::ostream& operator<< (std::ostream& os, const Address & address);
std::istream& operator>> (std::istream& is, Address & address);
-class AddressValue : public Value {};
-class AddressParamSpec : public ParamSpec {};
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeAddressParamSpec (T1 a1, Address initialValue);
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeAddressParamSpec (T1 a1, T2 a2, Address initialValue);
} // namespace ns3
-namespace ns3 {
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeAddressParamSpec (T1 a1, Address initialValue)
-{
- return MakeClassValueHelperParamSpec<Address,AddressValue,AddressParamSpec>
- (a1, initialValue);
-}
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeAddressParamSpec (T1 a1, T2 a2, Address initialValue)
-{
- return MakeClassValueHelperParamSpec<Address,AddressValue,AddressParamSpec>
- (a1, a2, initialValue);
-}
-
-
-
-} // namespace ns3
-
-
#endif /* ADDRESS_H */
--- a/src/node/drop-tail-queue.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/node/drop-tail-queue.cc Sun Feb 17 04:38:52 2008 +0100
@@ -33,8 +33,8 @@
.SetParent<Queue> ()
.AddConstructor<DropTailQueue> ()
.AddParameter ("MaxPackets", "The maximum number of packets accepted by this DropTailQueue.",
- MakeUintParamSpec (&DropTailQueue::m_maxPackets,
- 100))
+ UintValue (100),
+ MakeUintParamSpec (&DropTailQueue::m_maxPackets))
;
return tid;
@@ -131,8 +131,8 @@
{
bool result = true;
- DropTailQueue queue;
- queue.Set ("MaxPackets", UintValue (3));
+ Ptr<DropTailQueue> queue = CreateObject<DropTailQueue> ();
+ NS_TEST_ASSERT (queue->Set ("MaxPackets", UintValue (3)));
Ptr<Packet> p1, p2, p3, p4;
p1 = Create<Packet> ();
@@ -140,34 +140,34 @@
p3 = Create<Packet> ();
p4 = Create<Packet> ();
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 0);
- queue.Enqueue (p1);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 1);
- queue.Enqueue (p2);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 2);
- queue.Enqueue (p3);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 3);
- queue.Enqueue (p4); // will be dropped
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 3);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 0);
+ queue->Enqueue (p1);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 1);
+ queue->Enqueue (p2);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 2);
+ queue->Enqueue (p3);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 3);
+ queue->Enqueue (p4); // will be dropped
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 3);
Ptr<Packet> p;
- p = queue.Dequeue ();
+ p = queue->Dequeue ();
NS_TEST_ASSERT (p != 0);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 2);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 2);
NS_TEST_ASSERT_EQUAL (p->GetUid (), p1->GetUid ());
- p = queue.Dequeue ();
+ p = queue->Dequeue ();
NS_TEST_ASSERT (p != 0);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 1);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 1);
NS_TEST_ASSERT_EQUAL (p->GetUid (), p2->GetUid ());
- p = queue.Dequeue ();
+ p = queue->Dequeue ();
NS_TEST_ASSERT (p != 0);
- NS_TEST_ASSERT_EQUAL (queue.GetNPackets (), 0);
+ NS_TEST_ASSERT_EQUAL (queue->GetNPackets (), 0);
NS_TEST_ASSERT_EQUAL (p->GetUid (), p3->GetUid ());
- p = queue.Dequeue ();
+ p = queue->Dequeue ();
NS_TEST_ASSERT (p == 0);
return result;
--- a/src/node/mac48-address.cc Sun Feb 17 04:38:41 2008 +0100
+++ b/src/node/mac48-address.cc Sun Feb 17 04:38:52 2008 +0100
@@ -25,6 +25,8 @@
namespace ns3 {
+VALUE_HELPER_CPP (Mac48Address);
+
#define ASCII_a (0x41)
#define ASCII_z (0x5a)
#define ASCII_A (0x61)
@@ -150,16 +152,6 @@
return broadcast;
}
-Mac48Address::Mac48Address (PValue value)
-{
- *this = ClassValueHelperExtractFrom<Mac48Address,Mac48AddressValue> (value);
-}
-Mac48Address::operator PValue () const
-{
- return ClassValueHelperConvertTo<Mac48Address,Mac48AddressValue> (this);
-}
-
-
bool operator == (const Mac48Address &a, const Mac48Address &b)
{
return memcmp (a.m_address, b.m_address, 6) == 0;
--- a/src/node/mac48-address.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/node/mac48-address.h Sun Feb 17 04:38:52 2008 +0100
@@ -23,7 +23,7 @@
#include <stdint.h>
#include <ostream>
#include "ns3/value.h"
-#include "ns3/class-value-helper.h"
+#include "ns3/value-helper.h"
namespace ns3 {
@@ -96,8 +96,7 @@
*/
static Mac48Address GetBroadcast (void);
- Mac48Address (PValue value);
- operator PValue () const;
+ VALUE_HELPER_HEADER_1 (Mac48Address);
private:
/**
* \returns a new Address instance
@@ -112,41 +111,14 @@
uint8_t m_address[6];
};
+VALUE_HELPER_HEADER_2 (Mac48Address);
+
bool operator == (const Mac48Address &a, const Mac48Address &b);
bool operator != (const Mac48Address &a, const Mac48Address &b);
bool operator < (const Mac48Address &a, const Mac48Address &b);
std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
std::istream& operator>> (std::istream& is, const Mac48Address & address);
-class Mac48AddressValue : public Value {};
-class Mac48AddressParamSpec : public ParamSpec {};
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeMac48AddressParamSpec (T1 a1, Mac48Address address);
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeMac48AddressParamSpec (T1 a1, T2 a2, Mac48Address address);
-
-} // namespace ns3
-
-namespace ns3 {
-
-template <typename T1>
-Ptr<ParamSpec>
-MakeMac48AddressParamSpec (T1 a1, Mac48Address address)
-{
- return MakeClassValueHelperParamSpec<Mac48Address,Mac48AddressValue,Mac48AddressParamSpec> (a1, address);
-}
-
-template <typename T1, typename T2>
-Ptr<ParamSpec>
-MakeMac48AddressParamSpec (T1 a1, T2 a2, Mac48Address address)
-{
- return MakeClassValueHelperParamSpec<Mac48Address,Mac48AddressValue,Mac48AddressParamSpec> (a1, a2, address);
-}
-
} // namespace ns3
#endif /* MAC48_ADDRESS_H */
--- a/src/simulator/nstime.h Sun Feb 17 04:38:41 2008 +0100
+++ b/src/simulator/nstime.h Sun Feb 17 04:38:52 2008 +0100
@@ -674,11 +674,9 @@
class TimeParamSpec : public ParamSpec {};
template <typename T1>
-Ptr<ParamSpec> MakeTimeParamSpec (T1 a1,
- Time initialValue);
+Ptr<ParamSpec> MakeTimeParamSpec (T1 a1);
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeTimeParamSpec (T1 a1, T2 a2,
- Time initialValue);
+Ptr<ParamSpec> MakeTimeParamSpec (T1 a1, T2 a2);
} // namespace ns3
@@ -686,17 +684,15 @@
namespace ns3 {
template <typename T1>
-Ptr<ParamSpec> MakeTimeParamSpec (T1 a1,
- Time initialValue)
+Ptr<ParamSpec> MakeTimeParamSpec (T1 a1)
{
- return MakeClassValueHelperParamSpec<Time,TimeValue,TimeParamSpec> (a1, initialValue);
+ return MakeClassValueHelperParamSpec<Time,TimeValue,TimeParamSpec> (a1);
}
template <typename T1, typename T2>
-Ptr<ParamSpec> MakeTimeParamSpec (T1 a1, T2 a2,
- Time initialValue)
+Ptr<ParamSpec> MakeTimeParamSpec (T1 a1, T2 a2)
{
- return MakeClassValueHelperParamSpec<Time,TimeValue,TimeParamSpec> (a1, a2, initialValue);
+ return MakeClassValueHelperParamSpec<Time,TimeValue,TimeParamSpec> (a1, a2);
}