Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 29, 2013, 2:33:04 PM (11 years ago)
Author:
landauf
Message:

added proper interface (ObjectListElementRemovalListener) to notify iterators about removed elements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/object/ObjectListBase.cc

    r9597 r9599  
    7070
    7171    /**
    72         @brief Increases all Iterators that currently point on the given element (because it gets removed).
    73         @param object The object that gets removed
     72        @brief Notifies all listeners that the given element is about to get removed.
     73        @param element The element that gets removed
     74        This is mainly used for iterators which point at the removed element
    7475    */
    75     void ObjectListBase::notifyIterators(Listable* object) const
     76    void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const
    7677    {
    77         for (std::vector<void*>::const_iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it)
    78             ((Iterator<Listable>*)(*it))->incrementIfEqual(object);
    79         for (std::vector<void*>::const_iterator it = this->objectListIterators_.begin(); it != this->objectListIterators_.end(); ++it)
    80             ((ObjectListIterator<Listable>*)(*it))->incrementIfEqual(object);
     78        for (std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
     79            (*it)->removedElement(element);
    8180    }
    8281
     
    109108    {
    110109        orxout(verbose, context::object_list) << "Removing Object from " << element->objectBase_->getIdentifier()->getName() << "-list." << endl;
    111         this->notifyIterators(element->objectBase_);
     110        this->notifyRemovalListeners(element);
    112111
    113112        if (element->next_)
Note: See TracChangeset for help on using the changeset viewer.