Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/core/OrxonoxClass.h @ 564

Last change on this file since 564 was 496, checked in by landauf, 16 years ago

added files from objecthierarchy, changed includes

File size: 7.2 KB
RevLine 
[384]1/*!
2    @file OrxonoxClass.h
3    @brief Definition of the OrxonoxClass Class.
4
[496]5    All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
6    It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
[384]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]17namespace orxonox
18{
[496]19    //! The class all objects and interfaces of the game-logic (not the engine) are derived from.
[384]20    /**
[496]21        The BaseObject and Interaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
[384]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();
[384]29
[496]30            void setConfigValues() {};
31
[384]32            /** @returns the Identifier of the object */
[246]33            inline Identifier* getIdentifier() const { return this->identifier_; }
[384]34
35            /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */
[246]36            inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
[384]37
38            /** @returns the list of all parents of the object */
[246]39            inline IdentifierList* getParents() const { return this->parents_; }
[384]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
[384]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
[496]47
48            /** @returns true if the objects class is of the given type or a derivative. */
[384]49            inline bool isA(const Identifier* identifier)
50                { return this->getIdentifier()->isA(identifier); }
[496]51            /** @returns true if the objects class is exactly of the given type. */
[384]52            inline bool isDirectlyA(const Identifier* identifier)
53                { return this->getIdentifier()->isDirectlyA(identifier); }
[496]54            /** @returns true if the objects class is a child of the given type. */
[384]55            inline bool isChildOf(const Identifier* identifier)
56                { return this->getIdentifier()->isChildOf(identifier); }
[496]57            /** @returns true if the objects class is a parent of the given type. */
[384]58            inline bool isParentOf(const Identifier* identifier)
59                { return this->getIdentifier()->isParentOf(identifier); }
60
[496]61
62            /** @returns true if the objects class is of the given type or a derivative. */
[384]63            inline bool isA(const SubclassIdentifier<class B>* identifier)
64                { return this->getIdentifier()->isA(identifier->getIdentifier()); }
[496]65            /** @returns true if the objects class is exactly of the given type. */
[384]66            inline bool isDirectlyA(const SubclassIdentifier<class B>* identifier)
67                { return this->getIdentifier()->isDirectlyA(identifier->getIdentifier()); }
[496]68            /** @returns true if the objects class is a child of the given type. */
[384]69            inline bool isChildOf(const SubclassIdentifier<class B>* identifier)
70                { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
[496]71            /** @returns true if the objects class is a parent of the given type. */
[384]72            inline bool isParentOf(const SubclassIdentifier<class B>* identifier)
73                { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
74
[496]75
76            /** @returns true if the objects class is of the given type or a derivative. */
[384]77            inline bool isA(const SubclassIdentifier<class B> identifier)
78                { return this->getIdentifier()->isA(identifier.getIdentifier()); }
[496]79            /** @returns true if the objects class is exactly of the given type. */
[384]80            inline bool isDirectlyA(const SubclassIdentifier<class B> identifier)
81                { return this->getIdentifier()->isDirectlyA(identifier.getIdentifier()); }
[496]82            /** @returns true if the objects class is a child of the given type. */
[384]83            inline bool isChildOf(const SubclassIdentifier<class B> identifier)
84                { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
[496]85            /** @returns true if the objects class is a parent of the given type. */
[384]86            inline bool isParentOf(const SubclassIdentifier<class B> identifier)
87                { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
88
[496]89
90            /** @returns true if the objects class is of the given type or a derivative. */
[384]91            inline bool isA(const OrxonoxClass* object)
92                { return this->getIdentifier()->isA(object->getIdentifier()); }
[496]93            /** @returns true if the objects class is exactly of the given type. */
[384]94            inline bool isDirectlyA(const OrxonoxClass* object)
95                { return this->getIdentifier()->isDirectlyA(object->getIdentifier()); }
[496]96            /** @returns true if the objects class is a child of the given type. */
[384]97            inline bool isChildOf(const OrxonoxClass* object)
98                { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
[496]99            /** @returns true if the objects class is a parent of the given type. */
[384]100            inline bool isParentOf(const OrxonoxClass* object)
101                { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
102
103
[496]104            /** @brief Sets the name of the object. @param name The name */
105            inline virtual void setName(const std::string& name) { this->name_ = name; }
106
107            /** @returns the name of the object. */
[384]108            inline const std::string& getName() const { return this->name_; }
109
[496]110            /** @brief Sets the state of the objects activity. @param bActive True = active */
111            inline virtual void setActive(bool bActive) { this->bActive_ = bActive; }
112
113            /** @returns the state of the objects activity. */
[384]114            inline const bool isActive() const { return this->bActive_; }
115
[496]116            /** @brief Sets the state of the objects visibility. @param bVisible True = visible */
117            inline virtual void setVisible(bool bVisible) { this->bVisible_ = bVisible; }
118
119            /** @returns the state of the objects visibility. */
[384]120            inline const bool isVisible() const { return this->bVisible_; }
121
[162]122        private:
[384]123            Identifier* identifier_;        //!< The Identifier of the object
124            IdentifierList* parents_;       //!< List of all parents of the object
125            MetaObjectList metaList_;       //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
126
[496]127            std::string name_;              //!< The name of the object
128            bool bActive_;                  //!< True = the object is active
129            bool bVisible_;                 //!< True = the object is visible
[162]130    };
131}
132
133#endif
Note: See TracBrowser for help on using the repository browser.