Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2015, 9:40:11 PM (10 years ago)
Author:
landauf
Message:

StaticallyInitializedIdentifier is now responsible to register and unregister the assigned identifier.

Location:
code/branches/core7/src/libraries/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/CoreIncludes.h

    r10404 r10481  
    167167    inline Identifier* registerClass(const std::string& name, Factory* factory, bool bLoadable = true)
    168168    {
    169         Identifier* identifier = new ClassIdentifier<T>(name, factory, bLoadable);
    170         IdentifierManager::getInstance().addIdentifier(identifier);
    171         return identifier;
     169        return new ClassIdentifier<T>(name, factory, bLoadable);
    172170    }
    173171
     
    242240            virtual void load()
    243241            {
     242                IdentifierManager::getInstance().addIdentifier(this->identifier_);
    244243                for (size_t i = 0; i < this->parents_.size(); ++i)
    245244                    this->identifier_->inheritsFrom(this->parents_[i]->getParent());
     
    248247            virtual void unload()
    249248            {
     249                IdentifierManager::getInstance().removeIdentifier(this->identifier_);
    250250            }
    251251
  • code/branches/core7/src/libraries/core/class/IdentifierManager.cc

    r10479 r10481  
    6868        this->identifierByLowercaseString_[getLowercase(identifier->getName())] = identifier;
    6969        this->identifierByNetworkId_[identifier->getNetworkID()] = identifier;
     70    }
     71
     72    /**
     73     * Unregisters the identifier from all maps of the IdentifierManager.
     74     */
     75    void IdentifierManager::removeIdentifier(Identifier* identifier)
     76    {
     77        this->identifiers_.erase(identifier);
     78        this->identifierByString_.erase(identifier->getName());
     79        this->identifierByLowercaseString_.erase(getLowercase(identifier->getName()));
     80        this->identifierByNetworkId_.erase(identifier->getNetworkID());
    7081    }
    7182
  • code/branches/core7/src/libraries/core/class/IdentifierManager.h

    r10403 r10481  
    5050
    5151            void addIdentifier(Identifier* identifier);
     52            void removeIdentifier(Identifier* identifier);
    5253
    5354            unsigned int getUniqueClassId()
  • code/branches/core7/src/libraries/core/singleton/ScopedSingletonIncludes.h

    r10460 r10481  
    7777namespace orxonox
    7878{
    79 
    8079    class _CoreExport StaticallyInitializedScopedSingletonWrapper : public StaticallyInitializedInstance
    8180    {
Note: See TracChangeset for help on using the changeset viewer.