[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. */ |
---|
| 41 | OrxonoxClass::OrxonoxClass() : |
---|
| 42 | identifier_(0), |
---|
| 43 | parents_(0) |
---|
| 44 | { |
---|
| 45 | this->metaList_ = new MetaObjectList(); |
---|
| 46 | |
---|
| 47 | this->setConfigValues(); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /** @brief Destructor: Deletes, if existing, the list of the parents. */ |
---|
| 51 | OrxonoxClass::~OrxonoxClass() |
---|
| 52 | { |
---|
| 53 | delete this->metaList_; |
---|
| 54 | |
---|
| 55 | // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class |
---|
| 56 | if (this->parents_) |
---|
| 57 | delete this->parents_; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** @brief Returns true if the objects class is of the given type or a derivative. */ |
---|
| 61 | bool OrxonoxClass::isA(const Identifier* identifier) |
---|
| 62 | { return this->getIdentifier()->isA(identifier); } |
---|
| 63 | /** @brief Returns true if the objects class is exactly of the given type. */ |
---|
| 64 | bool OrxonoxClass::isExactlyA(const Identifier* identifier) |
---|
| 65 | { return this->getIdentifier()->isExactlyA(identifier); } |
---|
| 66 | /** @brief Returns true if the objects class is a child of the given type. */ |
---|
| 67 | bool OrxonoxClass::isChildOf(const Identifier* identifier) |
---|
| 68 | { return this->getIdentifier()->isChildOf(identifier); } |
---|
| 69 | /** @brief Returns true if the objects class is a direct child of the given type. */ |
---|
| 70 | bool OrxonoxClass::isDirectChildOf(const Identifier* identifier) |
---|
| 71 | { return this->getIdentifier()->isDirectChildOf(identifier); } |
---|
| 72 | /** @brief Returns true if the objects class is a parent of the given type. */ |
---|
| 73 | bool OrxonoxClass::isParentOf(const Identifier* identifier) |
---|
| 74 | { return this->getIdentifier()->isParentOf(identifier); } |
---|
| 75 | /** @brief Returns true if the objects class is a direct parent of the given type. */ |
---|
| 76 | bool OrxonoxClass::isDirectParentOf(const Identifier* identifier) |
---|
| 77 | { return this->getIdentifier()->isDirectParentOf(identifier); } |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | /** @brief Returns true if the objects class is of the given type or a derivative. */ |
---|
| 81 | bool OrxonoxClass::isA(const SubclassIdentifier<class B>* identifier) |
---|
| 82 | { return this->getIdentifier()->isA(identifier->getIdentifier()); } |
---|
| 83 | /** @brief Returns true if the objects class is exactly of the given type. */ |
---|
| 84 | bool OrxonoxClass::isExactlyA(const SubclassIdentifier<class B>* identifier) |
---|
| 85 | { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); } |
---|
| 86 | /** @brief Returns true if the objects class is a child of the given type. */ |
---|
| 87 | bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B>* identifier) |
---|
| 88 | { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); } |
---|
| 89 | /** @brief Returns true if the objects class is a direct child of the given type. */ |
---|
| 90 | bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<class B>* identifier) |
---|
| 91 | { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); } |
---|
| 92 | /** @brief Returns true if the objects class is a parent of the given type. */ |
---|
| 93 | bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B>* identifier) |
---|
| 94 | { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); } |
---|
| 95 | /** @brief Returns true if the objects class is a direct parent of the given type. */ |
---|
| 96 | bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B>* identifier) |
---|
| 97 | { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); } |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | /** @brief Returns true if the objects class is of the given type or a derivative. */ |
---|
| 101 | bool OrxonoxClass::isA(const SubclassIdentifier<class B> identifier) |
---|
| 102 | { return this->getIdentifier()->isA(identifier.getIdentifier()); } |
---|
| 103 | /** @brief Returns true if the objects class is exactly of the given type. */ |
---|
| 104 | bool OrxonoxClass::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. */ |
---|
| 107 | bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B> identifier) |
---|
| 108 | { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); } |
---|
| 109 | /** @brief Returns true if the objects class is a direct child of the given type. */ |
---|
| 110 | bool OrxonoxClass::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. */ |
---|
| 113 | bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B> identifier) |
---|
| 114 | { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); } |
---|
| 115 | /** @brief Returns true if the objects class is a direct parent of the given type. */ |
---|
| 116 | bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B> identifier) |
---|
| 117 | { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); } |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | /** @brief Returns true if the objects class is of the given type or a derivative. */ |
---|
| 121 | bool OrxonoxClass::isA(const OrxonoxClass* object) |
---|
| 122 | { return this->getIdentifier()->isA(object->getIdentifier()); } |
---|
| 123 | /** @brief Returns true if the objects class is exactly of the given type. */ |
---|
| 124 | bool OrxonoxClass::isExactlyA(const OrxonoxClass* object) |
---|
| 125 | { return this->getIdentifier()->isExactlyA(object->getIdentifier()); } |
---|
| 126 | /** @brief Returns true if the objects class is a child of the given type. */ |
---|
| 127 | bool OrxonoxClass::isChildOf(const OrxonoxClass* object) |
---|
| 128 | { return this->getIdentifier()->isChildOf(object->getIdentifier()); } |
---|
| 129 | /** @brief Returns true if the objects class is a direct child of the given type. */ |
---|
| 130 | bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object) |
---|
| 131 | { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); } |
---|
| 132 | /** @brief Returns true if the objects class is a parent of the given type. */ |
---|
| 133 | bool OrxonoxClass::isParentOf(const OrxonoxClass* object) |
---|
| 134 | { return this->getIdentifier()->isParentOf(object->getIdentifier()); } |
---|
| 135 | /** @brief Returns true if the objects class is a direct child of the given type. */ |
---|
| 136 | bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object) |
---|
| 137 | { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); } |
---|
| 138 | } |
---|