Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/objectmanager/src/util/object_manager.h @ 6119

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

orxonox/branches/objectManger: better algorithm for transforming from OM_LIST to string and back (thanks to manuel, who supposed this (much better) version)

File size: 2.4 KB
Line 
1/*!
2 * @file object_manager.h
3 * @brief Definition of the ... singleton Class
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_ENVIRON_NOTICK,
18  OM_ENVIRON,
19  OM_COMMON,
20
21  OM_GROUP_00,
22  OM_GROUP_00_PROJ,
23  OM_GROUP_01,
24  OM_GROUP_01_PROJ,
25  OM_GROUP_02,
26  OM_GROUP_02_PROJ,
27  OM_GROUP_03,
28  OM_GROUP_03_PROJ,
29  OM_GROUP_04,
30  OM_GROUP_04_PROJ,
31  OM_GROUP_05,
32  OM_GROUP_05_PROJ,
33  OM_GROUP_06,
34  OM_GROUP_06_PROJ,
35  OM_GROUP_07,
36  OM_GROUP_07_PROJ,
37  OM_GROUP_08,
38  OM_GROUP_08_PROJ,
39  OM_GROUP_09,
40  OM_GROUP_09_PROJ,
41  OM_GROUP_10,
42  OM_GROUP_10_PROJ,
43  OM_GROUP_11,
44  OM_GROUP_11_PROJ,
45  OM_GROUP_12,
46  OM_GROUP_12_PROJ,
47  OM_GROUP_13,
48  OM_GROUP_13_PROJ,
49  OM_GROUP_14,
50  OM_GROUP_14_PROJ,
51  OM_GROUP_15,
52  OM_GROUP_15_PROJ,
53
54  OM_SIZE,
55
56
57  OM_INIT             = -1, //!< DO NOT USE THIS. (WorldEntity Internal).
58} OM_LIST;
59
60#define OM_DEFAULT_LIST  OM_NULL
61
62
63// FORWARD DECLARATION
64class PNode;
65class WorldEntity;
66
67//! A default singleton class.
68class ObjectManager : public BaseObject {
69
70 public:
71  virtual ~ObjectManager(void);
72  /** @returns a Pointer to the only object of this Class */
73  inline static ObjectManager* getInstance(void) { if (!ObjectManager::singletonRef) ObjectManager::singletonRef = new ObjectManager();  return ObjectManager::singletonRef; }
74
75
76  void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST);
77  void toList (WorldEntity* entity, const char* omList);
78
79
80  std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; }
81  const std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; }
82
83  static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID);
84
85  void debug(OM_LIST omList) const;
86  void debug(const char* listName = NULL);
87
88  static OM_LIST StringToOMList(const char* listName);
89  static const char* OMListToString(OM_LIST omList);
90
91 private:
92  ObjectManager(void);
93  static ObjectManager* singletonRef;
94
95  const std::list<BaseObject>*            pNodeList;
96
97
98  std::list<WorldEntity*>                 objectLists[OM_SIZE];
99
100  static const char*                      objectManagerListNames[]; //!< Names of all the lists
101};
102
103#endif /* _OBJECT_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.