Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5118 in orxonox.OLD for trunk/src/lib/util/list.h


Ignore:
Timestamp:
Aug 24, 2005, 2:45:46 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: semi-active buffers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/list.h

    r5115 r5118  
    333333
    334334    T* firstElement();
     335    T* lastElement();
    335336    T* nextElement();
     337    T* prevElement();
    336338    T* seekElement(T* element);
    337339    T* iteratorElement(const tIterator<T>* iterator);
     
    375377    inline tIterator<T>::~tIterator ()
    376378{
    377   this->currentEl = NULL;
    378379}
    379380
     
    382383{
    383384  this->currentEl = this->list->first;
    384   if (this->currentEl == NULL)
    385     return NULL;
    386   else
     385  if (this->currentEl != NULL)
    387386    return this->currentEl->curr;
     387  else
     388    return NULL;
     389}
     390
     391template<class T>
     392    inline T* tIterator<T>::lastElement ()
     393{
     394  this->currentEl = this->list->last;
     395  if (this->currentEl != NULL)
     396    return this->currentEl->curr;
     397  else
     398    return NULL;
    388399}
    389400
     
    405416    return NULL;
    406417}
     418
     419/**
     420 *  use it to iterate backwards through the list
     421 * @returns next list element
     422 */
     423template<class T>
     424    inline T* tIterator<T>::prevElement ()
     425{
     426  if( this->currentEl == NULL)
     427    return NULL;
     428
     429  this->currentEl = this->currentEl->prev;
     430  if (this->currentEl != NULL)
     431    return this->currentEl->curr;
     432  else
     433    return NULL;
     434}
     435
    407436
    408437/**
Note: See TracChangeset for help on using the changeset viewer.