add functions to access list of root namespace objects

This commit is contained in:
Mathieu Lacage
2008-04-10 11:11:34 -07:00
parent be27a1c03d
commit 27c1fab7fc
2 changed files with 35 additions and 0 deletions

View File

@@ -290,6 +290,9 @@ public:
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 @@ ConfigImpl::UnregisterRootNamespaceObject (Ptr<Object> obj)
}
}
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 @@ void UnregisterRootNamespaceObject (Ptr<Object> obj)
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

View File

@@ -118,6 +118,17 @@ void RegisterRootNamespaceObject (Ptr<Object> obj);
*/
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