Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/util/object_manager.h @ 9703

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

orxonox/new_object_list: fast factory, ObjectManager, and Hud adapted

File size: 3.1 KB
RevLine 
[4838]1/*!
[5629]2 * @file object_manager.h
[6142]3 * @brief Definition of the ObjectManager.
4 */
[3655]5
[5629]6#ifndef _OBJECT_MANAGER_H
7#define _OBJECT_MANAGER_H
[3655]8
9#include "base_object.h"
[5682]10#include <list>
[6142]11#include <vector>
[3655]12
[6142]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,
[7836]20  OM_BACKGROUND,
[6142]21  OM_COMMON,
[3655]22
[8068]23  OM_PLAYERS,
24  OM_PLAYERS_PROJ,
25
[6142]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,
[5682]58
[6142]59  OM_SIZE,
[5682]60
61
[6142]62  OM_INIT             = -1, //!< DO NOT USE THIS. (WorldEntity Internal).
63} OM_LIST;
[5682]64
[6142]65#define OM_DEFAULT_LIST  OM_NULL
[5682]66
[6142]67
68// FORWARD DECLARATION
69class PNode;
70class WorldEntity;
71
72//! A powerfull handler for the Object (WorldEntities) in the World.
[7368]73class ObjectManager : public BaseObject
74{
[9703]75  NewObjectListDeclaration(ObjectManager);
[7368]76public:
77  typedef std::list<WorldEntity*> EntityList;      //!< A type definition to make it easy to use EntityLists.
[3655]78
[7368]79  ObjectManager();
80  virtual ~ObjectManager();
[3655]81
[6142]82  void flush();
[5682]83
[6142]84  void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST);
[7221]85  void toList (WorldEntity* entity, const std::string& omList);
[6142]86
87
[7368]88  /** @returns the List (listnumber) of objects. @param listNumber the List to get. */
[9703]89  EntityList& getEntityList(OM_LIST listNumber) { return this->entityLists[listNumber]; }
[7368]90  /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */
[9703]91  const EntityList& getEntityList(OM_LIST listNumber) const { return this->entityLists[listNumber]; }
[6142]92
[9685]93  template <class T> static void distanceFromObject(EntityList& entities, const PNode& center, float radius, NewObjectList<T>& list);
[5795]94
[6142]95  void debug(OM_LIST omList, unsigned int level = 0) const;
[7221]96  void debug(const std::string& listName = "", unsigned int level = 0);
[5682]97
[7221]98  static OM_LIST StringToOMList(const std::string& listName);
[9656]99  static const std::string& OMListToString(OM_LIST omList);
[6142]100
[7785]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
[7368]111private:
112  const std::list<BaseObject>*            pNodeList;                //!< The List of PNodes.
[5682]113
[9703]114  EntityList                              entityLists[OM_SIZE];     //!< The ObjectLists.
[5682]115
[9656]116  static const std::string                objectManagerListNames[]; //!< Names of all the lists
[7785]117
118  EntityList                              reflectionList;           //!< A list of all reflected objects in the world
[3655]119};
120
[5629]121#endif /* _OBJECT_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.