[384] | 1 | /*! |
---|
| 2 | @file OrxonoxClass.h |
---|
| 3 | @brief Definition of the OrxonoxClass Class. |
---|
| 4 | |
---|
| 5 | All objects and interfaces of the game-logic are derived from OrxonoxClass. |
---|
| 6 | It stores the Identifier and the MetaObjectList and has all needed functions to create the class-hierarchy. |
---|
| 7 | */ |
---|
| 8 | |
---|
[162] | 9 | #ifndef _OrxonoxClass_H__ |
---|
| 10 | #define _OrxonoxClass_H__ |
---|
| 11 | |
---|
[219] | 12 | #include "Identifier.h" |
---|
[197] | 13 | #include "IdentifierList.h" |
---|
[246] | 14 | #include "ObjectList.h" |
---|
| 15 | #include "MetaObjectList.h" |
---|
[197] | 16 | |
---|
[474] | 17 | #include "../../tinyxml/tinyxml.h" |
---|
| 18 | |
---|
| 19 | |
---|
[162] | 20 | namespace orxonox |
---|
| 21 | { |
---|
[384] | 22 | //! The class all objects and interfaces of the game-logic are derived from. |
---|
| 23 | /** |
---|
| 24 | BaseObject and Interaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass. |
---|
| 25 | OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList. |
---|
| 26 | */ |
---|
[162] | 27 | class OrxonoxClass |
---|
| 28 | { |
---|
| 29 | public: |
---|
| 30 | OrxonoxClass(); |
---|
[218] | 31 | virtual ~OrxonoxClass(); |
---|
[384] | 32 | |
---|
| 33 | /** @returns the Identifier of the object */ |
---|
[246] | 34 | inline Identifier* getIdentifier() const { return this->identifier_; } |
---|
[384] | 35 | |
---|
| 36 | /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */ |
---|
[246] | 37 | inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; } |
---|
[384] | 38 | |
---|
| 39 | /** @returns the list of all parents of the object */ |
---|
[246] | 40 | inline IdentifierList* getParents() const { return this->parents_; } |
---|
[384] | 41 | |
---|
| 42 | /** @brief Sets the Parents of the object. Used by the RegisterObject-macro. */ |
---|
[246] | 43 | inline void setParents(IdentifierList* parents) { this->parents_ = parents; } |
---|
[162] | 44 | |
---|
[384] | 45 | /** @returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. */ |
---|
| 46 | inline MetaObjectList& getMetaList() { return this->metaList_; } |
---|
| 47 | |
---|
| 48 | inline bool isA(const Identifier* identifier) |
---|
| 49 | { return this->getIdentifier()->isA(identifier); } |
---|
| 50 | inline bool isDirectlyA(const Identifier* identifier) |
---|
| 51 | { return this->getIdentifier()->isDirectlyA(identifier); } |
---|
| 52 | inline bool isChildOf(const Identifier* identifier) |
---|
| 53 | { return this->getIdentifier()->isChildOf(identifier); } |
---|
| 54 | inline bool isParentOf(const Identifier* identifier) |
---|
| 55 | { return this->getIdentifier()->isParentOf(identifier); } |
---|
| 56 | |
---|
| 57 | inline bool isA(const SubclassIdentifier<class B>* identifier) |
---|
| 58 | { return this->getIdentifier()->isA(identifier->getIdentifier()); } |
---|
| 59 | inline bool isDirectlyA(const SubclassIdentifier<class B>* identifier) |
---|
| 60 | { return this->getIdentifier()->isDirectlyA(identifier->getIdentifier()); } |
---|
| 61 | inline bool isChildOf(const SubclassIdentifier<class B>* identifier) |
---|
| 62 | { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); } |
---|
| 63 | inline bool isParentOf(const SubclassIdentifier<class B>* identifier) |
---|
| 64 | { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); } |
---|
| 65 | |
---|
| 66 | inline bool isA(const SubclassIdentifier<class B> identifier) |
---|
| 67 | { return this->getIdentifier()->isA(identifier.getIdentifier()); } |
---|
| 68 | inline bool isDirectlyA(const SubclassIdentifier<class B> identifier) |
---|
| 69 | { return this->getIdentifier()->isDirectlyA(identifier.getIdentifier()); } |
---|
| 70 | inline bool isChildOf(const SubclassIdentifier<class B> identifier) |
---|
| 71 | { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); } |
---|
| 72 | inline bool isParentOf(const SubclassIdentifier<class B> identifier) |
---|
| 73 | { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); } |
---|
| 74 | |
---|
| 75 | inline bool isA(const OrxonoxClass* object) |
---|
| 76 | { return this->getIdentifier()->isA(object->getIdentifier()); } |
---|
| 77 | inline bool isDirectlyA(const OrxonoxClass* object) |
---|
| 78 | { return this->getIdentifier()->isDirectlyA(object->getIdentifier()); } |
---|
| 79 | inline bool isChildOf(const OrxonoxClass* object) |
---|
| 80 | { return this->getIdentifier()->isChildOf(object->getIdentifier()); } |
---|
| 81 | inline bool isParentOf(const OrxonoxClass* object) |
---|
| 82 | { return this->getIdentifier()->isParentOf(object->getIdentifier()); } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | inline void setName(const std::string& name) { this->name_ = name; } |
---|
| 86 | inline const std::string& getName() const { return this->name_; } |
---|
| 87 | |
---|
| 88 | inline void setActive(bool bActive) { this->bActive_ = bActive; } |
---|
| 89 | inline const bool isActive() const { return this->bActive_; } |
---|
| 90 | |
---|
| 91 | inline void setVisible(bool bVisible) { this->bVisible_ = bVisible; } |
---|
| 92 | inline const bool isVisible() const { return this->bVisible_; } |
---|
| 93 | |
---|
[474] | 94 | //virtual void loadParams(TIXMLNode n); |
---|
| 95 | |
---|
[162] | 96 | private: |
---|
[384] | 97 | Identifier* identifier_; //!< The Identifier of the object |
---|
| 98 | IdentifierList* parents_; //!< List of all parents of the object |
---|
| 99 | MetaObjectList metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in |
---|
| 100 | |
---|
| 101 | std::string name_; |
---|
| 102 | bool bActive_; |
---|
| 103 | bool bVisible_; |
---|
[162] | 104 | }; |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | #endif |
---|