Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4288 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 26, 2005, 12:38:44 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: implementing the add/get from DeadList functions, resturctured the garbage collector hirarchy

Location:
orxonox/trunk/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/object_manager.cc

    r4287 r4288  
    1111   ### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer: ...
    1413*/
    1514
     
    1716
    1817#include "object_manager.h"
     18#include "garbage_collector.h"
    1919#include "list.h"
    20 #include "world_entity.h"
     20
    2121
    2222using namespace std;
     
    3232  //this->managedObjectList = new BaseObject*[CL_NUMBER];
    3333  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
     34
     35  this->garbageCollector = GarbageCollector::getInstance();
    3436}
    3537
     
    7173
    7274
    73 void ObjectManager::addToDeadList(const char* className, BaseObject* object)
    74 {}
     75void ObjectManager::addToDeadList(classList index, BaseObject* object)
     76{
     77  if( likely(this->managedObjectList[index] != NULL))
     78    this->managedObjectList[index]->add(object);
     79  else
     80    PRINTF(0)(" Error: unable to add object to the list nr. %i, ignoring\n", index);
     81}
    7582
    7683
    77 BaseObject* ObjectManager::getFromDeadList(const char* className, int number)
     84BaseObject* ObjectManager::getFromDeadList(classList index, int number)
    7885{}
    7986
  • orxonox/trunk/src/util/object_manager.h

    r4287 r4288  
    1818#define OM_
    1919
    20 class WorldEntity;
     20#include "class_list.h"
    2121
    2222
    23 //! list of classes able to be loaded via the object manager
    24 struct classListElement
    25 {
    26   char* name;
    27 };
    28 #include "class_list.h"
    29 
     23class WorldEntity;
     24class GarbageCollector;
    3025
    3126
     
    4136 
    4237  void cache(classList index, int number, const BaseObject &copyObject);
    43   void addToDeadList(const char* className, BaseObject* object);
    44   BaseObject* getFromDeadList(const char* className, int number = 1);
     38  void addToDeadList(classList index, BaseObject* object);
     39  BaseObject* getFromDeadList(classList index, int number = 1);
    4540
    4641  void debug();
     
    5247  //BaseObject** managedObjectList;
    5348  tList<BaseObject>** managedObjectList;
     49  GarbageCollector* garbageCollector;
    5450};
    5551
    5652
    57 template<class T> class ManagedObject
    58 {
    59  public:
    60   const char* className;
    61   tList<T>* objectList;
    62 };
    63 
    64 #define createClassFromName(className)
    65 
    6653
    6754#endif /* _OBJECT_MANAGER_H */
Note: See TracChangeset for help on using the changeset viewer.