Last change
on this file since 4285 was
4285,
checked in by patrick, 19 years ago
|
orxonox/trunk: started implementing objectmanager - this will be some hard work…
|
File size:
1.3 KB
|
Line | |
---|
1 | /*! |
---|
2 | \file object_manager.h |
---|
3 | \brief this manager will ceep track of the objects in the world |
---|
4 | |
---|
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 |
---|
10 | */ |
---|
11 | |
---|
12 | |
---|
13 | #ifndef _OBJECT_MANAGER_H |
---|
14 | #define _OBJECT_MANAGER_H |
---|
15 | |
---|
16 | #include "base_object.h" |
---|
17 | |
---|
18 | #define OM_ |
---|
19 | |
---|
20 | class WorldEntity; |
---|
21 | |
---|
22 | |
---|
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 | |
---|
30 | |
---|
31 | |
---|
32 | template<class T> class tList; |
---|
33 | template<class T> class ManagedObject; |
---|
34 | |
---|
35 | //! the object manager itself |
---|
36 | class ObjectManager : public BaseObject { |
---|
37 | |
---|
38 | public: |
---|
39 | static ObjectManager* getInstance(void); |
---|
40 | virtual ~ObjectManager(void); |
---|
41 | |
---|
42 | void cache(classList index, int number); |
---|
43 | void addToDeadList(const char* className, BaseObject* object); |
---|
44 | BaseObject* getFromDeadList(const char* className, int number = 1); |
---|
45 | |
---|
46 | private: |
---|
47 | ObjectManager(void); |
---|
48 | static ObjectManager* singletonRef; |
---|
49 | |
---|
50 | BaseObject** managedObjectList; |
---|
51 | }; |
---|
52 | |
---|
53 | |
---|
54 | template<class T> class ManagedObject |
---|
55 | { |
---|
56 | public: |
---|
57 | const char* className; |
---|
58 | tList<T>* objectList; |
---|
59 | }; |
---|
60 | |
---|
61 | #define createClassFromName(className) |
---|
62 | |
---|
63 | |
---|
64 | #endif /* _OBJECT_MANAGER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.