Changeset 1543 for code/trunk/src/core/Identifier.cc
- Timestamp:
- Jun 5, 2008, 2:18:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/Identifier.cc
r1505 r1543 73 73 delete this->children_; 74 74 delete this->directChildren_; 75 } 76 77 /** 78 @brief Returns an identifier by name and adds it if not available 79 @param name The name of the identifier as typeid().name() suggests 80 @param proposal A pointer to a newly created identifier for the case of non existance in the map 81 @return The identifier (unique instance) 82 */ 83 Identifier *Identifier::getIdentifier(std::string &name, Identifier *proposal) 84 { 85 static std::map<std::string, Identifier*> identifiers; //!< The map to store all Identifiers. 86 std::map<std::string, Identifier*>::const_iterator it = identifiers.find(name); 87 if (it == identifiers.end()) 88 { 89 // there isn't an entry yet, put the proposal in it 90 identifiers[name] = proposal; 91 } 92 else 93 { 94 // this happens when a template exists twice --> delete the proposal 95 delete proposal; 96 } 97 return identifiers[name]; 75 98 } 76 99
Note: See TracChangeset
for help on using the changeset viewer.