Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 5, 2008, 2:18:14 PM (16 years ago)
Author:
rgrieder
Message:
  • applied patch to remove ClassManager (wouldn't wanna maintain it anymore ;))
  • sorted core CMLs a little bit
  • updated OrxonoxStableHeaders.h
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/Identifier.cc

    r1505 r1543  
    7373        delete this->children_;
    7474        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];
    7598    }
    7699
Note: See TracChangeset for help on using the changeset viewer.