Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain.old/src/util/object_manager.h @ 10651

Last change on this file since 10651 was 8068, checked in by patrick, 19 years ago

trunk: merged the network branche back to trunk

File size: 3.1 KB
Line 
1/*!
2 * @file object_manager.h
3 * @brief Definition of the ObjectManager.
4 */
5
6#ifndef _OBJECT_MANAGER_H
7#define _OBJECT_MANAGER_H
8
9#include "base_object.h"
10#include <list>
11#include <vector>
12
13/// Enumerator for Managed Object Lists
14typedef enum {
15  OM_NULL             =  0,
16  OM_DEAD,
17  OM_DEAD_TICK,
18  OM_ENVIRON_NOTICK,
19  OM_ENVIRON,
20  OM_BACKGROUND,
21  OM_COMMON,
22
23  OM_PLAYERS,
24  OM_PLAYERS_PROJ,
25
26  OM_GROUP_00,
27  OM_GROUP_00_PROJ,
28  OM_GROUP_01,
29  OM_GROUP_01_PROJ,
30  OM_GROUP_02,
31  OM_GROUP_02_PROJ,
32  OM_GROUP_03,
33  OM_GROUP_03_PROJ,
34  OM_GROUP_04,
35  OM_GROUP_04_PROJ,
36  OM_GROUP_05,
37  OM_GROUP_05_PROJ,
38  OM_GROUP_06,
39  OM_GROUP_06_PROJ,
40  OM_GROUP_07,
41  OM_GROUP_07_PROJ,
42  OM_GROUP_08,
43  OM_GROUP_08_PROJ,
44  OM_GROUP_09,
45  OM_GROUP_09_PROJ,
46  OM_GROUP_10,
47  OM_GROUP_10_PROJ,
48  OM_GROUP_11,
49  OM_GROUP_11_PROJ,
50  OM_GROUP_12,
51  OM_GROUP_12_PROJ,
52  OM_GROUP_13,
53  OM_GROUP_13_PROJ,
54  OM_GROUP_14,
55  OM_GROUP_14_PROJ,
56  OM_GROUP_15,
57  OM_GROUP_15_PROJ,
58
59  OM_SIZE,
60
61
62  OM_INIT             = -1, //!< DO NOT USE THIS. (WorldEntity Internal).
63} OM_LIST;
64
65#define OM_DEFAULT_LIST  OM_NULL
66
67
68// FORWARD DECLARATION
69class PNode;
70class WorldEntity;
71
72//! A powerfull handler for the Object (WorldEntities) in the World.
73class ObjectManager : public BaseObject
74{
75public:
76  typedef std::list<WorldEntity*> EntityList;      //!< A type definition to make it easy to use EntityLists.
77
78  ObjectManager();
79  virtual ~ObjectManager();
80
81  void flush();
82
83  void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST);
84  void toList (WorldEntity* entity, const std::string& omList);
85
86
87  /** @returns the List (listnumber) of objects. @param listNumber the List to get. */
88  EntityList& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; }
89  /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */
90  const EntityList& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; }
91
92  static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID);
93
94  void debug(OM_LIST omList, unsigned int level = 0) const;
95  void debug(const std::string& listName = "", unsigned int level = 0);
96
97  static OM_LIST StringToOMList(const std::string& listName);
98  static const char* OMListToString(OM_LIST omList);
99
100
101  void toReflectionList( WorldEntity* entity) { this->reflectionList.push_back(entity); }
102  /** @returns the list of all reflected objects in the world */
103  EntityList& getReflectionList() { return this->reflectionList; }
104  /** @returns the static list of all reflected objects in the world */
105  const EntityList& getReflectionList() const { return this->reflectionList; }
106
107
108
109
110private:
111  const std::list<BaseObject>*            pNodeList;                //!< The List of PNodes.
112
113  EntityList                              objectLists[OM_SIZE];     //!< The ObjectLists.
114
115  static const char*                      objectManagerListNames[]; //!< Names of all the lists
116
117  EntityList                              reflectionList;           //!< A list of all reflected objects in the world
118};
119
120#endif /* _OBJECT_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.