# HG changeset patch # User Mathieu Lacage # Date 1207851094 25200 # Node ID e1ff74674f875991bc77f1eea7128e83634632e6 # Parent 8fb456039670bc64d16b1b1db89316221fe80b6e add functions to access list of root namespace objects diff -r 8fb456039670 -r e1ff74674f87 src/core/config.cc --- 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 obj); void UnregisterRootNamespaceObject (Ptr obj); + + uint32_t GetRootNamespaceObjectN (void) const; + Ptr GetRootNamespaceObject (uint32_t i) const; private: typedef std::vector > Roots; @@ -415,6 +418,16 @@ } } +uint32_t +ConfigImpl::GetRootNamespaceObjectN (void) const +{ + return m_roots.size (); +} +Ptr +ConfigImpl::GetRootNamespaceObject (uint32_t i) const +{ + return m_roots[i]; +} namespace Config { @@ -467,6 +480,17 @@ Singleton::Get ()->UnregisterRootNamespaceObject (obj); } +uint32_t GetRootNamespaceObjectN (void) +{ + return Singleton::Get ()->GetRootNamespaceObjectN (); +} + +Ptr GetRootNamespaceObject (uint32_t i) +{ + return Singleton::Get ()->GetRootNamespaceObject (i); +} + + } // namespace Config } // namespace ns3 diff -r 8fb456039670 -r e1ff74674f87 src/core/config.h --- 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 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 GetRootNamespaceObject (uint32_t i); + } // namespace Config } // namespace ns3