From 3fcff1b1b33b682d5fbccf47b74fbb7dfe870ad5 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 3 Jan 2008 09:10:23 +0100 Subject: [PATCH] add InterfaceId::HasConstructor --- src/core/object.cc | 15 +++++++++++++++ src/core/object.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/core/object.cc b/src/core/object.cc index 0135fcfdc..ef2b239b4 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -43,6 +43,7 @@ public: std::string GetName (uint16_t uid) const; uint16_t GetParent (uint16_t uid) const; ns3::CallbackBase GetConstructor (uint16_t uid, uint32_t nArguments); + bool HasConstructor (uint16_t uid); uint32_t GetRegisteredN (void); uint16_t GetRegistered (uint32_t i); private: @@ -160,6 +161,13 @@ IidManager::GetConstructor (uint16_t uid, uint32_t nArguments) return ns3::CallbackBase (); } +bool +IidManager::HasConstructor (uint16_t uid) +{ + struct IidInformation *information = LookupInformation (uid); + return !information->constructors.empty (); +} + uint32_t IidManager::GetRegisteredN (void) { @@ -295,6 +303,13 @@ InterfaceId::GetName (void) const return name; } +bool +InterfaceId::HasConstructor (void) const +{ + bool hasConstructor = Singleton::Get ()->HasConstructor (m_iid); + return hasConstructor; +} + void InterfaceId::DoAddConstructor (CallbackBase cb, uint32_t nArguments) { diff --git a/src/core/object.h b/src/core/object.h index 861337862..fec580d87 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -66,6 +66,11 @@ public: */ std::string GetName (void) const; + /** + * \returns true if this InterfaceId has a constructor + */ + bool HasConstructor (void) const; + InterfaceId (std::string); InterfaceId SetParent (InterfaceId iid);