Changeset 4332 in orxonox.OLD for orxonox/branches/physics/src/util/object_manager.h
- Timestamp:
- May 27, 2005, 7:14:55 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/util/object_manager.h
r4301 r4332 8 8 - recycle deleted objects: specific for Projectils since there is a lot of world entity creation/deletion (and this needs a lot of time) 9 9 - control the garbage collector 10 11 TO ADD SUPPORT FOR A CLASS do the following steps: 12 1. include the hader file : #include "class_header.h" 13 2. add the class to the type enum classList {}; in class_list.h 14 3. define a function void mCache( ClassName ) in class ObjectManager 15 10 16 */ 11 17 … … 15 21 16 22 #include "base_object.h" 17 18 # define OM_23 #include "projectile.h" 24 #include "list.h" 19 25 20 26 #include "class_list.h" 21 27 22 28 23 29 class WorldEntity; … … 25 31 26 32 27 template<class T> class tList; 28 template<class T> class ManagedObject; 33 //! This defines the "template" makro function for cache(...) 34 #define mCache( Class ) \ 35 cache(classList index, int number, Class * copyObject) \ 36 { \ 37 this->managedObjectList[index] = new tList<BaseObject>(); \ 38 for(int i = 0; i < number; ++i)\ 39 {\ 40 this->managedObjectList[index]->add(new Class (*copyObject));\ 41 }\ 42 } 43 44 29 45 30 46 //! the object manager itself … … 35 51 virtual ~ObjectManager(void); 36 52 37 void cache(classList index, int number, const BaseObject ©Object);38 void addToDeadList( classList index, BaseObject* object);39 BaseObject* getFromDeadList( classList index, int number = 1);53 void mCache(Projectile); 54 void addToDeadList(int index, BaseObject* object); 55 BaseObject* getFromDeadList(int index, int number = 1); 40 56 41 57 void debug(); … … 43 59 private: 44 60 ObjectManager(void); 61 45 62 static ObjectManager* singletonRef; 46 63 47 //BaseObject** managedObjectList;48 64 tList<BaseObject>** managedObjectList; 49 65 GarbageCollector* garbageCollector;
Note: See TracChangeset
for help on using the changeset viewer.