Changeset 5778 for code/branches/core5/src/libraries/core/Identifier.cc
- Timestamp:
- Sep 24, 2009, 2:47:53 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/Identifier.cc
r5777 r5778 196 196 197 197 /** 198 @brief Creates the class-hierarchy by creating and destroying one object of each type. 199 */ 200 void Identifier::createClassHierarchy() 201 { 202 COUT(3) << "*** Identifier: Create class-hierarchy" << std::endl; 203 std::map<std::string, Identifier*>::const_iterator it; 204 it = Identifier::getStringIdentifierMap().begin(); 205 Identifier::getStringIdentifierMap().begin()->second->startCreatingHierarchy(); 206 for (it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it) 207 { 208 // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards. 209 if (it->second->hasFactory()) 210 { 211 BaseObject* temp = it->second->fabricate(0); 212 delete temp; 213 } 214 } 215 Identifier::getStringIdentifierMap().begin()->second->stopCreatingHierarchy(); 216 COUT(3) << "*** Identifier: Finished class-hierarchy creation" << std::endl; 217 } 218 219 /** 198 220 @brief Destroys all Identifiers. Called when exiting the program. 199 221 */ … … 214 236 this->name_ = name; 215 237 this->bSetName_ = true; 216 Identifier::getIdentifierMapIntern()[name] = this; 217 Identifier::getLowercaseIdentifierMapIntern()[getLowercase(name)] = this; 238 Identifier::getStringIdentifierMapIntern()[name] = this; 239 Identifier::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this; 240 Identifier::getIDIdentifierMapIntern()[this->networkID_] = this; 218 241 } 219 242 } … … 240 263 241 264 /** 242 @brief Sets the network ID to a new value and changes the entry in the Factory.265 @brief Sets the network ID to a new value and changes the entry in the ID-Identifier-map. 243 266 @param id The new network ID 244 267 */ 245 268 void Identifier::setNetworkID(uint32_t id) 246 269 { 247 Factory::changeNetworkID(this, this->networkID_, id); 270 // Identifier::getIDIdentifierMapIntern().erase(this->networkID_); 271 Identifier::getIDIdentifierMapIntern()[id] = this; 248 272 this->networkID_ = id; 249 273 } … … 304 328 305 329 /** 306 @brief Returns the map that stores all Identifiers .330 @brief Returns the map that stores all Identifiers with their names. 307 331 @return The map 308 332 */ 309 std::map<std::string, Identifier*>& Identifier::get IdentifierMapIntern()333 std::map<std::string, Identifier*>& Identifier::getStringIdentifierMapIntern() 310 334 { 311 335 static std::map<std::string, Identifier*> identifierMap; … … 314 338 315 339 /** 316 @brief Returns the map that stores all Identifiers .340 @brief Returns the map that stores all Identifiers with their names in lowercase. 317 341 @return The map 318 342 */ 319 std::map<std::string, Identifier*>& Identifier::getLowercase IdentifierMapIntern()343 std::map<std::string, Identifier*>& Identifier::getLowercaseStringIdentifierMapIntern() 320 344 { 321 345 static std::map<std::string, Identifier*> lowercaseIdentifierMap; 322 346 return lowercaseIdentifierMap; 347 } 348 349 /** 350 @brief Returns the map that stores all Identifiers with their network IDs. 351 @return The map 352 */ 353 std::map<uint32_t, Identifier*>& Identifier::getIDIdentifierMapIntern() 354 { 355 static std::map<uint32_t, Identifier*> identifierMap; 356 return identifierMap; 357 } 358 359 /** 360 @brief Returns the Identifier with a given name. 361 @param name The name of the wanted Identifier 362 @return The Identifier 363 */ 364 Identifier* Identifier::getIdentifierByString(const std::string& name) 365 { 366 std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapIntern().find(name); 367 if (it != Identifier::getStringIdentifierMapIntern().end()) 368 return it->second; 369 else 370 return 0; 371 } 372 373 /** 374 @brief Returns the Identifier with a given network ID. 375 @param id The network ID of the wanted Identifier 376 @return The Identifier 377 */ 378 Identifier* Identifier::getIdentifierByID(const uint32_t id) 379 { 380 std::map<uint32_t, Identifier*>::const_iterator it = Identifier::getIDIdentifierMapIntern().find(id); 381 if (it != Identifier::getIDIdentifierMapIntern().end()) 382 return it->second; 383 else 384 return 0; 385 } 386 387 /** 388 @brief Cleans the NetworkID map (needed on clients for correct initialization) 389 */ 390 void Identifier::clearNetworkIDs() 391 { 392 Identifier::getIDIdentifierMapIntern().clear(); 323 393 } 324 394
Note: See TracChangeset
for help on using the changeset viewer.