[Orxonox-commit 4971] r9640 - in code/branches/core6: src/libraries/core src/libraries/core/class src/libraries/core/config src/libraries/network/packet src/libraries/network/synchronisable test/core/class

landauf at orxonox.net landauf at orxonox.net
Sun Aug 11 21:07:39 CEST 2013


Author: landauf
Date: 2013-08-11 21:07:38 +0200 (Sun, 11 Aug 2013)
New Revision: 9640

Modified:
   code/branches/core6/src/libraries/core/Core.cc
   code/branches/core6/src/libraries/core/CoreIncludes.h
   code/branches/core6/src/libraries/core/Template.cc
   code/branches/core6/src/libraries/core/XMLPort.cc
   code/branches/core6/src/libraries/core/class/Identifier.cc
   code/branches/core6/src/libraries/core/class/Identifier.h
   code/branches/core6/src/libraries/core/class/IdentifierManager.cc
   code/branches/core6/src/libraries/core/class/IdentifierManager.h
   code/branches/core6/src/libraries/core/config/ConfigValueContainer.h
   code/branches/core6/src/libraries/network/packet/ClassID.cc
   code/branches/core6/src/libraries/network/synchronisable/Synchronisable.cc
   code/branches/core6/test/core/class/IdentifierClassHierarchyTest.cc
   code/branches/core6/test/core/class/IdentifierExternalClassHierarchyTest.cc
   code/branches/core6/test/core/class/IdentifierSimpleClassHierarchyTest.cc
   code/branches/core6/test/core/class/SubclassIdentifierTest.cc
   code/branches/core6/test/core/class/SuperTest.cc
Log:
made IdentifierManager a self-initializing singleton

Modified: code/branches/core6/src/libraries/core/Core.cc
===================================================================
--- code/branches/core6/src/libraries/core/Core.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/Core.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -197,7 +197,7 @@
 
         // creates the class hierarchy for all classes with factories
         orxout(internal_info) << "creating class hierarchy" << endl;
-        IdentifierManager::createClassHierarchy();
+        IdentifierManager::getInstance().createClassHierarchy();
 
         // Load OGRE excluding the renderer and the render window
         orxout(internal_info) << "creating GraphicsManager:" << endl;
@@ -247,7 +247,7 @@
         safeObjectDelete(&languageInstance_);
         safeObjectDelete(&configFileManager_);
         ConsoleCommand::destroyAll();
-        IdentifierManager::destroyAllIdentifiers();
+        IdentifierManager::getInstance().destroyAllIdentifiers();
         safeObjectDelete(&signalHandler_);
         safeObjectDelete(&dynLibManager_);
         safeObjectDelete(&pathConfig_);

Modified: code/branches/core6/src/libraries/core/CoreIncludes.h
===================================================================
--- code/branches/core6/src/libraries/core/CoreIncludes.h	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/CoreIncludes.h	2013-08-11 19:07:38 UTC (rev 9640)
@@ -178,7 +178,7 @@
     */
     inline Identifier* ClassByString(const std::string& name)
     {
-        return IdentifierManager::getIdentifierByString(name);
+        return IdentifierManager::getInstance().getIdentifierByString(name);
     }
 
     /**
@@ -187,7 +187,7 @@
     */
     inline Identifier* ClassByLowercaseString(const std::string& name)
     {
-        return IdentifierManager::getIdentifierByLowercaseString(name);
+        return IdentifierManager::getInstance().getIdentifierByLowercaseString(name);
     }
 
     /**
@@ -196,7 +196,7 @@
     */
     inline Identifier* ClassByID(uint32_t id)
     {
-        return IdentifierManager::getIdentifierByID(id);
+        return IdentifierManager::getInstance().getIdentifierByID(id);
     }
 
     /**

Modified: code/branches/core6/src/libraries/core/Template.cc
===================================================================
--- code/branches/core6/src/libraries/core/Template.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/Template.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -149,7 +149,7 @@
         orxout(verbose, context::templates) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << endl;
 
         // check if the template is applied on an object of the right type
-        Identifier* identifier = IdentifierManager::getIdentifierByString(this->getXMLElement().Value());
+        Identifier* identifier = ClassByString(this->getXMLElement().Value());
         if (!object->getIdentifier()->isA(identifier))
             orxout(internal_warning, context::templates) << "Template was defined for " << identifier->getName() << " but the object is of type " << object->getIdentifier()->getName() << endl;
 

Modified: code/branches/core6/src/libraries/core/XMLPort.cc
===================================================================
--- code/branches/core6/src/libraries/core/XMLPort.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/XMLPort.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -28,6 +28,7 @@
 
 #include "XMLPort.h"
 
+#include "CoreIncludes.h"
 #include "Loader.h"
 #include "Namespace.h"
 
@@ -58,7 +59,7 @@
 
                 for (ticpp::Iterator<ticpp::Element> child = xmlsubelement->FirstChildElement(false); child != child.end(); child++)
                 {
-                    Identifier* identifier = IdentifierManager::getIdentifierByString(child->Value());
+                    Identifier* identifier = ClassByString(child->Value());
                     if (!identifier)
                     {
                         if (!this->sectionname_.empty())

Modified: code/branches/core6/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/class/Identifier.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -49,7 +49,7 @@
         @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
     */
     Identifier::Identifier()
