Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2007, 2:57:59 AM (16 years ago)
Author:
landauf
Message:
  • made ObjectList double-linked to allow forward- and backward-iterating. its now a LI(F/L)O list.
  • added an iterator to iterate through object-lists. you can iterate forwards and backwards.

iterating forwards is easy: you get "0 1 2 … last"
iterating backwards is a bit tricky: you still get "0" first, but then "last … 2 1".
thats caused by the structure of the for-loop: you get the first element before the iterator knows if you'll increase or decrease it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchie/src/Identifier.cc

    r220 r221  
    8484    void Identifier::removeObject(OrxonoxClass* object)
    8585    {
    86         std::cout << "*** Removed object from " << this->name_ << "-list.\n";
    87         this->objects_.remove(object);
     86        bool bIterateForwards = !Identifier::isCreatingHierarchy();
     87
     88        if (bIterateForwards)
     89            std::cout << "*** Removed object from " << this->name_ << "-list, iterating forwards.\n";
     90        else
     91            std::cout << "*** Removed object from " << this->name_ << "-list, iterating backwards.\n";
     92
     93        this->objects_.remove(object, bIterateForwards);
    8894
    8995        IdentifierListElement* temp = this->directParents_.first_;
Note: See TracChangeset for help on using the changeset viewer.