Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/test/src/util/object_manager.h @ 10616

Last change on this file since 10616 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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{
75  ObjectListDeclaration(ObjectManager);
76public:
77  typedef std::list<WorldEntity*> EntityList;      //!< A type definition to make it easy to use EntityLists.
78
79  ObjectManager();
80  virtual ~ObjectManager();
81
82  void flush();
83
84  void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST);
85  void toList (WorldEntity* entity, const std::string& omList);
86
87
88  /** @returns the List (listnumber) of objects. @param listNumber the List to get. */
89  EntityList& getEntityList(OM_LIST listNumber) { return this->entityLists[listNumber]; }
90  /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */
91  const EntityList& getEntityList(OM_LIST listNumber) const { return this->entityLists[listNumber]; }
92
93  template <class T> static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ObjectList<T>& list);
94
95  void debug(OM_LIST omList, unsigned int level = 0) const;
96  void debug(const std::string& listName = "", unsigned int level = 0);
97
98  static OM_LIST StringToOMList(const std::string& listName);
99  static const std::string& OMListToString(OM_LIST omList);
100
101
102  void toReflectionList( WorldEntity* entity) { this->reflectionList.push_back(entity); }
103  /** @returns the list of all reflected objects in the world */
104  EntityList& getReflectionList() { return this->reflectionList; }
105  /** @returns the static list of all reflected objects in the world */
106  const EntityList& getReflectionList() const { return this->reflectionList; }
107
108
109
110
111private:
112  const std::list<BaseObject>*            pNodeList;                //!< The List of PNodes.
113
114  EntityList                              entityLists[OM_SIZE];     //!< The ObjectLists.
115
116  static const std::string                objectManagerListNames[]; //!< Names of all the lists
117
118  EntityList                              reflectionList;           //!< A list of all reflected objects in the world
119};
120
121#endif /* _OBJECT_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.