Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3669 in orxonox.OLD


Ignore:
Timestamp:
Mar 30, 2005, 12:06:36 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now garbage collection is working correctlymake

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/garbage_collector.cc

    r3668 r3669  
    116116    return;
    117117  /* garbage collect */
    118   PRINTF(3)("GarbageCollection is been done\n");
     118  PRINTF(3)("=============================\n");
     119  PRINTF(3)("Processing Garbage Collection\n");
     120  PRINTF(3)("=============================\n");
     121  int counter = 0;
    119122  WorldInterface* wi = WorldInterface::getInstance();
    120123  tList<WorldEntity>* list = wi->getEntityList();
     
    126129      if( entity->isFinalized())
    127130        {
    128           PRINTF(1)("Finalizing object in list - not yet done realy\n");
     131          PRINTF(4)("= finalizing object\n");
     132          ++counter;
    129133         
    130134          /* first remove out of entity list */
    131135          list->remove(entity);
    132136          /* second remove out of pnode tree */
    133           //entity->remove();
    134           //delete entity;
     137          entity->remove();
     138          delete entity;
    135139        }
    136140      entity = iterator->nextElement();
    137141    }
     142  PRINTF(3)("= collected %i unused objects\n", counter);
     143  PRINTF(3)("=============================\n");
    138144 
     145 
     146
     147
    139148  /* reset time to count again up to this->delay */
    140149  this->time = 0;
  • orxonox/trunk/src/lib/coord/null_parent.cc

    r3644 r3669  
    8383  *this->absCoordinate = *this->relCoordinate;
    8484  *this->absDirection = parent->getAbsDir () * *this->relDirection;
    85  
    86   PNode* pn = this->children->enumerate ();
     85
     86  tIterator<PNode>* iterator = this->children->getIterator();
     87  //PNode* pn = this->children->enumerate ();
     88  PNode* pn = iterator->nextElement();
    8789  while( pn != NULL)
    8890    {
     
    9395        pn->parentDirChanged ();
    9496      pn->update (dt);
    95       pn = this->children->nextElement ();
     97      //pn = this->children->nextElement ();
     98      pn = iterator->nextElement();
    9699    }
    97100
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3668 r3669  
    354354{
    355355  pNode->remove();
    356   //this->children->remove (pNode);
     356  this->children->remove (pNode);
    357357  pNode->parent = NULL;
    358358}
     
    378378    }
    379379  delete iterator;
    380   //this->parent->removeChild(this);
     380  this->parent->children->remove(this);
    381381}
    382382
     
    499499 
    500500 
    501   PNode* pn = this->children->enumerate();
     501  tIterator<PNode>* iterator = this->children->getIterator();
     502  //PNode* pn = this->children->enumerate();
     503  PNode* pn = iterator->nextElement();
    502504  while( pn != NULL)
    503505    {
     
    509511
    510512      pn->update(dt);
    511       pn = this->children->nextElement();
    512     }
     513      //pn = this->children->nextElement();
     514      pn = iterator->nextElement();
     515    }
     516  delete iterator;
    513517
    514518  this->timeStamp = timeStamp;
  • orxonox/trunk/src/lib/util/list.h

    r3668 r3669  
    6565 private:
    6666  listElement<T>* currentEl;
    67   listElement<T>* firstEl;
    68   int counter;
     67  listElement<T>* tmpEl;
    6968};
    7069
     
    7473{
    7574  this->currentEl = startElement;
    76   this->firstEl = startElement;
    77   if( this->firstEl != NULL)
    78     this->counter = -1; 
    79   else
    80     this->counter = 0;
     75  this->tmpEl = NULL;
    8176}
    8277
     
    9287inline T* tIterator<T>::nextElement ()
    9388{
    94   /*
    95   this->counter++;
    96   if( this->counter == 0)
    97     return this->firstEl->curr;
    98   */
    99 
    10089  if( this->currentEl == NULL)
    10190    return NULL;
    10291
    103   listElement<T>* tmp = this->currentEl;
     92  this->tmpEl = this->currentEl;
    10493  this->currentEl = this->currentEl->next;
    105   return tmp->curr;
     94  return this->tmpEl->curr;
    10695}
    10796
Note: See TracChangeset for help on using the changeset viewer.