Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 10, 2005, 1:50:37 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: PNode debug info much better now (recursive)

File:
1 edited

Legend:

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

    r4508 r4574  
    1414
    1515
    16 //! a list element of the tList, 
     16//! a list element of the tList,
    1717template<class T> struct listElement
    1818{
     
    3232  tIterator(listElement<T>* startElement);
    3333  ~tIterator();
    34  
     34
    3535  T* nextElement();
    3636
     
    4545   \param startElement:  the first list element from the tList
    4646
    47    normaly you will use it like this: 
     47   normaly you will use it like this:
    4848
    4949   tIterator<char>* nameIterator = nameList->getIterator();
    50    char name* = nameIterator->nextElement(); 
     50   char name* = nameIterator->nextElement();
    5151   while( name != NULL)
    5252   {
    5353     PRINTF(3)("found name: %s in list\n", name);
    54      name = nameIterator->nextElement(); 
     54     name = nameIterator->nextElement();
    5555   }
    56    delete nameIterator;       
    57 */
    58 template<class T>
    59 inline tIterator<T>::tIterator (listElement<T>* startElement) 
     56   delete nameIterator;
     57*/
     58template<class T>
     59inline tIterator<T>::tIterator (listElement<T>* startElement)
    6060{
    6161  this->currentEl = startElement;
     
    9696   you will use this as a generic list for all type of objects
    9797*/
    98 template<class T> class tList 
     98template<class T> class tList
    9999{
    100100 public:
     
    127127*/
    128128template<class T>
    129 inline tList<T>::tList () 
     129inline tList<T>::tList ()
    130130{
    131131  this->first = NULL;
     
    138138   \brief the deconstructor
    139139
    140    this will delete only the list. ATTENTION: the list is deleted, but the objects in the list will 
     140   this will delete only the list. ATTENTION: the list is deleted, but the objects in the list will
    141141   not be deleted
    142142*/
    143143template<class T>
    144 inline tList<T>::~tList () 
     144inline tList<T>::~tList ()
    145145{
    146146  this->currentEl = this->first;
     
    191191    {
    192192      if( unlikely(this->currentEl->curr == entity))
    193         {
    194           if( unlikely(this->currentEl->prev  == NULL)) this->first = this->currentEl->next;
    195           else this->currentEl->prev->next = this->currentEl->next;
    196 
    197           if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev;
    198           else this->currentEl->next->prev = this->currentEl->prev;
    199 
    200           delete this->currentEl;
    201           this->size--;
    202           return;
    203         }
     193        {
     194          if( unlikely(this->currentEl->prev  == NULL)) this->first = this->currentEl->next;
     195          else this->currentEl->prev->next = this->currentEl->next;
     196
     197          if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev;
     198          else this->currentEl->next->prev = this->currentEl->prev;
     199
     200          delete this->currentEl;
     201          this->size--;
     202          return;
     203        }
    204204      this->currentEl = this->currentEl->next;
    205205    }
     
    266266template<class T>
    267267inline bool tList<T>::inList(T* entity)
    268 { 
     268{
    269269  // pre checks
    270270  if(this->size == 0) return false;
     
    277277
    278278  // post checks
    279   if(this->currentEl == NULL) 
     279  if(this->currentEl == NULL)
    280280    return false;
    281281  else
Note: See TracChangeset for help on using the changeset viewer.