Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2008, 4:25:52 AM (16 years ago)
Author:
landauf
Message:

merged core3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/MetaObjectList.cc

    r1505 r1747  
    3333
    3434#include "MetaObjectList.h"
     35#include "ObjectListBase.h"
     36#include "Identifier.h"
     37#include "util/Debug.h"
    3538
    3639namespace orxonox
    3740{
     41    // ###############################
     42    // ###  MetaObjectListElement  ###
     43    // ###############################
     44    /**
     45        @brief Destructor: Removes the ObjectListBaseElement from the ObjectListBase by linking next_ and prev_ of the ObjectListBaseElement.
     46    */
     47    MetaObjectListElement::~MetaObjectListElement()
     48    {
     49        COUT(5) << "*** MetaObjectList: Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << std::endl;
     50        this->list_->notifyIterators(this->element_->objectBase_);
     51
     52        if (this->element_->next_)
     53            this->element_->next_->prev_ = this->element_->prev_;
     54        else
     55            this->list_->last_ = this->element_->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list
     56
     57        if (this->element_->prev_)
     58            this->element_->prev_->next_ = this->element_->next_;
     59        else
     60            this->list_->first_ = this->element_->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
     61
     62        delete this->element_;
     63    }
     64
     65
     66    // ###############################
     67    // ###     MetaObjectList      ###
     68    // ###############################
    3869    /**
    3970        @brief Constructor: Sets first_ to zero.
     
    4980    MetaObjectList::~MetaObjectList()
    5081    {
    51         BaseMetaObjectListElement* temp;
     82        MetaObjectListElement* temp;
    5283        while (this->first_)
    5384        {
     
    5788        }
    5889    }
     90
     91    /**
     92        @brief Adds an ObjectList and an element of that list to the MetaObjectList.
     93        @param list The ObjectList wherein the element is
     94        @param element The element wherein the object is
     95    */
     96    void MetaObjectList::add(ObjectListBase* list, ObjectListBaseElement* element)
     97    {
     98        MetaObjectListElement* temp = this->first_;
     99        this->first_ = new MetaObjectListElement(list, element);
     100        this->first_->next_ = temp;
     101    }
    59102}
Note: See TracChangeset for help on using the changeset viewer.