-        : classID_(IdentifierManager::classIDCounter_s++)
+        : classID_(IdentifierManager::getInstance().classIDCounter_s++)
     {
         this->bCreatedOneObject_ = false;
         this->bSetName_ = false;
@@ -86,7 +86,7 @@
     void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
     {
         // Check if at least one object of the given type was created
-        if (!this->bCreatedOneObject_ && IdentifierManager::isCreatingHierarchy())
+        if (!this->bCreatedOneObject_ && IdentifierManager::getInstance().isCreatingHierarchy())
         {
             // If no: We have to store the information and initialize the Identifier
             orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
@@ -154,9 +154,9 @@
         {
             this->name_ = name;
             this->bSetName_ = true;
-            IdentifierManager::getStringIdentifierMapIntern()[name] = this;
-            IdentifierManager::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this;
-            IdentifierManager::getIDIdentifierMapIntern()[this->networkID_] = this;
+            IdentifierManager::getInstance().identifierByString_[name] = this;
+            IdentifierManager::getInstance().identifierByLowercaseString_[getLowercase(name)] = this;
+            IdentifierManager::getInstance().identifierByNetworkId_[this->networkID_] = this;
         }
     }
 
@@ -195,7 +195,7 @@
     void Identifier::setNetworkID(uint32_t id)
     {
 //        Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
-        IdentifierManager::getIDIdentifierMapIntern()[id] = this;
+        IdentifierManager::getInstance().identifierByNetworkId_[id] = this;
         this->networkID_ = id;
     }
 

Modified: code/branches/core6/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/class/Identifier.h	2013-08-11 19:07:38 UTC (rev 9640)
@@ -345,7 +345,7 @@
         ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
 
         // Get the entry from the map
-        ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getIdentifierSingleton(name, proposal);
+        ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getInstance().getIdentifierSingleton(name, proposal);
 
         if (ClassIdentifier<T>::classIdentifier_s == proposal)
         {
@@ -372,7 +372,7 @@
             orxout(verbose, context::object_list) << "Register Object: " << className << endl;
 
         object->identifier_ = this;
-        if (IdentifierManager::isCreatingHierarchy())
+        if (IdentifierManager::getInstance().isCreatingHierarchy())
         {
             if (bRootClass && !object->parents_)
                 object->parents_ = new std::set<const Identifier*>();

Modified: code/branches/core6/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/class/IdentifierManager.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -42,16 +42,16 @@
 
 namespace orxonox
 {
-    int IdentifierManager::hierarchyCreatingCounter_s = 0;
-    unsigned int IdentifierManager::classIDCounter_s = 0;
+    /* static */ IdentifierManager& IdentifierManager::getInstance()
+    {
+        static IdentifierManager instance;
+        return instance;
+    }
 
-    /**
-        @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
-    */
-    std::map<std::string, Identifier*>& IdentifierManager::getTypeIDIdentifierMap()
+    IdentifierManager::IdentifierManager()
     {
-        static std::map<std::string, Identifier*> identifiers;    //!< The map to store all Identifiers.
-        return identifiers;
+        this->hierarchyCreatingCounter_s = 0;
+        this->classIDCounter_s = 0;
     }
 
     /**
@@ -62,9 +62,9 @@
     */
     Identifier* IdentifierManager::getIdentifierSingleton(const std::string& name, Identifier* proposal)
     {
-        std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
+        std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeId_.find(name);
 
-        if (it != getTypeIDIdentifierMap().end())
+        if (it != this->identifierByTypeId_.end())
         {
             // There is already an entry: return it and delete the proposal
             delete proposal;
@@ -73,7 +73,7 @@
         else
         {
             // There is no entry: put the proposal into the map and return it
-            getTypeIDIdentifierMap()[name] = proposal;
+            this->identifierByTypeId_[name] = proposal;
             return proposal;
         }
     }
@@ -84,8 +84,8 @@
     void IdentifierManager::createClassHierarchy()
     {
         orxout(internal_status) << "Create class-hierarchy" << endl;
-        IdentifierManager::startCreatingHierarchy();
-        for (std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getTypeIDIdentifierMap().begin(); it != IdentifierManager::getTypeIDIdentifierMap().end(); ++it)
+        this->startCreatingHierarchy();
+        for (std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeId_.begin(); it != this->identifierByTypeId_.end(); ++it)
         {
             // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
             if (it->second->hasFactory())
@@ -94,7 +94,7 @@
                 delete temp;
             }
         }
-        IdentifierManager::stopCreatingHierarchy();
+        this->stopCreatingHierarchy();
         orxout(internal_status) << "Finished class-hierarchy creation" << endl;
     }
 
@@ -103,54 +103,24 @@
     */
     void IdentifierManager::destroyAllIdentifiers()
     {
-        for (std::map<std::string, Identifier*>::iterator it = IdentifierManager::getTypeIDIdentifierMap().begin(); it != IdentifierManager::getTypeIDIdentifierMap().end(); ++it)
+        for (std::map<std::string, Identifier*>::iterator it = this->identifierByTypeId_.begin(); it != this->identifierByTypeId_.end(); ++it)
             delete (it->second);
 
-        IdentifierManager::getTypeIDIdentifierMap().clear();
-        IdentifierManager::getStringIdentifierMapIntern().clear();
-        IdentifierManager::getLowercaseStringIdentifierMapIntern().clear();
-        IdentifierManager::getIDIdentifierMapIntern().clear();
+        this->identifierByTypeId_.clear();
+        this->identifierByString_.clear();
+        this->identifierByLowercaseString_.clear();
+        this->identifierByNetworkId_.clear();
     }
 
     /**
-        @brief Returns the map that stores all Identifiers with their names.
-        @return The map
-    */
-    std::map<std::string, Identifier*>& IdentifierManager::getStringIdentifierMapIntern()
-    {
-        static std::map<std::string, Identifier*> identifierMap;
-        return identifierMap;
-    }
-
-    /**
-        @brief Returns the map that stores all Identifiers with their names in lowercase.
-        @return The map
-    */
-    std::map<std::string, Identifier*>& IdentifierManager::getLowercaseStringIdentifierMapIntern()
-    {
-        static std::map<std::string, Identifier*> lowercaseIdentifierMap;
-        return lowercaseIdentifierMap;
-    }
-
-    /**
-        @brief Returns the map that stores all Identifiers with their network IDs.
-        @return The map
-    */
-    std::map<uint32_t, Identifier*>& IdentifierManager::getIDIdentifierMapIntern()
-    {
-        static std::map<uint32_t, Identifier*> identifierMap;
-        return identifierMap;
-    }
-
-    /**
         @brief Returns the Identifier with a given name.
         @param name The name of the wanted Identifier
         @return The Identifier
     */
     Identifier* IdentifierManager::getIdentifierByString(const std::string& name)
     {
-        std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getStringIdentifierMapIntern().find(name);
-        if (it != IdentifierManager::getStringIdentifierMapIntern().end())
+        std::map<std::string, Identifier*>::const_iterator it = this->identifierByString_.find(name);
+        if (it != this->identifierByString_.end())
             return it->second;
         else
             return 0;
@@ -163,8 +133,8 @@
     */
     Identifier* IdentifierManager::getIdentifierByLowercaseString(const std::string& name)
     {
-        std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getLowercaseStringIdentifierMapIntern().find(name);
-        if (it != IdentifierManager::getLowercaseStringIdentifierMapIntern().end())
+        std::map<std::string, Identifier*>::const_iterator it = this->identifierByLowercaseString_.find(name);
+        if (it != this->identifierByLowercaseString_.end())
             return it->second;
         else
             return 0;
@@ -177,8 +147,8 @@
     */
     Identifier* IdentifierManager::getIdentifierByID(const uint32_t id)
     {
-        std::map<uint32_t, Identifier*>::const_iterator it = IdentifierManager::getIDIdentifierMapIntern().find(id);
-        if (it != IdentifierManager::getIDIdentifierMapIntern().end())
+        std::map<uint32_t, Identifier*>::const_iterator it = this->identifierByNetworkId_.find(id);
+        if (it != this->identifierByNetworkId_.end())
             return it->second;
         else
             return 0;
@@ -189,6 +159,6 @@
     */
     void IdentifierManager::clearNetworkIDs()
     {
-        IdentifierManager::getIDIdentifierMapIntern().clear();
+        this->identifierByNetworkId_.clear();
     }
 }

Modified: code/branches/core6/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.h	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/class/IdentifierManager.h	2013-08-11 19:07:38 UTC (rev 9640)
@@ -47,79 +47,82 @@
         template <class T> friend class ClassIdentifier;
 
         public:
+            static IdentifierManager& getInstance();
+
             /////////////////////////////
             ////// Class Hierarchy //////
             /////////////////////////////
-            static void createClassHierarchy();
+            void createClassHierarchy();
 
             /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
-            inline static bool isCreatingHierarchy()
+            inline bool isCreatingHierarchy()
                 { return (hierarchyCreatingCounter_s > 0); }
 
 
             //////////////////////////
             ///// Identifier Map /////
             //////////////////////////
-            static void destroyAllIdentifiers();
+            void destroyAllIdentifiers();
 
-            static Identifier* getIdentifierByString(const std::string& name);
-            static Identifier* getIdentifierByLowercaseString(const std::string& name);
-            static Identifier* getIdentifierByID(uint32_t id);
+            Identifier* getIdentifierByString(const std::string& name);
+            Identifier* getIdentifierByLowercaseString(const std::string& name);
+            Identifier* getIdentifierByID(uint32_t id);
 
-            static void clearNetworkIDs();
+            void clearNetworkIDs();
 
             /// Returns the map that stores all Identifiers with their names.
-            static inline const std::map<std::string, Identifier*>& getStringIdentifierMap()
-                { return IdentifierManager::getStringIdentifierMapIntern(); }
+            inline const std::map<std::string, Identifier*>& getStringIdentifierMap()
+                { return this->identifierByString_; }
             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
-            static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin()
-                { return IdentifierManager::getStringIdentifierMap().begin(); }
+            inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin()
+                { return this->identifierByString_.begin(); }
             /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
-            static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd()
-                { return IdentifierManager::getStringIdentifierMap().end(); }
+            inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd()
+                { return this->identifierByString_.end(); }
 
             /// Returns the map that stores all Identifiers with their names in lowercase.
-            static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap()
-                { return IdentifierManager::getLowercaseStringIdentifierMapIntern(); }
+            inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap()
+                { return this->identifierByLowercaseString_; }
             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
-            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin()
-                { return IdentifierManager::getLowercaseStringIdentifierMap().begin(); }
+            inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin()
+                { return this->identifierByLowercaseString_.begin(); }
             /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
-            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd()
-                { return IdentifierManager::getLowercaseStringIdentifierMap().end(); }
+            inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd()
+                { return this->identifierByLowercaseString_.end(); }
 
             /// Returns the map that stores all Identifiers with their IDs.
-            static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap()
-                { return IdentifierManager::getIDIdentifierMapIntern(); }
+            inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap()
+                { return this->identifierByNetworkId_; }
             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
-            static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin()
-                { return IdentifierManager::getIDIdentifierMap().begin(); }
+            inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin()
+                { return this->identifierByNetworkId_.begin(); }
             /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
-            static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd()
-                { return IdentifierManager::getIDIdentifierMap().end(); }
+            inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd()
+                { return this->identifierByNetworkId_.end(); }
 
         protected:
-            static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
+            Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
 
-            /// Returns the map that stores all Identifiers with their names.
-            static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
-            /// Returns the map that stores all Identifiers with their names in lowercase.
-            static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
-            /// Returns the map that stores all Identifiers with their network IDs.
-            static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
+        private:
+            IdentifierManager();
+            IdentifierManager(const IdentifierManager&);
+            ~IdentifierManager() {}
 
-        private:
             /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
-            inline static void startCreatingHierarchy()
+            inline void startCreatingHierarchy()
                 { hierarchyCreatingCounter_s++; }
             /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
-            inline static void stopCreatingHierarchy()
+            inline void stopCreatingHierarchy()
                 { hierarchyCreatingCounter_s--; }
 
-            static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
+            std::map<std::string, Identifier*> identifierByTypeId_;          //!< Map with the names as received by typeid(). This is only used internally.
 
-            static int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
-            static unsigned int classIDCounter_s;                          //!< Static counter for the unique classIDs
+            std::map<std::string, Identifier*> identifierByString_;          //!< Map that stores all Identifiers with their names.
+            std::map<std::string, Identifier*> identifierByLowercaseString_; //!< Map that stores all Identifiers with their names in lowercase.
+            std::map<uint32_t, Identifier*> identifierByNetworkId_;          //!< Returns the map that stores all Identifiers with their network IDs.
+
+            int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
+            unsigned int classIDCounter_s;                          //!< counter for the unique classIDs
     };
 }
 

Modified: code/branches/core6/src/libraries/core/config/ConfigValueContainer.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueContainer.h	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/core/config/ConfigValueContainer.h	2013-08-11 19:07:38 UTC (rev 9640)
@@ -69,7 +69,7 @@
             inline virtual ~ConfigValueCallback() {}
             inline virtual void call(void* object)
             {
-                if (!IdentifierManager::isCreatingHierarchy())
+                if (!IdentifierManager::getInstance().isCreatingHierarchy())
                     (static_cast<T*>(object)->*this->function_)();
             }
 

Modified: code/branches/core6/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/branches/core6/src/libraries/network/packet/ClassID.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/network/packet/ClassID.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -54,8 +54,8 @@
   std::queue<std::pair<uint32_t, std::string> > tempQueue;
 
   //calculate total needed size (for all strings and integers)
-  std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getStringIdentifierMapBegin();
-  for(;it != IdentifierManager::getStringIdentifierMapEnd();++it){
+  std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getInstance().getStringIdentifierMapBegin();
+  for(;it != IdentifierManager::getInstance().getStringIdentifierMapEnd();++it){
     id = it->second;
     if(id == NULL || !id->hasFactory())
       continue;
@@ -128,7 +128,7 @@
 
 
   //clear the map of network ids
-  IdentifierManager::clearNetworkIDs();
+  IdentifierManager::getInstance().clearNetworkIDs();
 
   orxout(verbose, context::packets) << "=== processing classids: " << endl;
   std::pair<uint32_t, std::string> tempPair;

Modified: code/branches/core6/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/core6/src/libraries/network/synchronisable/Synchronisable.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/src/libraries/network/synchronisable/Synchronisable.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -79,7 +79,7 @@
   Synchronisable::~Synchronisable()
   {
     // delete callback function objects
-    if(!IdentifierManager::isCreatingHierarchy()){
+    if(!IdentifierManager::getInstance().isCreatingHierarchy()){
       // remove object from the static objectMap
       if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
         deletedObjects_.push(objectID_);

Modified: code/branches/core6/test/core/class/IdentifierClassHierarchyTest.cc
===================================================================
--- code/branches/core6/test/core/class/IdentifierClassHierarchyTest.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/test/core/class/IdentifierClassHierarchyTest.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -65,12 +65,12 @@
                     registerClass("Class2b", new ClassFactoryNoArgs<Class2b>());
                     registerClass("Class3", new ClassFactoryNoArgs<Class3>());
 
-                    IdentifierManager::createClassHierarchy();
+                    IdentifierManager::getInstance().createClassHierarchy();
                 }
 
                 virtual void TearDown()
                 {
-                    IdentifierManager::destroyAllIdentifiers();
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
                 }
         };
     }

Modified: code/branches/core6/test/core/class/IdentifierExternalClassHierarchyTest.cc
===================================================================
--- code/branches/core6/test/core/class/IdentifierExternalClassHierarchyTest.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/test/core/class/IdentifierExternalClassHierarchyTest.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -25,12 +25,12 @@
                     registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());
                     registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());
 
-                    IdentifierManager::createClassHierarchy();
+                    IdentifierManager::getInstance().createClassHierarchy();
                 }
 
                 virtual void TearDown()
                 {
-                    IdentifierManager::destroyAllIdentifiers();
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
                 }
         };
     }

Modified: code/branches/core6/test/core/class/IdentifierSimpleClassHierarchyTest.cc
===================================================================
--- code/branches/core6/test/core/class/IdentifierSimpleClassHierarchyTest.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/test/core/class/IdentifierSimpleClassHierarchyTest.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -27,12 +27,12 @@
                     registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());
                     registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());
 
-                    IdentifierManager::createClassHierarchy();
+                    IdentifierManager::getInstance().createClassHierarchy();
                 }
 
                 virtual void TearDown()
                 {
-                    IdentifierManager::destroyAllIdentifiers();
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
                 }
         };
     }

Modified: code/branches/core6/test/core/class/SubclassIdentifierTest.cc
===================================================================
--- code/branches/core6/test/core/class/SubclassIdentifierTest.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/test/core/class/SubclassIdentifierTest.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -42,7 +42,7 @@
     TEST(SubclassIdentifierTest, CanAssignIdentifierOfSubclass)
     {
         TestSubclass test;
-        IdentifierManager::createClassHierarchy();
+        IdentifierManager::getInstance().createClassHierarchy();
 
         SubclassIdentifier<TestClass> subclassIdentifier;
         subclassIdentifier = Class(TestSubclass);
@@ -52,7 +52,7 @@
     TEST(SubclassIdentifierTest, CanCreateSubclass)
     {
         TestSubclass test;
-        IdentifierManager::createClassHierarchy();
+        IdentifierManager::getInstance().createClassHierarchy();
 
         SubclassIdentifier<TestClass> subclassIdentifier;
         subclassIdentifier = Class(TestSubclass);

Modified: code/branches/core6/test/core/class/SuperTest.cc
===================================================================
--- code/branches/core6/test/core/class/SuperTest.cc	2013-08-11 16:30:05 UTC (rev 9639)
+++ code/branches/core6/test/core/class/SuperTest.cc	2013-08-11 19:07:38 UTC (rev 9640)
@@ -68,7 +68,7 @@
     TEST(SuberTest, SuperCallWithoutArguments)
     {
         TestSubclass test;
-        IdentifierManager::createClassHierarchy();
+        IdentifierManager::getInstance().createClassHierarchy();
 
         EXPECT_FALSE(test.changedNameBase_);
         EXPECT_FALSE(test.changedNameSubclass_);
@@ -82,7 +82,7 @@
     TEST(SuberTest, SuperCallWithArguments)
     {
         TestSubclass test;
-        IdentifierManager::createClassHierarchy();
+        IdentifierManager::getInstance().createClassHierarchy();
 
         EXPECT_FALSE(test.xmlPortBase_);
         EXPECT_FALSE(test.xmlPortSubclass_);




More information about the Orxonox-commit mailing list