Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/OrxonoxClass.cc @ 5295

Last change on this file since 5295 was 3280, checked in by rgrieder, 15 years ago

Merged most of the core4 revisions back to the trunk except for:

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