| [1505] | 1 | /* | 
|---|
 | 2 |  *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
 | 3 |  *                    > www.orxonox.net < | 
|---|
 | 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 |  | 
|---|
 | 29 | /** | 
|---|
 | 30 |     @file OrxonoxClass.cc | 
|---|
 | 31 |     @brief Implementation of the OrxonoxClass Class. | 
|---|
 | 32 | */ | 
|---|
 | 33 |  | 
|---|
 | 34 | #include "OrxonoxClass.h" | 
|---|
 | 35 | #include "MetaObjectList.h" | 
|---|
 | 36 | #include "Identifier.h" | 
|---|
 | 37 |  | 
|---|
 | 38 | namespace orxonox | 
|---|
 | 39 | { | 
|---|
 | 40 |     /** @brief Constructor: Sets the default values. */ | 
|---|
| [1747] | 41 |     OrxonoxClass::OrxonoxClass() | 
|---|
| [1505] | 42 |     { | 
|---|
| [1747] | 43 |         this->identifier_ = 0; | 
|---|
 | 44 |         this->parents_ = 0; | 
|---|
| [1505] | 45 |         this->metaList_ = new MetaObjectList(); | 
|---|
 | 46 |     } | 
|---|
 | 47 |  | 
|---|
 | 48 |     /** @brief Destructor: Deletes, if existing, the list of the parents. */ | 
|---|
 | 49 |     OrxonoxClass::~OrxonoxClass() | 
|---|
 | 50 |     { | 
|---|
 | 51 |         delete this->metaList_; | 
|---|
 | 52 |  | 
|---|
 | 53 |         // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class | 
|---|
 | 54 |         if (this->parents_) | 
|---|
 | 55 |             delete this->parents_; | 
|---|
 | 56 |     } | 
|---|
 | 57 |  | 
|---|
 | 58 |     /** @brief Returns true if the objects class is of the given type or a derivative. */ | 
|---|
 | 59 |     bool OrxonoxClass::isA(const Identifier* identifier) | 
|---|
 | 60 |         { return this->getIdentifier()->isA(identifier); } | 
|---|
 | 61 |     /** @brief Returns true if the objects class is exactly of the given type. */ | 
|---|
 | 62 |     bool OrxonoxClass::isExactlyA(const Identifier* identifier) | 
|---|
 | 63 |         { return this->getIdentifier()->isExactlyA(identifier); } | 
|---|
 | 64 |     /** @brief Returns true if the objects class is a child of the given type. */ | 
|---|
 | 65 |     bool OrxonoxClass::isChildOf(const Identifier* identifier) | 
|---|
 | 66 |         { return this->getIdentifier()->isChildOf(identifier); } | 
|---|
 | 67 |     /** @brief Returns true if the objects class is a direct child of the given type. */ | 
|---|
 | 68 |     bool OrxonoxClass::isDirectChildOf(const Identifier* identifier) | 
|---|
 | 69 |         { return this->getIdentifier()->isDirectChildOf(identifier); } | 
|---|
 | 70 |     /** @brief Returns true if the objects class is a parent of the given type. */ | 
|---|
 | 71 |     bool OrxonoxClass::isParentOf(const Identifier* identifier) | 
|---|
 | 72 |         { return this->getIdentifier()->isParentOf(identifier); } | 
|---|
 | 73 |     /** @brief Returns true if the objects class is a direct parent of the given type. */ | 
|---|
 | 74 |     bool OrxonoxClass::isDirectParentOf(const Identifier* identifier) | 
|---|
 | 75 |         { return this->getIdentifier()->isDirectParentOf(identifier); } | 
|---|
 | 76 |  | 
|---|
 | 77 |  | 
|---|
 | 78 |     /** @brief Returns true if the objects class is of the given type or a derivative. */ | 
|---|
 | 79 |     bool OrxonoxClass::isA(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 80 |         { return this->getIdentifier()->isA(identifier->getIdentifier()); } | 
|---|
 | 81 |     /** @brief Returns true if the objects class is exactly of the given type. */ | 
|---|
 | 82 |     bool OrxonoxClass::isExactlyA(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 83 |         { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); } | 
|---|
 | 84 |     /** @brief Returns true if the objects class is a child of the given type. */ | 
|---|
 | 85 |     bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 86 |         { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); } | 
|---|
 | 87 |     /** @brief Returns true if the objects class is a direct child of the given type. */ | 
|---|
 | 88 |     bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 89 |         { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); } | 
