Attributes -> AttributeList
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 21 Feb 2008 19:31:17 +0100
changeset 2459 91662d921a83
parent 2458 e8f7c4960576
child 2460 7f5679184b79
Attributes -> AttributeList
src/core/attribute-test.cc
src/core/initial-value.cc
src/core/object-factory.h
src/core/object.cc
src/core/object.h
--- a/src/core/attribute-test.cc	Thu Feb 21 19:28:41 2008 +0100
+++ b/src/core/attribute-test.cc	Thu Feb 21 19:31:17 2008 +0100
@@ -167,7 +167,7 @@
 {
   bool result = true;
 
-  Attributes params;
+  AttributeList params;
   Ptr<AttributeObjectTest> p;
   NS_TEST_ASSERT (params.Set ("AttributeObjectTest::TestBoolName", "false"));
   p = CreateObject<AttributeObjectTest> (params);
@@ -344,11 +344,11 @@
   p->Set ("TestBool", "false");
   NS_TEST_ASSERT_EQUAL (p->Get ("TestBool"), "false");
 
-  Attributes::GetGlobal ()->Set ("TestBool", "true");
+  AttributeList::GetGlobal ()->Set ("TestBool", "true");
   p = CreateObjectWith<AttributeObjectTest> ();
   NS_TEST_ASSERT_EQUAL (p->Get ("TestBool"), "true");
 
-  Attributes::GetGlobal ()->Set ("TestBool", "false");
+  AttributeList::GetGlobal ()->Set ("TestBool", "false");
   p = CreateObjectWith<AttributeObjectTest> ();
   NS_TEST_ASSERT_EQUAL (p->Get ("TestBool"), "false");
 #endif
--- a/src/core/initial-value.cc	Thu Feb 21 19:28:41 2008 +0100
+++ b/src/core/initial-value.cc	Thu Feb 21 19:31:17 2008 +0100
@@ -63,7 +63,7 @@
     }
   // since we did not find a matching InitialValue,
   // we attempt to configure the global parameters list.
-  Attributes::GetGlobal ()->Set (name, value);
+  AttributeList::GetGlobal ()->Set (name, value);
 }
 InitialValue::Iterator 
 InitialValue::Begin (void)
--- a/src/core/object-factory.h	Thu Feb 21 19:28:41 2008 +0100
+++ b/src/core/object-factory.h	Thu Feb 21 19:31:17 2008 +0100
@@ -22,7 +22,7 @@
 
 private:
   TypeId m_tid;
-  Attributes m_parameters;
+  AttributeList m_parameters;
 };
 
 } // namespace ns3
--- a/src/core/object.cc	Thu Feb 21 19:28:41 2008 +0100
+++ b/src/core/object.cc	Thu Feb 21 19:31:17 2008 +0100
@@ -60,7 +60,7 @@
                      ns3::Attribute initialValue,
                      ns3::Ptr<const ns3::AttributeAccessor> spec,
                      ns3::Ptr<const ns3::AttributeChecker> checker);
-  uint32_t GetAttributesN (uint16_t uid) const;
+  uint32_t GetAttributeListN (uint16_t uid) const;
   std::string GetAttributeName (uint16_t uid, uint32_t i) const;
   uint32_t GetAttributeFlags (uint16_t uid, uint32_t i) const;
   ns3::Attribute GetAttributeInitialValue (uint16_t uid, uint32_t i) const;
@@ -272,7 +272,7 @@
 
 
 uint32_t 
