- Timestamp:
- Mar 24, 2013, 6:08:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/class/Identifier.h
r9563 r9564 93 93 #include "core/object/ObjectList.h" 94 94 #include "core/object/ObjectListBase.h" 95 #include "IdentifierManager.h" 95 96 #include "Super.h" 96 97 … … 113 114 class _CoreExport Identifier 114 115 { 116 friend class IdentifierManager; 117 115 118 public: 116 119 /// Returns the name of the class the Identifier belongs to. … … 151 154 ////// Class Hierarchy ////// 152 155 ///////////////////////////// 153 static void createClassHierarchy();154 155 /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.156 inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }157 158 156 /// Returns the parents of the class the Identifier belongs to. 159 157 inline const std::set<const Identifier*>& getParents() const { return this->parents_; } … … 183 181 /// Returns the end-iterator of the direct-children-list. 184 182 inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); } 185 186 187 //////////////////////////188 ///// Identifier Map /////189 //////////////////////////190 static void destroyAllIdentifiers();191 192 static Identifier* getIdentifierByString(const std::string& name);193 static Identifier* getIdentifierByLowercaseString(const std::string& name);194 static Identifier* getIdentifierByID(uint32_t id);195 196 static void clearNetworkIDs();197 198 /// Returns the map that stores all Identifiers with their names.199 static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); }200 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.201 static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); }202 /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.203 static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); }204 205 /// Returns the map that stores all Identifiers with their names in lowercase.206 static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); }207 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.208 static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); }209 /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.210 static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); }211 212 /// Returns the map that stores all Identifiers with their IDs.213 static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); }214 /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.215 static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); }216 /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.217 static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); }218 183 219 184 … … 259 224 virtual ~Identifier(); 260 225 261 static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);262 226 virtual void createSuperFunctionCaller() const = 0; 263 227 264 228 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); 265 266 /// Returns the map that stores all Identifiers with their names.267 static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();268 /// Returns the map that stores all Identifiers with their names in lowercase.269 static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();270 /// Returns the map that stores all Identifiers with their network IDs.271 static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();272 229 273 230 /// Returns the children of the class the Identifier belongs to. … … 279 236 280 237 private: 281 /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.282 inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; }283 /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.284 inline static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; }285 286 static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();287 288 238 void initialize(std::set<const Identifier*>* parents); 289 239 … … 299 249 std::string name_; //!< The name of the class the Identifier belongs to 300 250 Factory* factory_; //!< The Factory, able to create new objects of the given class (if available) 301 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)302 251 uint32_t networkID_; //!< The network ID to identify a class through the network 303 252 const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_) 304 static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs305 253 306 254 bool bHasConfigValues_; //!< True if this class has at least one assigned config value … … 401 349 402 350 // Get the entry from the map 403 ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier ::getIdentifierSingleton(name, proposal);351 ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getIdentifierSingleton(name, proposal); 404 352 405 353 if (ClassIdentifier<T>::classIdentifier_s == proposal) … … 428 376 429 377 object->identifier_ = this; 430 if (Identifier ::isCreatingHierarchy())378 if (IdentifierManager::isCreatingHierarchy()) 431 379 { 432 380 if (bRootClass && !object->parents_)
Note: See TracChangeset
for help on using the changeset viewer.