Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10481


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
Files:
9 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    {
  • code/branches/core7/test/core/object/ClassFactoryTest.cc

    r9649 r10481  
    33#include "core/BaseObject.h"
    44#include "core/object/Context.h"
     5#include "core/module/ModuleInstance.h"
    56
    67namespace orxonox
     
    1516                {
    1617                    Context::setRootContext(new Context(NULL));
     18                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances();
    1719                }
    1820
    1921                virtual void TearDown()
    2022                {
     23                    ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances();
    2124                    Context::setRootContext(NULL);
    2225                }
  • code/branches/core7/test/core/object/ContextTest.cc

    r10395 r10481  
    33#include "core/class/OrxonoxClass.h"
    44#include "core/CoreIncludes.h"
     5#include "core/module/ModuleInstance.h"
    56
    67namespace orxonox
     
    2324                {
    2425                    Context::setRootContext(new Context(NULL));
     26                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances();
    2527                }
    2628
    2729                virtual void TearDown()
    2830                {
     31                    ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances();
    2932                    Context::setRootContext(NULL);
    3033                }
  • code/branches/core7/test/core/object/IteratorTest.cc

    r10395 r10481  
    66#include "core/class/OrxonoxInterface.h"
    77#include "core/CoreIncludes.h"
     8#include "core/module/ModuleInstance.h"
    89
    910namespace orxonox
     
    3435                {
    3536                    Context::setRootContext(new Context(NULL));
     37                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances();
    3638                }
    3739
    3840                virtual void TearDown()
    3941                {
     42                    ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances();
    4043                    Context::setRootContext(NULL);
    4144                }
  • code/branches/core7/test/core/object/ListableTest.cc

    r10395 r10481  
    22#include "core/object/Listable.h"
    33#include "core/CoreIncludes.h"
     4#include "core/module/ModuleInstance.h"
    45
    56namespace orxonox
     
    3940                {
    4041                    Context::setRootContext(new Context(NULL));
     42                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances();
    4143                }
    4244
    4345                virtual void TearDown()
    4446                {
     47                    ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances();
    4548                    Context::setRootContext(NULL);
    4649                }
  • code/branches/core7/test/core/object/ObjectListIteratorTest.cc

    r10395 r10481  
    55#include "core/object/Listable.h"
    66#include "core/CoreIncludes.h"
     7#include "core/module/ModuleInstance.h"
    78
    89namespace orxonox
     
    2627                {
    2728                    Context::setRootContext(new Context(NULL));
     29                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances();
    2830                }
    2931
    3032                virtual void TearDown()
    3133                {
     34                    ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances();
    3235                    Context::setRootContext(NULL);
    3336                }
Note: See TracChangeset for help on using the changeset viewer.