/*! * @file object_manager.h * @brief Definition of the ObjectManager. */ #ifndef _OBJECT_MANAGER_H #define _OBJECT_MANAGER_H #include "base_object.h" #include #include /// Enumerator for Managed Object Lists typedef enum { OM_NULL = 0, OM_DEAD, OM_DEAD_TICK, OM_ENVIRON_NOTICK, OM_ENVIRON, OM_BACKGROUND, OM_COMMON, OM_PLAYERS, OM_PLAYERS_PROJ, OM_GROUP_00, OM_GROUP_00_PROJ, OM_GROUP_01, OM_GROUP_01_PROJ, OM_GROUP_02, OM_GROUP_02_PROJ, OM_GROUP_03, OM_GROUP_03_PROJ, OM_GROUP_04, OM_GROUP_04_PROJ, OM_GROUP_05, OM_GROUP_05_PROJ, OM_GROUP_06, OM_GROUP_06_PROJ, OM_GROUP_07, OM_GROUP_07_PROJ, OM_GROUP_08, OM_GROUP_08_PROJ, OM_GROUP_09, OM_GROUP_09_PROJ, OM_GROUP_10, OM_GROUP_10_PROJ, OM_GROUP_11, OM_GROUP_11_PROJ, OM_GROUP_12, OM_GROUP_12_PROJ, OM_GROUP_13, OM_GROUP_13_PROJ, OM_GROUP_14, OM_GROUP_14_PROJ, OM_GROUP_15, OM_GROUP_15_PROJ, OM_SIZE, OM_INIT = -1, //!< DO NOT USE THIS. (WorldEntity Internal). } OM_LIST; #define OM_DEFAULT_LIST OM_NULL // FORWARD DECLARATION class PNode; class WorldEntity; //! A powerfull handler for the Object (WorldEntities) in the World. class ObjectManager : public BaseObject { ObjectListDeclaration(ObjectManager); public: typedef std::list EntityList; //!< A type definition to make it easy to use EntityLists. ObjectManager(); virtual ~ObjectManager(); void flush(); void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST); void toList (WorldEntity* entity, const std::string& omList); /** @returns the List (listnumber) of objects. @param listNumber the List to get. */ EntityList& getEntityList(OM_LIST listNumber) { return this->entityLists[listNumber]; } /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */ const EntityList& getEntityList(OM_LIST listNumber) const { return this->entityLists[listNumber]; } template static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ObjectList& list); void debug(OM_LIST omList, unsigned int level = 0) const; void debug(const std::string& listName = "", unsigned int level = 0); static OM_LIST StringToOMList(const std::string& listName); static const std::string& OMListToString(OM_LIST omList); void toReflectionList( WorldEntity* entity) { this->reflectionList.push_back(entity); } /** @returns the list of all reflected objects in the world */ EntityList& getReflectionList() { return this->reflectionList; } /** @returns the static list of all reflected objects in the world */ const EntityList& getReflectionList() const { return this->reflectionList; } private: const std::list* pNodeList; //!< The List of PNodes. EntityList entityLists[OM_SIZE]; //!< The ObjectLists. static const std::string objectManagerListNames[]; //!< Names of all the lists EntityList reflectionList; //!< A list of all reflected objects in the world }; #endif /* _OBJECT_MANAGER_H */