Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2005, 7:14:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the trunk back to the physics-branche
merged with command:
svn merge -r 4301:HEAD trunk/ branches/physics/
little conflict in particle-system resolved easily

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/util/object_manager.cc

    r4301 r4332  
    2828ObjectManager::ObjectManager ()
    2929{
    30   this->setClassName ("ObjectManager");
     30  this->setClassID(CL_OBJECT_MANAGER, "ObjectManager");
    3131 
    32   //this->managedObjectList = new BaseObject*[CL_NUMBER];
    3332  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
     33  for(int i = 0; i < CL_NUMBER; ++i)
     34    {
     35      this->managedObjectList[i] = NULL;
     36    }
    3437
    3538  this->garbageCollector = GarbageCollector::getInstance();
    3639}
     40
    3741
    3842/**
     
    6266
    6367
    64 void ObjectManager::cache(classList index, int number, const BaseObject &copyObject)
    65 {
    66   //this->managedObjectList[index] = new BaseObject[number];
    67   this->managedObjectList[index] = new tList<BaseObject>();
    68   for(int i = 0; i < number; ++i)
    69     {
    70       this->managedObjectList[index]->add(new BaseObject(copyObject));
    71     }
    72 }
    73 
    74 
    75 void ObjectManager::addToDeadList(classList index, BaseObject* object)
     68void ObjectManager::addToDeadList(int index, BaseObject* object)
    7669{
    7770  if( likely(this->managedObjectList[index] != NULL))
    7871    this->managedObjectList[index]->add(object);
    7972  else
    80     PRINTF(0)(" Error: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
     73    PRINTF(0)(" Critical: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
    8174}
    8275
    8376
    84 BaseObject* ObjectManager::getFromDeadList(classList index, int number)
     77BaseObject* ObjectManager::getFromDeadList(int index, int number)
    8578{
    8679  if( likely(this->managedObjectList[index] != NULL))
     
    8881      BaseObject* obj = this->managedObjectList[index]->firstElement();
    8982      this->managedObjectList[index]->remove(obj);
     83      if( unlikely(obj == NULL))
     84        {
     85          PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n");
     86        }
    9087      return obj;
    9188    }
    9289  else
    93     PRINTF(0)(" Error: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
     90    PRINTF(0)(" Critical: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
     91  return NULL;
    9492}
    9593
     
    102100  for(int i = 0; i < CL_NUMBER; ++i)
    103101    {
    104       if(this->managedObjectList[i] != NULL)
     102      if( this->managedObjectList[i] != NULL)
    105103        PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
    106104      else
Note: See TracChangeset for help on using the changeset viewer.