| [4838] | 1 | /*! |
|---|
| [5629] | 2 | * @file object_manager.h |
|---|
| [4838] | 3 | * @brief Definition of the ... singleton Class |
|---|
| [3655] | 4 | */ |
|---|
| 5 | |
|---|
| [5629] | 6 | #ifndef _OBJECT_MANAGER_H |
|---|
| 7 | #define _OBJECT_MANAGER_H |
|---|
| [3655] | 8 | |
|---|
| 9 | #include "base_object.h" |
|---|
| [5682] | 10 | #include <list> |
|---|
| [6089] | 11 | #include <vector> |
|---|
| [3655] | 12 | |
|---|
| [6089] | 13 | /// Enumerator for Managed Object Lists |
|---|
| 14 | typedef enum { |
|---|
| 15 | OM_NULL = 0, |
|---|
| 16 | OM_DEAD, |
|---|
| 17 | OM_ENVIRON_NOTICK, |
|---|
| 18 | OM_ENVIRON, |
|---|
| 19 | OM_COMMON, |
|---|
| [3655] | 20 | |
|---|
| [6089] | 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, |
|---|
| [5682] | 53 | |
|---|
| [6089] | 54 | OM_SIZE, |
|---|
| [5682] | 55 | |
|---|
| 56 | |
|---|
| [6089] | 57 | OM_INIT = -1, //!< DO NOT USE THIS. (WorldEntity Internal). |
|---|
| 58 | } OM_LIST; |
|---|
| [5682] | 59 | |
|---|
| [6089] | 60 | #define OM_DEFAULT_LIST OM_NULL |
|---|
| [5682] | 61 | |
|---|
| [6089] | 62 | |
|---|
| 63 | // FORWARD DECLARATION |
|---|
| 64 | class PNode; |
|---|
| 65 | class WorldEntity; |
|---|
| 66 | |
|---|
| [3655] | 67 | //! A default singleton class. |
|---|
| [5629] | 68 | class ObjectManager : public BaseObject { |
|---|
| [3655] | 69 | |
|---|
| 70 | public: |
|---|
| [5629] | 71 | virtual ~ObjectManager(void); |
|---|
| [4838] | 72 | /** @returns a Pointer to the only object of this Class */ |
|---|
| [6089] | 73 | inline static ObjectManager* getInstance(void) { if (!ObjectManager::singletonRef) ObjectManager::singletonRef = new ObjectManager(); return ObjectManager::singletonRef; } |
|---|
| [3655] | 74 | |
|---|
| [5682] | 75 | |
|---|
| [6089] | 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 | |
|---|
| [5795] | 83 | static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID); |
|---|
| 84 | |
|---|
| [6091] | 85 | void debug(OM_LIST omList) const; |
|---|
| 86 | void debug(const char* listName = NULL); |
|---|
| [5682] | 87 | |
|---|
| [6089] | 88 | static OM_LIST StringToOMList(const char* listName); |
|---|
| [6091] | 89 | static const char* OMListToString(OM_LIST omList); |
|---|
| [6089] | 90 | |
|---|
| [3655] | 91 | private: |
|---|
| [5629] | 92 | ObjectManager(void); |
|---|
| 93 | static ObjectManager* singletonRef; |
|---|
| [5682] | 94 | |
|---|
| [6089] | 95 | const std::list<BaseObject>* pNodeList; |
|---|
| [5682] | 96 | |
|---|
| 97 | |
|---|
| [6089] | 98 | std::list<WorldEntity*> objectLists[OM_SIZE]; |
|---|
| [5795] | 99 | |
|---|
| [3655] | 100 | }; |
|---|
| 101 | |
|---|
| [5629] | 102 | #endif /* _OBJECT_MANAGER_H */ |
|---|