add support to browse the list of existing InterfaceId
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 03 Jan 2008 08:41:15 +0100
changeset 2239 b500773d7eae
parent 2238 05affd9d0dc1
child 2240 48fa5577e64e
add support to browse the list of existing InterfaceId
src/core/object.cc
src/core/object.h
--- a/src/core/object.cc	Thu Jan 03 08:34:31 2008 +0100
+++ b/src/core/object.cc	Thu Jan 03 08:41:15 2008 +0100
@@ -43,6 +43,8 @@
   std::string GetName (uint16_t uid) const;
   uint16_t GetParent (uint16_t uid) const;
   ns3::CallbackBase GetConstructor (uint16_t uid, uint32_t nArguments);
+  uint32_t GetRegisteredN (void);
+  uint16_t GetRegistered (uint32_t i);
 private:
   struct ConstructorInformation {
     ns3::CallbackBase cb;
@@ -158,6 +160,18 @@
   return ns3::CallbackBase ();
 }
 
+uint32_t 
+IidManager::GetRegisteredN (void)
+{
+  return m_information.size ();
+}
+uint16_t 
+IidManager::GetRegistered (uint32_t i)
+{
+  return i;
+}
+
+
 } // anonymous namespace
 
 /*********************************************************************
@@ -251,6 +265,17 @@
   NS_ASSERT (uid != 0);
   return InterfaceId (uid);
 }
+uint32_t 
+InterfaceId::GetRegisteredN (void)
+{
+  return Singleton<IidManager>::Get ()->GetRegisteredN ();
+}
+InterfaceId 
+InterfaceId::GetRegistered (uint32_t i)
+{
+  return Singleton<IidManager>::Get ()->GetRegistered (i);
+}
+
 InterfaceId 
 InterfaceId::SetParent (InterfaceId iid)
 {
--- a/src/core/object.h	Thu Jan 03 08:34:31 2008 +0100
+++ b/src/core/object.h	Thu Jan 03 08:41:15 2008 +0100
@@ -50,6 +50,8 @@
    * name is not a valid interface name.
    */
   static InterfaceId LookupByName (std::string name);
+  static uint32_t GetRegisteredN (void);
+  static InterfaceId GetRegistered (uint32_t i);
   /**
    * \param iid a unique id 
    * \returns the parent of the requested id