get rid of ParamSpec::CreateValue.

This commit is contained in:
Mathieu Lacage
2008-02-17 00:46:24 +01:00
parent 25bb76ce20
commit b4edd36ec5
7 changed files with 5 additions and 30 deletions

View File

@@ -134,12 +134,4 @@ EnumParamSpec::GetInitialValue (void) const
return PValue::Create<EnumValue> (m_valueSet.front ().first);
}
PValue
EnumParamSpec::CreateValue (void) const
{
return PValue::Create<EnumValue> (m_valueSet.front ().first);
}
} // namespace ns3

View File

@@ -37,7 +37,6 @@ public:
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;

View File

@@ -107,11 +107,5 @@ ObjectVectorParamSpec::GetInitialValue (void) const
{
return PValue::Create<ObjectVectorValue> ();
}
PValue
ObjectVectorParamSpec::CreateValue (void) const
{
return PValue::Create<ObjectVectorValue> ();
}
} // name

View File

@@ -69,7 +69,6 @@ public:
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;

View File

@@ -694,7 +694,7 @@ Parameters::DoSet (Ptr<const ParamSpec> spec, PValue value)
// attempt to convert to string.
std::string str = value.SerializeToString (0);
// attempt to convert back to value.
PValue v = spec->CreateValue ();
PValue v = spec->GetInitialValue ().Copy ();
ok = v.DeserializeFromString (str, spec);
if (!ok)
{
@@ -792,7 +792,7 @@ Parameters::DeserializeFromString (std::string str)
value = str.substr (equal+1, next - (equal+1));
cur++;
}
PValue val = info.spec->CreateValue ();
PValue val = info.spec->GetInitialValue ().Copy ();
bool ok = val.DeserializeFromString (value, info.spec);
if (!ok)
{
@@ -915,7 +915,7 @@ Object::DoSet (Ptr<const ParamSpec> spec, PValue value)
// attempt to convert to string
std::string str = value.SerializeToString (0);
// attempt to convert back from string.
PValue v = spec->CreateValue ();
PValue v = spec->GetInitialValue ().Copy ();
ok = v.DeserializeFromString (str, spec);
if (!ok)
{
@@ -978,7 +978,7 @@ Object::Get (std::string name, std::string &value) const
{
return false;
}
PValue v = info.spec->CreateValue ();
PValue v = info.spec->GetInitialValue ().Copy ();
bool ok = info.spec->Get (this, v);
if (ok)
{
@@ -999,7 +999,7 @@ Object::Get (std::string name) const
{
return PValue ();
}
PValue value = info.spec->CreateValue ();
PValue value = info.spec->GetInitialValue ().Copy ();
bool ok = info.spec->Get (this, value);
if (!ok)
{

View File

@@ -78,11 +78,6 @@ public:
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;

View File

@@ -77,7 +77,6 @@ public:
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;
};
@@ -273,9 +272,6 @@ public:
return true;
}
virtual PValue GetInitialValue (void) const {
return CreateValue ();
}
virtual PValue CreateValue (void) const {
return PValue::Create<PtrValue<U> > (Ptr<U> (0));
}
private: