get rid of ParamSpec::CreateValue.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sun, 17 Feb 2008 00:46:24 +0100
changeset 2423 5609a96df2f6
parent 2422 6cbcb8fe4551
child 2424 217a447122a6
get rid of ParamSpec::CreateValue.
src/core/enum-value.cc
src/core/enum-value.h
src/core/object-vector.cc
src/core/object-vector.h
src/core/object.cc
src/core/param-spec-helper.h
src/core/value.h
--- a/src/core/enum-value.cc	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/enum-value.cc	Sun Feb 17 00:46:24 2008 +0100
@@ -134,12 +134,4 @@
   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	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/enum-value.h	Sun Feb 17 00:46:24 2008 +0100
@@ -37,7 +37,6 @@
   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/object-vector.cc	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/object-vector.cc	Sun Feb 17 00:46:24 2008 +0100
@@ -107,11 +107,5 @@
 {
   return PValue::Create<ObjectVectorValue> ();
 }
-PValue 
-ObjectVectorParamSpec::CreateValue (void) const
-{
-  return PValue::Create<ObjectVectorValue> ();
-}
-
 
 } // name
--- a/src/core/object-vector.h	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/object-vector.h	Sun Feb 17 00:46:24 2008 +0100
@@ -69,7 +69,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 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	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/object.cc	Sun Feb 17 00:46:24 2008 +0100
@@ -694,7 +694,7 @@
       // 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 @@
                 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 @@
       // 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 @@
     {
       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 @@
     {
       return PValue ();
     }
-  PValue value = info.spec->CreateValue ();
+  PValue value = info.spec->GetInitialValue ().Copy ();
   bool ok = info.spec->Get (this, value);
   if (!ok)
     {
--- a/src/core/param-spec-helper.h	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/param-spec-helper.h	Sun Feb 17 00:46:24 2008 +0100
@@ -78,11 +78,6 @@
     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;
--- a/src/core/value.h	Fri Feb 15 05:38:29 2008 +0100
+++ b/src/core/value.h	Sun Feb 17 00:46:24 2008 +0100
@@ -77,7 +77,6 @@
   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 @@
       return true;
     }
     virtual PValue GetInitialValue (void) const {
-      return CreateValue ();
-    }
-    virtual PValue CreateValue (void) const {
       return PValue::Create<PtrValue<U> > (Ptr<U> (0));
     }
 private: