Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 27, 2013, 11:17:45 PM (11 years ago)
Author:
landauf
Message:

moved logic to remove an element from an ObjectListBase from MetaObjectList to ObjectListBase

File:
1 edited

Legend:

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

    r9573 r9593  
    3636#include <set>
    3737#include "Iterator.h"
     38#include "Listable.h"
    3839#include "ObjectListIterator.h"
    3940
     
    4344        @brief Constructor: Sets default values.
    4445    */
    45     ObjectListBase::ObjectListBase(Identifier* identifier)
     46    ObjectListBase::ObjectListBase()
    4647    {
    47         this->identifier_ = identifier;
    4848        this->first_ = 0;
    4949        this->last_ = 0;
     
    8181        @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object
    8282    */
    83     ObjectListBaseElement* ObjectListBase::add(ObjectListBaseElement* element)
     83    ObjectListBaseElement* ObjectListBase::addElement(ObjectListBaseElement* element)
    8484    {
    8585        if (!this->last_)
     
    100100        return this->last_;
    101101    }
     102
     103    void ObjectListBase::removeElement(ObjectListBaseElement* element)
     104    {
     105        orxout(verbose, context::object_list) << "Removing Object from " << element->objectBase_->getIdentifier()->getName() << "-list." << endl;
     106        this->notifyIterators(element->objectBase_);
     107
     108        if (element->next_)
     109            element->next_->prev_ = element->prev_;
     110        else
     111            this->last_ = element->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list
     112
     113        if (element->prev_)
     114            element->prev_->next_ = element->next_;
     115        else
     116            this->first_ = element->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
     117    }
    102118}
Note: See TracChangeset for help on using the changeset viewer.