add functions to access list of root namespace objects
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 10 Apr 2008 11:11:34 -0700
changeset 2941 e1ff74674f87
parent 2940 8fb456039670
child 2942 e37b7279e41e
add functions to access list of root namespace objects
src/core/config.cc
src/core/config.h
--- a/src/core/config.cc	Thu Apr 10 10:24:18 2008 -0700
+++ b/src/core/config.cc	Thu Apr 10 11:11:34 2008 -0700
@@ -290,6 +290,9 @@
 
   void RegisterRootNamespaceObject (Ptr<Object> obj);
   void UnregisterRootNamespaceObject (Ptr<Object> obj);
+
+  uint32_t GetRootNamespaceObjectN (void) const;
+  Ptr<Object> GetRootNamespaceObject (uint32_t i) const;
   
 private:
   typedef std::vector<Ptr<Object> > Roots;
@@ -415,6 +418,16 @@
     }
 }
 
+uint32_t 
+ConfigImpl::GetRootNamespaceObjectN (void) const
+{
+  return m_roots.size ();
+}
+Ptr<Object> 
+ConfigImpl::GetRootNamespaceObject (uint32_t i) const
+{
+  return m_roots[i];
+}
 
 namespace Config {
 
@@ -467,6 +480,17 @@
   Singleton<ConfigImpl>::Get ()->UnregisterRootNamespaceObject (obj);
 }
 
+uint32_t GetRootNamespaceObjectN (void)
+{
+  return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObjectN ();
+}
+
+Ptr<Object> GetRootNamespaceObject (uint32_t i)
+{
+  return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i);
+}
+
+
 } // namespace Config
 
 } // namespace ns3
--- a/src/core/config.h	Thu Apr 10 10:24:18 2008 -0700
+++ b/src/core/config.h	Thu Apr 10 11:11:34 2008 -0700
@@ -118,6 +118,17 @@
  */
 void UnregisterRootNamespaceObject (Ptr<Object> obj);
 
+/**
+ * \returns the number of registered root namespace objects.
+ */
+uint32_t GetRootNamespaceObjectN (void);
+
+/**
+ * \param i the index of the requested object.
+ * \returns the requested root namespace object
+ */
+Ptr<Object> GetRootNamespaceObject (uint32_t i);
+
 } // namespace Config
 
 } // namespace ns3