Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 11, 2013, 10:42:57 PM (11 years ago)
Author:
landauf
Message:

small refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/class/IdentifierManager.cc

    r9641 r9644  
    5757    /**
    5858        @brief Returns an identifier by name and adds it if not available
    59         @param name The name of the identifier as typeid().name() suggests
    6059        @param proposal A pointer to a newly created identifier for the case of non existence in the map
    6160        @return The identifier (unique instance)
    6261    */
    63     Identifier* IdentifierManager::getIdentifierSingleton(const std::string& name, Identifier* proposal)
     62    Identifier* IdentifierManager::getIdentifierSingleton(Identifier* proposal)
    6463    {
    65         std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeId_.find(name);
     64        const std::string& typeidName = proposal->getTypeidName();
     65        std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeidName_.find(typeidName);
    6666
    67         if (it != this->identifierByTypeId_.end())
     67        if (it != this->identifierByTypeidName_.end())
    6868        {
    69             // There is already an entry: return it and delete the proposal
    70             delete proposal;
     69            // There is already an entry: return it
    7170            return it->second;
    7271        }
     
    7473        {
    7574            // There is no entry: put the proposal into the map and return it
    76             this->identifierByTypeId_[name] = proposal;
     75            this->identifierByTypeidName_[typeidName] = proposal;
    7776            return proposal;
    7877        }
     
    9695        orxout(internal_status) << "Create class-hierarchy" << endl;
    9796        this->startCreatingHierarchy();
    98         for (std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeId_.begin(); it != this->identifierByTypeId_.end(); ++it)
     97        for (std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeidName_.begin(); it != this->identifierByTypeidName_.end(); ++it)
    9998        {
    10099            // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
     
    114113    void IdentifierManager::destroyAllIdentifiers()
    115114    {
    116         for (std::map<std::string, Identifier*>::iterator it = this->identifierByTypeId_.begin(); it != this->identifierByTypeId_.end(); ++it)
     115        for (std::map<std::string, Identifier*>::iterator it = this->identifierByTypeidName_.begin(); it != this->identifierByTypeidName_.end(); ++it)
    117116            delete (it->second);
    118117
    119         this->identifierByTypeId_.clear();
     118        this->identifierByTypeidName_.clear();
    120119        this->identifierByString_.clear();
    121120        this->identifierByLowercaseString_.clear();
Note: See TracChangeset for help on using the changeset viewer.