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/Identifier.h

    r220 r221  
    3535        friend class BaseIdentifier;
    3636
     37        template <class T>
     38        friend class Iterator;
     39
    3740        public:
    3841            void addObject(OrxonoxClass* object);
     
    172175            Identifier::startCreatingHierarchy();
    173176            T* temp = new T();
     177            delete temp;
    174178            Identifier::stopCreatingHierarchy();
    175             delete temp;
    176179        }
    177180
     
    186189            BaseIdentifier();
    187190
    188             BaseIdentifier<B>& operator= (Identifier* identifier)
     191            BaseIdentifier<B>& operator=(Identifier* identifier)
    189192            {
    190193                if (!identifier->isA(ClassIdentifier<B>::getIdentifier()))
     
    199202            }
    200203
    201             Identifier* operator* ()
     204            Identifier* operator*()
    202205            {
    203206                return this->identifier_;
    204207            }
    205208
    206             Identifier* operator-> () const
     209            Identifier* operator->() const
    207210            {
    208211                return this->identifier_;
Note: See TracChangeset for help on using the changeset viewer.