split ParamSpec::CreateInitialValue -> ParamSpec::GetInitialValue + ParamSpec::CreateValue
--- a/src/core/object.cc Mon Feb 04 22:47:26 2008 +0100
+++ b/src/core/object.cc Mon Feb 04 22:48:26 2008 +0100
@@ -694,7 +694,7 @@
{
return false;
}
- PValue v = spec->CreateInitialValue ();
+ PValue v = spec->CreateValue ();
bool ok = v.DeserializeFromString (value, spec);
if (!ok)
{
@@ -790,7 +790,7 @@
value = str.substr (equal+1, next - (equal+1));
cur++;
}
- PValue val = spec->CreateInitialValue ();
+ PValue val = spec->CreateValue ();
bool ok = val.DeserializeFromString (value, spec);
if (!ok)
{
@@ -890,7 +890,7 @@
if (!found)
{
// No matching parameter value so we set the default value.
- PValue initial = paramSpec->CreateInitialValue ();
+ PValue initial = paramSpec->GetInitialValue ();
paramSpec->Set (this, initial);
NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
tid.GetParameterName (i)<<"\" from local");
@@ -929,7 +929,7 @@
{
return false;
}
- PValue v = spec->CreateInitialValue ();
+ PValue v = spec->CreateValue ();
bool ok = v.DeserializeFromString (value, spec);
if (!ok)
{
@@ -951,7 +951,7 @@
{
return false;
}
- PValue v = paramSpec->CreateInitialValue ();
+ PValue v = paramSpec->CreateValue ();
bool ok = paramSpec->Get (this, v);
if (ok)
{
@@ -968,7 +968,7 @@
{
return PValue ();
}
- PValue value = paramSpec->CreateInitialValue ();
+ PValue value = paramSpec->CreateValue ();
bool ok = paramSpec->Get (this, value);
if (!ok)
{
--- a/src/core/param-spec-helper.h Mon Feb 04 22:47:26 2008 +0100
+++ b/src/core/param-spec-helper.h Mon Feb 04 22:48:26 2008 +0100
@@ -31,7 +31,8 @@
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 CreateInitialValue (void) const;
+ virtual PValue GetInitialValue (void) const;
+ virtual PValue CreateValue (void) const;
private:
virtual void DoSet (T *object, const U *v) const = 0;
@@ -244,11 +245,18 @@
}
template <typename T, typename U, typename CHECKER>
PValue
-ParamSpecHelper<T,U,CHECKER>::CreateInitialValue (void) const
+ParamSpecHelper<T,U,CHECKER>::GetInitialValue (void) const
{
return m_initialValue;
}
+template <typename T, typename U, typename CHECKER>
+PValue
+ParamSpecHelper<T,U,CHECKER>::CreateValue (void) const
+{
+ return m_initialValue.Copy ();
+}
+
} // namespace ns3
#endif /* PARAM_SPEC_HELPER_H */
--- a/src/core/value.h Mon Feb 04 22:47:26 2008 +0100
+++ b/src/core/value.h Mon Feb 04 22:48:26 2008 +0100
@@ -74,7 +74,8 @@
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 CreateInitialValue (void) const = 0;
+ virtual PValue GetInitialValue (void) const = 0;
+ virtual PValue CreateValue (void) const = 0;
private:
mutable uint32_t m_count;
};
@@ -246,7 +247,10 @@
}
return true;
}
- virtual PValue CreateInitialValue (void) const {
+ virtual PValue GetInitialValue (void) const {
+ return CreateValue ();
+ }
+ virtual PValue CreateValue (void) const {
return PValue::Create<PtrValue<U> > (Ptr<U> (0));
}
private: