[Orxonox-commit 5823] r10483 - in code/branches/core7/src/libraries/core: . class

landauf at orxonox.net landauf at orxonox.net
Mon May 25 22:36:28 CEST 2015


Author: landauf
Date: 2015-05-25 22:36:28 +0200 (Mon, 25 May 2015)
New Revision: 10483

Modified:
   code/branches/core7/src/libraries/core/Core.cc
   code/branches/core7/src/libraries/core/class/Identifier.cc
   code/branches/core7/src/libraries/core/class/Identifier.h
   code/branches/core7/src/libraries/core/class/IdentifierManager.cc
   code/branches/core7/src/libraries/core/class/IdentifierManager.h
Log:
avoid dependency on IdentifierManager for as long as possible

Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc	2015-05-25 20:34:42 UTC (rev 10482)
+++ code/branches/core7/src/libraries/core/Core.cc	2015-05-25 20:36:28 UTC (rev 10483)
@@ -134,6 +134,8 @@
             }
         }
 
+        // TODO: initialize Root-Context
+        // TODO: initialize IdentifierManager here
         // TODO: initialize ScopeManager here
         // TODO: initialize CommandLineParser here
         // TODO: initialize ConsoleCommandManager here

Modified: code/branches/core7/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core7/src/libraries/core/class/Identifier.cc	2015-05-25 20:34:42 UTC (rev 10482)
+++ code/branches/core7/src/libraries/core/class/Identifier.cc	2015-05-25 20:36:28 UTC (rev 10483)
@@ -52,10 +52,12 @@
         @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
     */
     Identifier::Identifier(const std::string& name, Factory* factory, bool bLoadable)
-        : classID_(IdentifierManager::getInstance().getUniqueClassId())
     {
         orxout(verbose, context::identifier) << "Create identifier for " << name << endl;
 
+        static unsigned int classIDCounter = 0;
+
+        this->classID_ = classIDCounter++;
         this->name_ = name;
         this->factory_ = factory;
         this->bLoadable_ = bLoadable;

Modified: code/branches/core7/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core7/src/libraries/core/class/Identifier.h	2015-05-25 20:34:42 UTC (rev 10482)
+++ code/branches/core7/src/libraries/core/class/Identifier.h	2015-05-25 20:36:28 UTC (rev 10483)
@@ -230,7 +230,7 @@
             std::string name_;                                             //!< The name of the class the Identifier belongs to
             Factory* factory_;                                             //!< The Factory, able to create new objects of the given class (if available)
             uint32_t networkID_;                                           //!< The network ID to identify a class through the network
-            const unsigned int classID_;                                   //!< Uniquely identifies a class (might not be the same as the networkID_)
+            unsigned int classID_;                                         //!< Uniquely identifies a class (might not be the same as the networkID_)
 
             bool bHasConfigValues_;                                        //!< True if this class has at least one assigned config value
             std::map<std::string, ConfigValueContainer*> configValues_;    //!< A map to link the string of configurable variables with their ConfigValueContainer

Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.cc	2015-05-25 20:34:42 UTC (rev 10482)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.cc	2015-05-25 20:36:28 UTC (rev 10483)
@@ -52,7 +52,6 @@
     IdentifierManager::IdentifierManager()
     {
         this->hierarchyCreatingCounter_s = 0;
-        this->classIDCounter_s = 0;
         this->recordTraceForIdentifier_ = NULL;
     }
 

Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.h	2015-05-25 20:34:42 UTC (rev 10482)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.h	2015-05-25 20:36:28 UTC (rev 10483)
@@ -51,10 +51,7 @@
             void addIdentifier(Identifier* identifier);
             void removeIdentifier(Identifier* identifier);
 
-            unsigned int getUniqueClassId()
-                { return this->classIDCounter_s++; }
 
-
             /////////////////////////////
             ////// Class Hierarchy //////
             /////////////////////////////
@@ -109,7 +106,6 @@
             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
 
             /// Used while creating the object hierarchy to keep track of the identifiers of a newly created object (and all other objects that get created as
             /// a consequence of this, e.g. nested member objects).




More information about the Orxonox-commit mailing list