- Timestamp:
- Aug 11, 2013, 10:42:57 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/class/Identifier.h
r9643 r9644 114 114 inline const std::string& getName() const { return this->name_; } 115 115 void setName(const std::string& name); 116 117 /// Returns the name of the class as it is returned by typeid(T).name() 118 virtual const std::string& getTypeidName() = 0; 116 119 117 120 /// Returns the network ID to identify a class through the network. … … 272 275 static ClassIdentifier<T>* getIdentifier(const std::string& name); 273 276 274 bool initiali seObject(T* object, const std::string& className, bool bRootClass);277 bool initializeObject(T* object, const std::string& className, bool bRootClass); 275 278 276 279 void setConfigValues(T* object, Configurable*) const; … … 280 283 void addObjectToList(T* object, Identifiable*); 281 284 282 void updateConfigValues(bool updateChildren = true) const; 285 virtual void updateConfigValues(bool updateChildren = true) const; 286 287 virtual const std::string& getTypeidName() 288 { return this->typeidName_; } 283 289 284 290 private: 285 static void initialiseIdentifier(); 291 static void initializeIdentifier(); 292 286 293 ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy 287 294 ClassIdentifier() 288 295 { 296 this->typeidName_ = typeid(T).name(); 289 297 SuperFunctionInitialization<0, T>::initialize(this); 290 298 } … … 299 307 void updateConfigValues(bool updateChildren, Identifiable*) const; 300 308 309 std::string typeidName_; 301 310 static ClassIdentifier<T>* classIdentifier_s; 302 311 }; … … 314 323 // check if the Identifier already exists 315 324 if (!ClassIdentifier<T>::classIdentifier_s) 316 ClassIdentifier<T>::initiali seIdentifier();325 ClassIdentifier<T>::initializeIdentifier(); 317 326 318 327 return ClassIdentifier<T>::classIdentifier_s; … … 336 345 */ 337 346 template <class T> 338 void ClassIdentifier<T>::initialiseIdentifier() 339 { 340 // Get the name of the class 341 std::string name = typeid(T).name(); 342 343 // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used. 347 /*static */ void ClassIdentifier<T>::initializeIdentifier() 348 { 349 // create a new identifier anyway. Will be deleted if not used. 344 350 ClassIdentifier<T>* proposal = new ClassIdentifier<T>(); 345 351 346 352 // Get the entry from the map 347 ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getInstance().getIdentifierSingleton( name,proposal);353 ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getInstance().getIdentifierSingleton(proposal); 348 354 349 355 if (ClassIdentifier<T>::classIdentifier_s == proposal) 350 { 351 orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl; 352 } 356 orxout(verbose, context::identifier) << "Requested Identifier for " << proposal->getTypeidName() << " was not yet existing and got created." << endl; 353 357 else 354 358 { 355 orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl; 359 orxout(verbose, context::identifier) << "Requested Identifier for " << proposal->getTypeidName() << " was already existing and got assigned." << endl; 360 delete proposal; // delete proposal (it is not used anymore) 356 361 } 357 362 } … … 364 369 */ 365 370 template <class T> 366 bool ClassIdentifier<T>::initiali seObject(T* object, const std::string& className, bool bRootClass)371 bool ClassIdentifier<T>::initializeObject(T* object, const std::string& className, bool bRootClass) 367 372 { 368 373 if (bRootClass)
Note: See TracChangeset
for help on using the changeset viewer.