Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 31, 2007, 12:05:30 AM (16 years ago)
Author:
landauf
Message:

added removeObjects to the Identifier while constructing something new, but maybe it's not even used. never mind :P

Location:
code/branches/FICN/src/orxonox/core
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/CorePrereqs.h

    r728 r737  
    8181  class Language;
    8282  class LanguageEntry;
     83  class Loader;
    8384  class MetaObjectList;
    8485  template <class T>
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r729 r737  
    4848    class _CoreExport DebugLevel : public OrxonoxClass
    4949    {
     50        template <class T>
     51        friend class ClassIdentifier; // forward declaration because of the private destructor
     52
    5053        public:
    5154            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
  • code/branches/FICN/src/orxonox/core/Identifier.cc

    r715 r737  
    3232
    3333#include "Identifier.h"
     34#include "Factory.h"
    3435
    3536namespace orxonox
  • code/branches/FICN/src/orxonox/core/Identifier.h

    r732 r737  
    6060#include "ObjectList.h"
    6161#include "IdentifierList.h"
    62 #include "Factory.h"
    6362#include "Debug.h"
    64 // These two files would actually be need, but they would produce
    65 // circular dependencies. Anyway, it does compile without them
    66 // #include "OrxonoxClass.h"
    67 // #include "MetaObjectList.h"
     63#include "Iterator.h"
    6864
    6965namespace orxonox
    7066{
    71     class BaseObject; // Forward declaration
     67    class BaseFactory; // Forward declaration
     68    class BaseObject;  // Forward declaration
    7269
    7370    // ###############################
     
    10097
    10198        public:
    102             /** @brief Sets the Factory.
    103              *  @param factory The factory to assign
    104              */
     99            /** @brief Sets the Factory. @param factory The factory to assign */
    105100            inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
    106101
    107102            BaseObject* fabricate();
    108 
    109103            bool isA(const Identifier* identifier) const;
    110104            bool isDirectlyA(const Identifier* identifier) const;
     
    112106            bool isParentOf(const Identifier* identifier) const;
    113107
     108            static std::map<std::string, Identifier*>& getIdentifierMap();
     109
     110            /** @brief Removes all objects of the corresponding class. */
     111            virtual void removeObjects() const = 0;
     112
    114113            /** @returns the name of the class the Identifier belongs to. */
    115114            inline const std::string& getName() const { return this->name_; }
     
    137136            inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
    138137                { this->configValues_[varname] = container; }
    139 
    140             static std::map<std::string, Identifier*>& getIdentifierMap();
    141138
    142139        private:
     
    193190            static void addObject(T* object);
    194191            static ClassIdentifier<T>* getIdentifier();
     192            void removeObjects() const;
    195193            void setName(const std::string& name);
    196194
     
    288286    }
    289287
     288    /**
     289        @brief Removes all objects of the corresponding class.
     290    */
     291    template <class T>
     292    void ClassIdentifier<T>::removeObjects() const
     293    {
     294        for (Iterator<T> it = ObjectList<T>::start(); it;)
     295            delete *(it++);
     296    }
    290297
    291298    // ###############################
  • code/branches/FICN/src/orxonox/core/Language.h

    r729 r737  
    8888    class _CoreExport Language : public OrxonoxClass
    8989    {
     90        template <class T>
     91        friend class ClassIdentifier; // forward declaration because of the private destructor
     92
    9093        public:
    9194            static Language& getLanguage();
  • code/branches/FICN/src/orxonox/core/ObjectList.h

    r729 r737  
    9090            /** @returns the first element in the list */
    9191            inline static Iterator<T> start()
     92                { return Iterator<T>(getList()->first_); }
     93
     94            /** @returns the first element in the list */
     95            inline static Iterator<T> begin()
    9296                { return Iterator<T>(getList()->first_); }
    9397
Note: See TracChangeset for help on using the changeset viewer.