-IidManager::GetAttributesN (uint16_t uid) const
+IidManager::GetAttributeListN (uint16_t uid) const
 {
   struct IidInformation *information = LookupInformation (uid);
   return information->attributes.size ();
@@ -441,7 +441,7 @@
   TypeId nextTid = *this;
   do {
     tid = nextTid;
-    for (uint32_t i = 0; i < GetAttributesN (); i++)
+    for (uint32_t i = 0; i < GetAttributeListN (); i++)
       {
         std::string paramName = GetAttributeName (i);
         if (paramName == name)
@@ -465,7 +465,7 @@
   TypeId nextTid = *this;
   do {
     tid = nextTid;
-    for (uint32_t j = 0; j < tid.GetAttributesN (); j++)
+    for (uint32_t j = 0; j < tid.GetAttributeListN (); j++)
       {
         if (cur == i)
           {
@@ -574,22 +574,22 @@
 Ptr<Object> 
 TypeId::CreateObject (void) const
 {
-  return CreateObject (Attributes ());
+  return CreateObject (AttributeList ());
 }
 Ptr<Object> 
-TypeId::CreateObject (const Attributes &attributes) const
+TypeId::CreateObject (const AttributeList &attributes) const
 {
   CallbackBase cb = LookupConstructor (0);
-  Callback<Ptr<Object>,const Attributes &> realCb;
+  Callback<Ptr<Object>,const AttributeList &> realCb;
   realCb.Assign (cb);
   Ptr<Object> object = realCb (attributes);
   return object;  
 }
 
 uint32_t 
-TypeId::GetAttributesN (void) const
+TypeId::GetAttributeListN (void) const
 {
-  uint32_t n = Singleton<IidManager>::Get ()->GetAttributesN (m_tid);
+  uint32_t n = Singleton<IidManager>::Get ()->GetAttributeListN (m_tid);
   return n;
 }
 std::string 
@@ -643,13 +643,13 @@
 }
 
 /*********************************************************************
- *         The Attributes container implementation
+ *         The AttributeList container implementation
  *********************************************************************/
 
-Attributes::Attributes ()
+AttributeList::AttributeList ()
 {}
 
-Attributes::Attributes (const Attributes &o)
+AttributeList::AttributeList (const AttributeList &o)
 {
   for (Attrs::const_iterator i = o.m_attributes.begin (); i != o.m_attributes.end (); i++)
     {
@@ -659,8 +659,8 @@
       m_attributes.push_back (attr);
     }
 }
-Attributes &
-Attributes::operator = (const Attributes &o)
+AttributeList &
+AttributeList::operator = (const AttributeList &o)
 {
   Reset ();
   for (Attrs::const_iterator i = o.m_attributes.begin (); i != o.m_attributes.end (); i++)
@@ -672,13 +672,13 @@
     }
   return *this;
 }
-Attributes::~Attributes ()
+AttributeList::~AttributeList ()
 {
   Reset ();
 }
 
 bool 
-Attributes::Set (std::string name, Attribute value)
+AttributeList::Set (std::string name, Attribute value)
 {
   struct TypeId::AttributeInfo info;
   TypeId::LookupAttributeByFullName (name, &info);
@@ -686,14 +686,14 @@
   return ok;
 }
 void 
-Attributes::SetWithTid (TypeId tid, std::string name, Attribute value)
+AttributeList::SetWithTid (TypeId tid, std::string name, Attribute value)
 {
   struct TypeId::AttributeInfo info;
   tid.LookupAttributeByName (name, &info);
   DoSet (&info, value);
 }
 void 
-Attributes::SetWithTid (TypeId tid, uint32_t position, Attribute value)
+AttributeList::SetWithTid (TypeId tid, uint32_t position, Attribute value)
 {
   struct TypeId::AttributeInfo info;
   tid.LookupAttributeByPosition (position, &info);
@@ -701,7 +701,7 @@
 }
 
 void
-Attributes::DoSetOne (Ptr<const AttributeChecker> checker, Attribute value)
+AttributeList::DoSetOne (Ptr<const AttributeChecker> checker, Attribute value)
 {
   // get rid of any previous value stored in this
   // vector of values.
@@ -720,7 +720,7 @@
   m_attributes.push_back (attr);
 }
 bool
-Attributes::DoSet (struct TypeId::AttributeInfo *info, Attribute value)
+AttributeList::DoSet (struct TypeId::AttributeInfo *info, Attribute value)
 {
   if (info->checker == 0)
     {
@@ -753,23 +753,23 @@
   return true;
 }
 void 
-Attributes::Reset (void)
+AttributeList::Reset (void)
 {
   m_attributes.clear ();
 }
-Attributes *
-Attributes::GetGlobal (void)
+AttributeList *
+AttributeList::GetGlobal (void)
 {
-  return Singleton<Attributes>::Get ();
+  return Singleton<AttributeList>::Get ();
 }
 
 std::string
-Attributes::LookupAttributeFullNameByChecker (Ptr<const AttributeChecker> checker) const
+AttributeList::LookupAttributeFullNameByChecker (Ptr<const AttributeChecker> checker) const
 {
   for (uint32_t i = 0; i < TypeId::GetRegisteredN (); i++)
     {
       TypeId tid = TypeId::GetRegistered (i);
-      for (uint32_t j = 0; j < tid.GetAttributesN (); j++)
+      for (uint32_t j = 0; j < tid.GetAttributeListN (); j++)
         {
           if (checker == tid.GetAttributeChecker (j))
             {
@@ -783,7 +783,7 @@
 }
 
 std::string 
-Attributes::SerializeToString (void) const
+AttributeList::SerializeToString (void) const
 {
   std::ostringstream oss;
   for (Attrs::const_iterator i = m_attributes.begin (); i != m_attributes.end (); i++)
@@ -798,7 +798,7 @@
   return oss.str ();
 }
 bool 
-Attributes::DeserializeFromString (std::string str)
+AttributeList::DeserializeFromString (std::string str)
 {
   Reset ();
 
@@ -887,14 +887,14 @@
   m_next = 0;
 }
 void
-Object::Construct (const Attributes &attributes)
+Object::Construct (const AttributeList &attributes)
 {
   // loop over the inheritance tree back to the Object base class.
   TypeId tid = m_tid;
   do {
     // loop over all attributes in object type
-    NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributesN ());
-    for (uint32_t i = 0; i < tid.GetAttributesN (); i++)
+    NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributeListN ());
+    for (uint32_t i = 0; i < tid.GetAttributeListN (); i++)
       {
         Ptr<const AttributeAccessor> paramSpec = tid.GetAttributeAccessor (i);
         Attribute initial = tid.GetAttributeInitialValue (i);
@@ -906,8 +906,8 @@
             continue;
           }
         bool found = false;
-        // is this attribute stored in this Attributes instance ?
-        for (Attributes::Attrs::const_iterator j = attributes.m_attributes.begin ();
+        // is this attribute stored in this AttributeList instance ?
+        for (AttributeList::Attrs::const_iterator j = attributes.m_attributes.begin ();
              j != attributes.m_attributes.end (); j++)
           {
             if (j->checker == checker)
@@ -923,8 +923,8 @@
         if (!found)
           {
             // is this attribute stored in the global instance instance ?
-            for (Attributes::Attrs::const_iterator j = Attributes::GetGlobal ()->m_attributes.begin ();
-                 j != Attributes::GetGlobal ()->m_attributes.end (); j++)
+            for (AttributeList::Attrs::const_iterator j = AttributeList::GetGlobal ()->m_attributes.begin ();
+                 j != AttributeList::GetGlobal ()->m_attributes.end (); j++)
               {
                 if (j->checker == checker)
                   {
--- a/src/core/object.h	Thu Feb 21 19:28:41 2008 +0100
+++ b/src/core/object.h	Thu Feb 21 19:31:17 2008 +0100
@@ -46,7 +46,7 @@
 class Object;
 class AttributeAccessor;
 class AttributeValue;
-class Attributes;
+class AttributeList;
 
 /**
  * \brief a unique identifier for an interface.
@@ -124,7 +124,7 @@
   /**
    * \returns the number of attributes associated to this TypeId
    */
-  uint32_t GetAttributesN (void) const;
+  uint32_t GetAttributeListN (void) const;
   /**
    * \param i index into attribute array
    * \returns the name associated to the attribute whose
@@ -140,7 +140,7 @@
 
   Attribute GetAttributeInitialValue (uint32_t i) const;
 
-  Ptr<Object> CreateObject (const Attributes &attributes) const;
+  Ptr<Object> CreateObject (const AttributeList &attributes) const;
 
 
   Ptr<Object> CreateObject (void) const;
@@ -235,7 +235,7 @@
   ~TypeId ();
 private:
   friend class Object;
-  friend class Attributes;
+  friend class AttributeList;
   friend bool operator == (TypeId a, TypeId b);
   friend bool operator != (TypeId a, TypeId b);
 
@@ -278,13 +278,13 @@
  *        and in ns3::Object::Set.
  *
  */
-class Attributes
+class AttributeList
 {
 public:
-  Attributes ();
-  Attributes (const Attributes &o);
-  Attributes &operator = (const Attributes &o);
-  ~Attributes ();
+  AttributeList ();
+  AttributeList (const AttributeList &o);
+  AttributeList &operator = (const AttributeList &o);
+  ~AttributeList ();
   /**
    * \param name the name of the attribute to set
    * \param value the value to set
@@ -314,7 +314,7 @@
    * it is always checked last, after any per-object
    * container is checked.
    */
-  static Attributes *GetGlobal (void);
+  static AttributeList *GetGlobal (void);
 
   std::string SerializeToString (void) const;
   bool DeserializeFromString (std::string value);
@@ -450,7 +450,7 @@
   friend class TypeIdTraceResolver;
 
   template <typename T>
-  friend Ptr<T> CreateObject (const Attributes &attributes);
+  friend Ptr<T> CreateObject (const AttributeList &attributes);
 
   template <typename T>
   friend Ptr<T> CreateObject (void);
@@ -501,7 +501,7 @@
    * Initialize all the member variables which were
    * registered with the associated TypeId.
    */
-  void Construct (const Attributes &attributes);
+  void Construct (const AttributeList &attributes);
 
   /**
    * The reference count for this object. Each aggregate
@@ -551,7 +551,7 @@
 TypeId::AddConstructor (void)
 {
   struct Maker {
-    static Ptr<Object> Create (const Attributes &attributes) {
+    static Ptr<Object> Create (const AttributeList &attributes) {
       return ns3::CreateObject<T> (attributes);
     }
   };
@@ -656,7 +656,7 @@
 
 
 template <typename T>
-Ptr<T> CreateObject (const Attributes &attributes)
+Ptr<T> CreateObject (const AttributeList &attributes)
 {
   Ptr<T> p = Ptr<T> (new T (), false);
   p->SetTypeId (T::GetTypeId ());
@@ -669,7 +669,7 @@
 {
   Ptr<T> p = Ptr<T> (new T (), false);
   p->SetTypeId (T::GetTypeId ());
-  p->Object::Construct (Attributes ());
+  p->Object::Construct (AttributeList ());
   return p;
 }
 
@@ -678,7 +678,7 @@
 {
   Ptr<T> p = Ptr<T> (new T (a1), false);
   p->SetTypeId (T::GetTypeId ());
-  p->Object::Construct (Attributes ());
+  p->Object::Construct (AttributeList ());
   return p;
 }
 
@@ -687,7 +687,7 @@
 {
   Ptr<T> p = Ptr<T> (new T (a1, a2), false);
   p->SetTypeId (T::GetTypeId ());
-  p->Object::Construct (Attributes ());
+  p->Object::Construct (AttributeList ());
   return p;
 }
 template <typename T, typename T1, typename T2, typename T3>
@@ -737,7 +737,7 @@
                   std::string n2 = "", Attribute v2 = Attribute ())
               
 {
-  Attributes attributes;
+  AttributeList attributes;
   attributes.SetWithTid (T::GetTypeId (), n1, v1);
   attributes.SetWithTid (T::GetTypeId (), n2, v2);
   return CreateObject<T> (attributes);