Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 10, 2011, 9:52:23 PM (13 years ago)
Author:
landauf
Message:

Added DestructionListener, a class which gets notified if a certain object (of type OrxonoxClass) is destroyed. So far only WeakPtr was able to do this, now every class that inherits from DestructionListener can do so.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/OrxonoxClass.cc

    r7401 r7849  
    3737#include "MetaObjectList.h"
    3838#include "Identifier.h"
    39 #include "WeakPtr.h"
    4039
    4140namespace orxonox
     
    5655
    5756    /**
    58         @brief Destructor: Removes the object from the object-lists, notifies all @ref WeakPtr "weak pointers" that this object is being deleted.
     57        @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
    5958    */
    6059    OrxonoxClass::~OrxonoxClass()
     
    7170            delete this->parents_;
    7271
    73         // reset all weak pointers pointing to this object
    74         for (std::set<WeakPtr<OrxonoxClass>*>::iterator it = this->weakPointers_.begin(); it != this->weakPointers_.end(); )
     72        // notify all destruction listeners
     73        for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
    7574            (*(it++))->objectDeleted();
    7675    }
Note: See TracChangeset for help on using the changeset viewer.