- Timestamp:
- Aug 11, 2013, 9:07:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/class/IdentifierManager.h
r9564 r9640 48 48 49 49 public: 50 static IdentifierManager& getInstance(); 51 50 52 ///////////////////////////// 51 53 ////// Class Hierarchy ////// 52 54 ///////////////////////////// 53 staticvoid createClassHierarchy();55 void createClassHierarchy(); 54 56 55 57 /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. 56 inline staticbool isCreatingHierarchy()58 inline bool isCreatingHierarchy() 57 59 { return (hierarchyCreatingCounter_s > 0); } 58 60 … … 61 63 ///// Identifier Map ///// 62 64 ////////////////////////// 63 staticvoid destroyAllIdentifiers();65 void destroyAllIdentifiers(); 64 66 65 staticIdentifier* getIdentifierByString(const std::string& name);66 staticIdentifier* getIdentifierByLowercaseString(const std::string& name);67 staticIdentifier* getIdentifierByID(uint32_t id);67 Identifier* getIdentifierByString(const std::string& name); 68 Identifier* getIdentifierByLowercaseString(const std::string& name); 69 Identifier* getIdentifierByID(uint32_t id); 68 70 69 staticvoid clearNetworkIDs();71 void clearNetworkIDs(); 70 72 71 73 /// Returns the map that stores all Identifiers with their names. 72 staticinline const std::map<std::string, Identifier*>& getStringIdentifierMap()73 { return IdentifierManager::getStringIdentifierMapIntern(); }74 inline const std::map<std::string, Identifier*>& getStringIdentifierMap() 75 { return this->identifierByString_; } 74 76 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names. 75 staticinline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin()76 { return IdentifierManager::getStringIdentifierMap().begin(); }77 inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() 78 { return this->identifierByString_.begin(); } 77 79 /// Returns a const_iterator to the end of the map that stores all Identifiers with their names. 78 staticinline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd()79 { return IdentifierManager::getStringIdentifierMap().end(); }80 inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() 81 { return this->identifierByString_.end(); } 80 82 81 83 /// Returns the map that stores all Identifiers with their names in lowercase. 82 staticinline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap()83 { return IdentifierManager::getLowercaseStringIdentifierMapIntern(); }84 inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() 85 { return this->identifierByLowercaseString_; } 84 86 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase. 85 staticinline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin()86 { return IdentifierManager::getLowercaseStringIdentifierMap().begin(); }87 inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() 88 { return this->identifierByLowercaseString_.begin(); } 87 89 /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase. 88 staticinline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd()89 { return IdentifierManager::getLowercaseStringIdentifierMap().end(); }90 inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() 91 { return this->identifierByLowercaseString_.end(); } 90 92 91 93 /// Returns the map that stores all Identifiers with their IDs. 92 staticinline const std::map<uint32_t, Identifier*>& getIDIdentifierMap()93 { return IdentifierManager::getIDIdentifierMapIntern(); }94 inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() 95 { return this->identifierByNetworkId_; } 94 96 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs. 95 staticinline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin()96 { return IdentifierManager::getIDIdentifierMap().begin(); }97 inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() 98 { return this->identifierByNetworkId_.begin(); } 97 99 /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs. 98 staticinline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd()99 { return IdentifierManager::getIDIdentifierMap().end(); }100 inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() 101 { return this->identifierByNetworkId_.end(); } 100 102 101 103 protected: 102 static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal); 103 104 /// Returns the map that stores all Identifiers with their names. 105 static std::map<std::string, Identifier*>& getStringIdentifierMapIntern(); 106 /// Returns the map that stores all Identifiers with their names in lowercase. 107 static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern(); 108 /// Returns the map that stores all Identifiers with their network IDs. 109 static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern(); 104 Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal); 110 105 111 106 private: 107 IdentifierManager(); 108 IdentifierManager(const IdentifierManager&); 109 ~IdentifierManager() {} 110 112 111 /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents. 113 inline staticvoid startCreatingHierarchy()112 inline void startCreatingHierarchy() 114 113 { hierarchyCreatingCounter_s++; } 115 114 /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents. 116 inline staticvoid stopCreatingHierarchy()115 inline void stopCreatingHierarchy() 117 116 { hierarchyCreatingCounter_s--; } 118 117 119 st atic std::map<std::string, Identifier*>& getTypeIDIdentifierMap();118 std::map<std::string, Identifier*> identifierByTypeId_; //!< Map with the names as received by typeid(). This is only used internally. 120 119 121 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) 122 static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs 120 std::map<std::string, Identifier*> identifierByString_; //!< Map that stores all Identifiers with their names. 121 std::map<std::string, Identifier*> identifierByLowercaseString_; //!< Map that stores all Identifiers with their names in lowercase. 122 std::map<uint32_t, Identifier*> identifierByNetworkId_; //!< Returns the map that stores all Identifiers with their network IDs. 123 124 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) 125 unsigned int classIDCounter_s; //!< counter for the unique classIDs 123 126 }; 124 127 }
Note: See TracChangeset
for help on using the changeset viewer.