Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 24, 2013, 6:34:23 PM (11 years ago)
Author:
landauf
Message:

moved functions and attributes needed to identify the class from OrxonoxClass to Identifiable

File:
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/class/Identifiable.cc

    r9563 r9565  
    3232*/
    3333
    34 #include "OrxonoxClass.h"
     34#include "Identifiable.h"
    3535
    3636#include <cassert>
     
    4444        @brief Constructor: Sets the default values.
    4545    */
    46     OrxonoxClass::OrxonoxClass()
     46    Identifiable::Identifiable()
    4747    {
    4848        this->identifier_ = 0;
    4949        this->parents_ = 0;
    5050        this->metaList_ = new MetaObjectList();
    51         this->referenceCount_ = 0;
    52         this->requestedDestruction_ = false;
    5351        // Optimisation
    5452        this->objectPointers_.reserve(6);
     
    5654
    5755    /**
    58         @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
     56        @brief Destructor: Removes the object from the object-lists
    5957    */
    60     OrxonoxClass::~OrxonoxClass()
     58    Identifiable::~Identifiable()
    6159    {
    6260//        if (!this->requestedDestruction_)
    6361//            orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
    64 
    65         assert(this->referenceCount_ <= 0);
    6662
    6763        this->unregisterObject();
     
    7066        if (this->parents_)
    7167            delete this->parents_;
    72 
    73         // notify all destruction listeners
    74         for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
    75             (*(it++))->objectDeleted();
    76     }
    77 
    78     /**
    79         @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
    80     */
    81     void OrxonoxClass::destroy()
    82     {
    83         assert(this); // Just in case someone tries to delete a NULL pointer
    84         this->requestedDestruction_ = true;
    85         if (this->referenceCount_ == 0)
    86         {
    87             this->preDestroy();
    88             if (this->referenceCount_ == 0)
    89                 delete this;
    90         }
    9168    }
    9269
     
    9471        @brief Removes this object from the object-lists.
    9572    */
    96     void OrxonoxClass::unregisterObject()
     73    void Identifiable::unregisterObject()
    9774    {
    9875        if (this->metaList_)
     
    10279
    10380    /// Returns true if the object's class is of the given type or a derivative.
    104     bool OrxonoxClass::isA(const Identifier* identifier)
     81    bool Identifiable::isA(const Identifier* identifier)
    10582        { return this->getIdentifier()->isA(identifier); }
    10683    /// Returns true if the object's class is exactly of the given type.
    107     bool OrxonoxClass::isExactlyA(const Identifier* identifier)
     84    bool Identifiable::isExactlyA(const Identifier* identifier)
    10885        { return this->getIdentifier()->isExactlyA(identifier); }
    10986    /// Returns true if the object's class is a child of the given type.
    110     bool OrxonoxClass::isChildOf(const Identifier* identifier)
     87    bool Identifiable::isChildOf(const Identifier* identifier)
    11188        { return this->getIdentifier()->isChildOf(identifier); }
    11289    /// Returns true if the object's class is a direct child of the given type.
    113     bool OrxonoxClass::isDirectChildOf(const Identifier* identifier)
     90    bool Identifiable::isDirectChildOf(const Identifier* identifier)
    11491        { return this->getIdentifier()->isDirectChildOf(identifier); }
    11592    /// Returns true if the object's class is a parent of the given type.
    116     bool OrxonoxClass::isParentOf(const Identifier* identifier)
     93    bool Identifiable::isParentOf(const Identifier* identifier)
    11794        { return this->getIdentifier()->isParentOf(identifier); }
    11895    /// Returns true if the object's class is a direct parent of the given type.
    119     bool OrxonoxClass::isDirectParentOf(const Identifier* identifier)
     96    bool Identifiable::isDirectParentOf(const Identifier* identifier)
    12097        { return this->getIdentifier()->isDirectParentOf(identifier); }
    12198
    12299
    123100    /// Returns true if the object's class is of the given type or a derivative.
    124     bool OrxonoxClass::isA(const OrxonoxClass* object)
     101    bool Identifiable::isA(const Identifiable* object)
    125102        { return this->getIdentifier()->isA(object->getIdentifier()); }
    126103    /// Returns true if the object's class is exactly of the given type.
    127     bool OrxonoxClass::isExactlyA(const OrxonoxClass* object)
     104    bool Identifiable::isExactlyA(const Identifiable* object)
    128105        { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
    129106    /// Returns true if the object's class is a child of the given type.
    130     bool OrxonoxClass::isChildOf(const OrxonoxClass* object)
     107    bool Identifiable::isChildOf(const Identifiable* object)
    131108        { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
    132109    /// Returns true if the object's class is a direct child of the given type.
    133     bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object)
     110    bool Identifiable::isDirectChildOf(const Identifiable* object)
    134111        { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
    135112    /// Returns true if the object's class is a parent of the given type.
    136     bool OrxonoxClass::isParentOf(const OrxonoxClass* object)
     113    bool Identifiable::isParentOf(const Identifiable* object)
    137114        { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
    138115    /// Returns true if the object's class is a direct child of the given type.
    139     bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object)
     116    bool Identifiable::isDirectParentOf(const Identifiable* object)
    140117        { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
    141118}
Note: See TracChangeset for help on using the changeset viewer.