Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4508 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jun 4, 2005, 2:29:11 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: implemented a better backloop-check in the track-system
also implemented a new function in tList: inList() that returns tru, if a certain element is already in the List and false otherwise

File:
1 edited

Legend:

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

    r4500 r4508  
    110110  int getSize();
    111111  //T* enumerate();
     112  bool inList(T* entity);
    112113  tIterator<T>* getIterator();
    113114  T* nextElement(T* toEntity);
     
    258259}
    259260
     261/**
     262   \brief checks if an entity is in the List
     263   \param entity The entity to check for in the entire List.
     264   \returns true if it is, false otherwise
     265*/
     266template<class T>
     267inline bool tList<T>::inList(T* entity)
     268
     269  // pre checks
     270  if(this->size == 0) return false;
     271  if( entity == NULL) return false;
     272
     273  // search in the List
     274  this->currentEl = this->first;
     275  while(this->currentEl->curr != entity && this->currentEl != NULL)
     276    this->currentEl = this->currentEl->next;
     277
     278  // post checks
     279  if(this->currentEl == NULL)
     280    return false;
     281  else
     282    return true;
     283}
    260284
    261285/**
Note: See TracChangeset for help on using the changeset viewer.