|---|
 | 90 |     /** @brief Returns true if the objects class is a parent of the given type. */ | 
|---|
 | 91 |     bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 92 |         { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); } | 
|---|
 | 93 |     /** @brief Returns true if the objects class is a direct parent of the given type. */ | 
|---|
 | 94 |     bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B>* identifier) | 
|---|
 | 95 |         { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); } | 
|---|
 | 96 |  | 
|---|
 | 97 |  | 
|---|
 | 98 |     /** @brief Returns true if the objects class is of the given type or a derivative. */ | 
|---|
 | 99 |     bool OrxonoxClass::isA(const SubclassIdentifier<class B> identifier) | 
|---|
 | 100 |         { return this->getIdentifier()->isA(identifier.getIdentifier()); } | 
|---|
 | 101 |     /** @brief Returns true if the objects class is exactly of the given type. */ | 
|---|
 | 102 |     bool OrxonoxClass::isExactlyA(const SubclassIdentifier<class B> identifier) | 
|---|
 | 103 |         { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); } | 
|---|
 | 104 |     /** @brief Returns true if the objects class is a child of the given type. */ | 
|---|
 | 105 |     bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B> identifier) | 
|---|
 | 106 |         { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); } | 
|---|
 | 107 |     /** @brief Returns true if the objects class is a direct child of the given type. */ | 
|---|
 | 108 |     bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<class B> identifier) | 
|---|
 | 109 |         { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); } | 
|---|
 | 110 |     /** @brief Returns true if the objects class is a parent of the given type. */ | 
|---|
 | 111 |     bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B> identifier) | 
|---|
 | 112 |         { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); } | 
|---|
 | 113 |     /** @brief Returns true if the objects class is a direct parent of the given type. */ | 
|---|
 | 114 |     bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B> identifier) | 
|---|
 | 115 |         { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); } | 
|---|
 | 116 |  | 
|---|
 | 117 |  | 
|---|
 | 118 |     /** @brief Returns true if the objects class is of the given type or a derivative. */ | 
|---|
 | 119 |     bool OrxonoxClass::isA(const OrxonoxClass* object) | 
|---|
 | 120 |         { return this->getIdentifier()->isA(object->getIdentifier()); } | 
|---|
 | 121 |     /** @brief Returns true if the objects class is exactly of the given type. */ | 
|---|
 | 122 |     bool OrxonoxClass::isExactlyA(const OrxonoxClass* object) | 
|---|
 | 123 |         { return this->getIdentifier()->isExactlyA(object->getIdentifier()); } | 
|---|
 | 124 |     /** @brief Returns true if the objects class is a child of the given type. */ | 
|---|
 | 125 |     bool OrxonoxClass::isChildOf(const OrxonoxClass* object) | 
|---|
 | 126 |         { return this->getIdentifier()->isChildOf(object->getIdentifier()); } | 
|---|
 | 127 |     /** @brief Returns true if the objects class is a direct child of the given type. */ | 
|---|
 | 128 |     bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object) | 
|---|
 | 129 |         { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); } | 
|---|
 | 130 |     /** @brief Returns true if the objects class is a parent of the given type. */ | 
|---|
 | 131 |     bool OrxonoxClass::isParentOf(const OrxonoxClass* object) | 
|---|
 | 132 |         { return this->getIdentifier()->isParentOf(object->getIdentifier()); } | 
|---|
 | 133 |     /** @brief Returns true if the objects class is a direct child of the given type. */ | 
|---|
 | 134 |     bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object) | 
|---|
 | 135 |         { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); } | 
|---|
 | 136 | } | 
|---|