[790] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1056] | 3 | * > www.orxonox.net < |
---|
[790] | 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Fabian 'x3n' Landau |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[871] | 29 | /** |
---|
[790] | 30 | @file OrxonoxClass.h |
---|
| 31 | @brief Definition of the OrxonoxClass Class. |
---|
| 32 | |
---|
| 33 | All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass. |
---|
| 34 | It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy. |
---|
| 35 | */ |
---|
| 36 | |
---|
[162] | 37 | #ifndef _OrxonoxClass_H__ |
---|
| 38 | #define _OrxonoxClass_H__ |
---|
| 39 | |
---|
[1062] | 40 | #include "CorePrereqs.h" |
---|
| 41 | |
---|
[1052] | 42 | #include <set> |
---|
[790] | 43 | #include <string> |
---|
| 44 | |
---|
[162] | 45 | namespace orxonox |
---|
| 46 | { |
---|
[790] | 47 | //! The class all objects and interfaces of the game-logic (not the engine) are derived from. |
---|
| 48 | /** |
---|
[871] | 49 | The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass. |
---|
[790] | 50 | OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList. |
---|
| 51 | */ |
---|
| 52 | class _CoreExport OrxonoxClass |
---|
[162] | 53 | { |
---|
| 54 | public: |
---|
| 55 | OrxonoxClass(); |
---|
[218] | 56 | virtual ~OrxonoxClass(); |
---|
[790] | 57 | |
---|
| 58 | /** @brief Function to collect the SetConfigValue-macro calls. */ |
---|
| 59 | void setConfigValues() {}; |
---|
| 60 | |
---|
[871] | 61 | /** @brief Returns the Identifier of the object. @return The Identifier */ |
---|
[246] | 62 | inline Identifier* getIdentifier() const { return this->identifier_; } |
---|
[790] | 63 | |
---|
| 64 | /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */ |
---|
[246] | 65 | inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; } |
---|
[790] | 66 | |
---|
[871] | 67 | /** @brief Returns the list of all parents of the object. @return The list */ |
---|
[1052] | 68 | inline std::set<const Identifier*>* getParents() const { return this->parents_; } |
---|
[790] | 69 | |
---|
[871] | 70 | /** @brief Creates the parents-list. */ |
---|
[1052] | 71 | inline void createParents() { this->parents_ = new std::set<const Identifier*>(); } |
---|
[162] | 72 | |
---|
[871] | 73 | /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */ |
---|
[1313] | 74 | inline MetaObjectList& getMetaList() { return (*this->metaList_); } |
---|
[790] | 75 | |
---|
| 76 | |
---|
[1313] | 77 | bool isA(const Identifier* identifier); |
---|
| 78 | bool isExactlyA(const Identifier* identifier); |
---|
| 79 | bool isChildOf(const Identifier* identifier); |
---|
| 80 | bool isDirectChildOf(const Identifier* identifier); |
---|
| 81 | bool isParentOf(const Identifier* identifier); |
---|
| 82 | bool isDirectParentOf(const Identifier* identifier); |
---|
[790] | 83 | |
---|
[1313] | 84 | bool isA(const SubclassIdentifier<class B>* identifier); |
---|
| 85 | bool isExactlyA(const SubclassIdentifier<class B>* identifier); |
---|
| 86 | bool isChildOf(const SubclassIdentifier<class B>* identifier); |
---|
| 87 | bool isDirectChildOf(const SubclassIdentifier<class B>* identifier); |
---|
| 88 | bool isParentOf(const SubclassIdentifier<class B>* identifier); |
---|
| 89 | bool isDirectParentOf(const SubclassIdentifier<class B>* identifier); |
---|
[790] | 90 | |
---|
[1313] | 91 | bool isA(const SubclassIdentifier<class B> identifier); |
---|
| 92 | bool isExactlyA(const SubclassIdentifier<class B> identifier); |
---|
| 93 | bool isChildOf(const SubclassIdentifier<class B> identifier); |
---|
| 94 | bool isDirectChildOf(const SubclassIdentifier<class B> identifier); |
---|
| 95 | bool isParentOf(const SubclassIdentifier<class B> identifier); |
---|
| 96 | bool isDirectParentOf(const SubclassIdentifier<class B> identifier); |
---|
[790] | 97 | |
---|
[1313] | 98 | bool isA(const OrxonoxClass* object); |
---|
| 99 | bool isExactlyA(const OrxonoxClass* object); |
---|
| 100 | bool isChildOf(const OrxonoxClass* object); |
---|
| 101 | bool isDirectChildOf(const OrxonoxClass* object); |
---|
| 102 | bool isParentOf(const OrxonoxClass* object); |
---|
| 103 | bool isDirectParentOf(const OrxonoxClass* object); |
---|
[790] | 104 | |
---|
[162] | 105 | private: |
---|
[1313] | 106 | Identifier* identifier_; //!< The Identifier of the object |
---|
[1052] | 107 | std::set<const Identifier*>* parents_; //!< List of all parents of the object |
---|
[1313] | 108 | MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in |
---|
[162] | 109 | }; |
---|
| 110 | } |
---|
| 111 | |
---|
[790] | 112 | #endif /* _OrxonoxClass_H__ */ |
---|