Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/object_manager.h @ 4861

Last change on this file since 4861 was 4836, checked in by bensch, 19 years ago

orxonox/trunk: renamed all the \param → @param and so on in Doxygen tags.
Thanks a lot to the kDevelop team. this took since the last commit :)

File size: 2.0 KB
RevLine 
[4591]1/*!
[4245]2    \file object_manager.h
[4836]3  *  this manager will ceep track of the objects  in the world
[4591]4
[4245]5    This is specially designed to:
6    - Give an interface to the world data
7    - separate the world data from the world build,update,draw process
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    - control the garbage collector
[4313]10
11    TO ADD SUPPORT FOR A CLASS do the following steps:
12    1. include the hader file : #include "class_header.h"
[4744]13    2. add the class to the type enum classID {}; in class_id.h
[4313]14    3. define a function void mCache( ClassName ) in class ObjectManager
15
[4245]16*/
17
18
19#ifndef _OBJECT_MANAGER_H
20#define _OBJECT_MANAGER_H
21
22#include "base_object.h"
[4312]23#include "projectile.h"
24#include "list.h"
[4245]25
[4288]26class GarbageCollector;
[4285]27
[4312]28
[4485]29//! This defines the "template" macro function for cache(...)
[4311]30#define mCache( Class ) \
[4591]31 cache(ClassID index, int number, Class * copyObject)        \
[4312]32{                                                              \
33  this->managedObjectList[index] = new tList<BaseObject>(); \
34  for(int i = 0; i < number; ++i)\
35    {\
36      this->managedObjectList[index]->add(new Class (*copyObject));\
37    }\
38}
[4311]39
40
41
[4245]42//! the object manager itself
43class ObjectManager : public BaseObject {
44
45 public:
[4746]46  virtual ~ObjectManager();
[4836]47  /** @returns a Pointer to the only object of this Class */
[4746]48  inline static ObjectManager* getInstance() { if (!singletonRef) singletonRef = new ObjectManager();  return singletonRef; };
[4591]49
[4699]50  void registerClass(ClassID classID);
51
[4485]52  /** a class handled by the objectManage */
[4311]53  void mCache(Projectile);
[4322]54  void addToDeadList(int index, BaseObject* object);
55  BaseObject* getFromDeadList(int index, int number = 1);
[4245]56
[4746]57  void debug() const;
[4287]58
[4245]59 private:
[4746]60  ObjectManager();
[4311]61
[4485]62 private:
63  static ObjectManager*      singletonRef;          //!< The singleton reference to the only reference of this class
[4245]64
[4485]65  tList<BaseObject>**        managedObjectList;     //!< A list of managed objects (handles different types and lists of them)
[4285]66};
[4245]67
68
69
70#endif /* _OBJECT_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.