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 2941e1ff74674f87
parent 2940 8fb456039670
child 2942 e37b7279e41e
add functions to access list of root namespace objects
src/core/config.cc
src/core/config.h
     1.1 --- a/src/core/config.cc	Thu Apr 10 10:24:18 2008 -0700
     1.2 +++ b/src/core/config.cc	Thu Apr 10 11:11:34 2008 -0700
     1.3 @@ -290,6 +290,9 @@
     1.4  
     1.5    void RegisterRootNamespaceObject (Ptr<Object> obj);
     1.6    void UnregisterRootNamespaceObject (Ptr<Object> obj);
     1.7 +
     1.8 +  uint32_t GetRootNamespaceObjectN (void) const;
     1.9 +  Ptr<Object> GetRootNamespaceObject (uint32_t i) const;
    1.10    
    1.11  private:
    1.12    typedef std::vector<Ptr<Object> > Roots;
    1.13 @@ -415,6 +418,16 @@
    1.14      }
    1.15  }
    1.16  
    1.17 +uint32_t 
    1.18 +ConfigImpl::GetRootNamespaceObjectN (void) const
    1.19 +{
    1.20 +  return m_roots.size ();
    1.21 +}
    1.22 +Ptr<Object> 
    1.23 +ConfigImpl::GetRootNamespaceObject (uint32_t i) const
    1.24 +{
    1.25 +  return m_roots[i];
    1.26 +}
    1.27  
    1.28  namespace Config {
    1.29  
    1.30 @@ -467,6 +480,17 @@
    1.31    Singleton<ConfigImpl>::Get ()->UnregisterRootNamespaceObject (obj);
    1.32  }
    1.33  
    1.34 +uint32_t GetRootNamespaceObjectN (void)
    1.35 +{
    1.36 +  return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObjectN ();
    1.37 +}
    1.38 +
    1.39 +Ptr<Object> GetRootNamespaceObject (uint32_t i)
    1.40 +{
    1.41 +  return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i);
    1.42 +}
    1.43 +
    1.44 +
    1.45  } // namespace Config
    1.46  
    1.47  } // namespace ns3
     2.1 --- a/src/core/config.h	Thu Apr 10 10:24:18 2008 -0700
     2.2 +++ b/src/core/config.h	Thu Apr 10 11:11:34 2008 -0700
     2.3 @@ -118,6 +118,17 @@
     2.4   */
     2.5  void UnregisterRootNamespaceObject (Ptr<Object> obj);
     2.6  
     2.7 +/**
     2.8 + * \returns the number of registered root namespace objects.
     2.9 + */
    2.10 +uint32_t GetRootNamespaceObjectN (void);
    2.11 +
    2.12 +/**
    2.13 + * \param i the index of the requested object.
    2.14 + * \returns the requested root namespace object
    2.15 + */
    2.16 +Ptr<Object> GetRootNamespaceObject (uint32_t i);
    2.17 +
    2.18  } // namespace Config
    2.19  
    2.20  } // namespace ns3