Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9572


Ignore:
Timestamp:
Mar 24, 2013, 10:30:39 PM (12 years ago)
Author:
landauf
Message:

moved meta-object-list from Identifiable to Listable, a new base class for objects with objectlists (yep)

Location:
code/branches/core6/src/libraries/core
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/CorePrereqs.h

    r9570 r9572  
    161161    class Iterator;
    162162    class Language;
     163    class Listable;
    163164    class LuaFunctor;
    164165    class LuaState;
  • code/branches/core6/src/libraries/core/class/Identifiable.cc

    r9567 r9572  
    4848        this->identifier_ = 0;
    4949        this->parents_ = 0;
    50         this->metaList_ = new MetaObjectList();
    5150        // Optimisation
    5251        this->objectPointers_.reserve(6);
     
    5857    Identifiable::~Identifiable()
    5958    {
    60 //        if (!this->requestedDestruction_)
    61 //            orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
    62 
    63         this->unregisterObject();
    64 
    6559        // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
    6660        if (this->parents_)
    6761            delete this->parents_;
    68     }
    69 
    70     /**
    71         @brief Removes this object from the object-lists.
    72     */
    73     void Identifiable::unregisterObject()
    74     {
    75         if (this->metaList_)
    76             delete this->metaList_;
    77         this->metaList_ = 0;
    7862    }
    7963
  • code/branches/core6/src/libraries/core/class/Identifiable.h

    r9570 r9572  
    5656            Identifiable();
    5757            virtual ~Identifiable();
    58 
    59             void unregisterObject();
    6058
    6159            /// Returns the Identifier of the object.
     
    120118
    121119        private:
    122             Identifier* identifier_;                                //!< The Identifier of the object
    123             std::set<const Identifier*>* parents_;                  //!< List of all parents of the object
    124             MetaObjectList* metaList_;                              //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
     120            Identifier* identifier_;               //!< The Identifier of the object
     121            std::set<const Identifier*>* parents_; //!< List of all parents of the object
    125122
    126123            /// 'Fast map' that holds this-pointers of all derived types
  • code/branches/core6/src/libraries/core/class/Identifier.h

    r9566 r9572  
    288288
    289289            bool initialiseObject(T* object, const std::string& className, bool bRootClass);
     290
     291            void addObjectToList(T* object, Listable*);
     292            void addObjectToList(T* object, Identifiable*);
    290293
    291294            void updateConfigValues(bool updateChildren = true) const;
     
    392395        else
    393396        {
    394             orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
    395             object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
     397            this->addObjectToList(object, object);
    396398
    397399            // Add pointer of type T to the map in the Identifiable instance that enables "dynamic_casts"
     
    399401            return false;
    400402        }
     403    }
     404
     405    /**
     406     * @brief Only adds the object to the object list if is a @ref Listable
     407     */
     408    template <class T>
     409    void ClassIdentifier<T>::addObjectToList(T* object, Listable*)
     410    {
     411        orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
     412        object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
     413    }
     414
     415    template <class T>
     416    void ClassIdentifier<T>::addObjectToList(T*, Identifiable*)
     417    {
     418        // no action
    401419    }
    402420
  • code/branches/core6/src/libraries/core/class/OrxonoxClass.h

    r9570 r9572  
    4343#include "core/CorePrereqs.h"
    4444
    45 #include "Identifiable.h"
     45#include "core/object/Listable.h"
    4646#include "core/object/Destroyable.h"
    4747
     
    5353        The BaseObject and Interfaces are derived with @c virtual @c public @c OrxonoxClass from OrxonoxClass.
    5454    */
    55     class _CoreExport OrxonoxClass : public Identifiable, public Destroyable
     55    class _CoreExport OrxonoxClass : virtual public Listable, virtual public Destroyable
    5656    {
    5757        public:
  • code/branches/core6/src/libraries/core/object/CMakeLists.txt

    r9570 r9572  
    33  ContextObject.cc
    44  Destroyable.cc
     5  Listable.cc
    56  MetaObjectList.cc
    67  ObjectListBase.cc
Note: See TracChangeset for help on using the changeset viewer.