Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5243 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
Sep 24, 2005, 7:43:08 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now it is possible to get old commands from the List

File:
1 edited

Legend:

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

    r5230 r5243  
    348348    T* seekElement(const T* element);
    349349    T* iteratorElement(const tIterator<T>* iterator);
     350
     351    /** another way to iterate through the list
     352     * !! THIS IS NOT MEANT FOR DELETION
     353     */
     354    T* prevStep();
     355    T* nextStep();
     356    T* getCurrent();
    350357
    351358  private:
     
    514521
    515522
     523/**
     524 *  use it to move through the list without interfering with the iteration
     525 */
     526template<class T>
     527    inline T* tIterator<T>::nextStep ()
     528{
     529  if( unlikely(this->tmpEl == NULL || this->tmpEl->next == NULL))
     530    return NULL;
     531  else
     532  {
     533    this->tmpEl = this->tmpEl->next;
     534    return tmpEl->curr;
     535  }
     536}
     537
     538
     539/**
     540 *  use it to move backwards through the list without interfering with the itereation
     541 * @returns next list element
     542 */
     543template<class T>
     544    inline T* tIterator<T>::prevStep ()
     545{
     546  if( unlikely(this->tmpEl == NULL || this->tmpEl->prev == NULL))
     547    return NULL;
     548  else
     549  {
     550    this->tmpEl = this->tmpEl->prev;
     551    return tmpEl->curr;
     552  }
     553}
     554
     555template<class T>
     556    inline T* tIterator<T>::getCurrent()
     557{
     558  if (likeley(this->tmpEl))
     559    return this->tmpEl->curr;
     560  else
     561    return NULL;
     562}
     563
    516564#endif /* _LIST_H */
Note: See TracChangeset for help on using the changeset viewer.