Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core6/src/libraries/core/class/Identifiable.cc @ 9634

Last change on this file since 9634 was 9574, checked in by landauf, 11 years ago

cleanup

  • Property svn:eol-style set to native
File size: 4.2 KB
Line 
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
31    @brief Implementation of Identifiable.
32*/
33
34#include "Identifiable.h"
35
36#include <cassert>
37#include "core/object/Context.h"
38#include "Identifier.h"
39
40namespace orxonox
41{
42    /**
43        @brief Constructor: Sets the default values.
44    */
45    Identifiable::Identifiable()
46    {
47        this->identifier_ = 0;
48        this->parents_ = 0;
49        // Optimisation
50        this->objectPointers_.reserve(6);
51    }
52
53    /**
54        @brief Destructor: Removes the object from the object-lists
55    */
56    Identifiable::~Identifiable()
57    {
58        // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
59        if (this->parents_)
60            delete this->parents_;
61    }
62
63    /// Returns true if the object's class is of the given type or a derivative.
64    bool Identifiable::isA(const Identifier* identifier)
65        { return this->getIdentifier()->isA(identifier); }
66    /// Returns true if the object's class is exactly of the given type.
67    bool Identifiable::isExactlyA(const Identifier* identifier)
68        { return this->getIdentifier()->isExactlyA(identifier); }
69    /// Returns true if the object's class is a child of the given type.
70    bool Identifiable::isChildOf(const Identifier* identifier)
71        { return this->getIdentifier()->isChildOf(identifier); }
72    /// Returns true if the object's class is a direct child of the given type.
73    bool Identifiable::isDirectChildOf(const Identifier* identifier)
74        { return this->getIdentifier()->isDirectChildOf(identifier); }
75    /// Returns true if the object's class is a parent of the given type.
76    bool Identifiable::isParentOf(const Identifier* identifier)
77        { return this->getIdentifier()->isParentOf(identifier); }
78    /// Returns true if the object's class is a direct parent of the given type.
79    bool Identifiable::isDirectParentOf(const Identifier* identifier)
80        { return this->getIdentifier()->isDirectParentOf(identifier); }
81
82
83    /// Returns true if the object's class is of the given type or a derivative.
84    bool Identifiable::isA(const Identifiable* object)
85        { return this->getIdentifier()->isA(object->getIdentifier()); }
86    /// Returns true if the object's class is exactly of the given type.
87    bool Identifiable::isExactlyA(const Identifiable* object)
88        { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
89    /// Returns true if the object's class is a child of the given type.
90    bool Identifiable::isChildOf(const Identifiable* object)
91        { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
92    /// Returns true if the object's class is a direct child of the given type.
93    bool Identifiable::isDirectChildOf(const Identifiable* object)
94        { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
95    /// Returns true if the object's class is a parent of the given type.
96    bool Identifiable::isParentOf(const Identifiable* object)
97        { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
98    /// Returns true if the object's class is a direct child of the given type.
99    bool Identifiable::isDirectParentOf(const Identifiable* object)
100        { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
101}
Note: See TracBrowser for help on using the repository browser.