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