Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/OrxonoxClass.h @ 1385

Last change on this file since 1385 was 1062, checked in by rgrieder, 17 years ago
  • changed header file inclusion order
File size: 9.4 KB
RevLine 
[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
[246]45#include "MetaObjectList.h"
[790]46#include "Iterator.h"
[197]47
[162]48namespace orxonox
49{
[790]50    //! The class all objects and interfaces of the game-logic (not the engine) are derived from.
51    /**
[871]52        The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
[790]53        OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList.
54    */
55    class _CoreExport OrxonoxClass
[162]56    {
57        public:
58            OrxonoxClass();
[218]59            virtual ~OrxonoxClass();
[790]60
61            /** @brief Function to collect the SetConfigValue-macro calls. */
62            void setConfigValues() {};
63
[871]64            /** @brief Returns the Identifier of the object. @return The Identifier */
[246]65            inline Identifier* getIdentifier() const { return this->identifier_; }
[790]66
67            /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */
[246]68            inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
[790]69
[871]70            /** @brief Returns the list of all parents of the object. @return The list */
[1052]71            inline std::set<const Identifier*>* getParents() const { return this->parents_; }
[790]72
[871]73            /** @brief Creates the parents-list. */
[1052]74            inline void createParents() { this->parents_ = new std::set<const Identifier*>(); }
[162]75
[871]76            /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */
[790]77            inline MetaObjectList& getMetaList() { return this->metaList_; }
78
79
[871]80            /** @brief Returns true if the objects class is of the given type or a derivative. */
[790]81            inline bool isA(const Identifier* identifier)
82                { return this->getIdentifier()->isA(identifier); }
[871]83            /** @brief Returns true if the objects class is exactly of the given type. */
84            inline bool isExactlyA(const Identifier* identifier)
85                { return this->getIdentifier()->isExactlyA(identifier); }
86            /** @brief Returns true if the objects class is a child of the given type. */
[790]87            inline bool isChildOf(const Identifier* identifier)
88                { return this->getIdentifier()->isChildOf(identifier); }
[871]89            /** @brief Returns true if the objects class is a direct child of the given type. */
90            inline bool isDirectChildOf(const Identifier* identifier)
91                { return this->getIdentifier()->isDirectChildOf(identifier); }
92            /** @brief Returns true if the objects class is a parent of the given type. */
[790]93            inline bool isParentOf(const Identifier* identifier)
94                { return this->getIdentifier()->isParentOf(identifier); }
[871]95            /** @brief Returns true if the objects class is a direct parent of the given type. */
96            inline bool isDirectParentOf(const Identifier* identifier)
97                { return this->getIdentifier()->isDirectParentOf(identifier); }
[790]98
99
[871]100            /** @brief Returns true if the objects class is of the given type or a derivative. */
[790]101            inline bool isA(const SubclassIdentifier<class B>* identifier)
102                { return this->getIdentifier()->isA(identifier->getIdentifier()); }
[871]103            /** @brief Returns true if the objects class is exactly of the given type. */
104            inline bool isExactlyA(const SubclassIdentifier<class B>* identifier)
105                { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); }
106            /** @brief Returns true if the objects class is a child of the given type. */
[790]107            inline bool isChildOf(const SubclassIdentifier<class B>* identifier)
108                { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
[871]109            /** @brief Returns true if the objects class is a direct child of the given type. */
110            inline bool isDirectChildOf(const SubclassIdentifier<class B>* identifier)
111                { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); }
112            /** @brief Returns true if the objects class is a parent of the given type. */
[790]113            inline bool isParentOf(const SubclassIdentifier<class B>* identifier)
114                { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
[871]115            /** @brief Returns true if the objects class is a direct parent of the given type. */
116            inline bool isDirectParentOf(const SubclassIdentifier<class B>* identifier)
117                { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); }
[790]118
119
[871]120            /** @brief Returns true if the objects class is of the given type or a derivative. */
[790]121            inline bool isA(const SubclassIdentifier<class B> identifier)
122                { return this->getIdentifier()->isA(identifier.getIdentifier()); }
[871]123            /** @brief Returns true if the objects class is exactly of the given type. */
124            inline bool isExactlyA(const SubclassIdentifier<class B> identifier)
125                { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); }
126            /** @brief Returns true if the objects class is a child of the given type. */
[790]127            inline bool isChildOf(const SubclassIdentifier<class B> identifier)
128                { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
[871]129            /** @brief Returns true if the objects class is a direct child of the given type. */
130            inline bool isDirectChildOf(const SubclassIdentifier<class B> identifier)
131                { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); }
132            /** @brief Returns true if the objects class is a parent of the given type. */
[790]133            inline bool isParentOf(const SubclassIdentifier<class B> identifier)
134                { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
[871]135            /** @brief Returns true if the objects class is a direct parent of the given type. */
136            inline bool isDirectParentOf(const SubclassIdentifier<class B> identifier)
137                { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); }
[790]138
139
[871]140            /** @brief Returns true if the objects class is of the given type or a derivative. */
[790]141            inline bool isA(const OrxonoxClass* object)
142                { return this->getIdentifier()->isA(object->getIdentifier()); }
[871]143            /** @brief Returns true if the objects class is exactly of the given type. */
144            inline bool isExactlyA(const OrxonoxClass* object)
145                { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
146            /** @brief Returns true if the objects class is a child of the given type. */
[790]147            inline bool isChildOf(const OrxonoxClass* object)
148                { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
[871]149            /** @brief Returns true if the objects class is a direct child of the given type. */
150            inline bool isDirectChildOf(const OrxonoxClass* object)
151                { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
152            /** @brief Returns true if the objects class is a parent of the given type. */
[790]153            inline bool isParentOf(const OrxonoxClass* object)
154                { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
[871]155            /** @brief Returns true if the objects class is a direct child of the given type. */
156            inline bool isDirectParentOf(const OrxonoxClass* object)
157                { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
[790]158
[162]159        private:
[871]160            Identifier* identifier_;                    //!< The Identifier of the object
[1052]161            std::set<const Identifier*>* parents_;     //!< List of all parents of the object
[871]162            MetaObjectList metaList_;                   //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
[162]163    };
164}
165
[790]166#endif /* _OrxonoxClass_H__ */
Note: See TracBrowser for help on using the repository browser.