Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2007, 2:57:59 AM (12 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/ObjectList.h

    r197 r221  
    1414            OrxonoxClass* object_;
    1515            ObjectListElement* next_;
     16            ObjectListElement* prev_;
    1617    };
    1718
     
    2223            ~ObjectList();
    2324            void add(OrxonoxClass* object);
    24             void remove(OrxonoxClass* object);
     25            void remove(OrxonoxClass* object, bool bIterateForwards = true);
    2526
    2627            ObjectListElement* first_;
     28            ObjectListElement* last_;
    2729    };
    2830}
Note: See TracChangeset for help on using the changeset viewer.