Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/class/Identifiable.cc @ 10109

Last change on this file since 10109 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

  • Property svn:eol-style set to native
File size: 3.9 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/CoreIncludes.h"
38#include "core/object/Context.h"
39#include "Identifier.h"
40
41namespace orxonox
42{
43    RegisterClassNoArgs(Identifiable);
44
45    /**
46        @brief Constructor: Sets the default values.
47    */
48    Identifiable::Identifiable()
49    {
50        this->identifier_ = 0;
51        this->objectPointers_.reserve(6); // Optimisation
52
53        RegisterObject(Identifiable);
54    }
55
56    /// Returns true if the object's class is of the given type or a derivative.
57    bool Identifiable::isA(const Identifier* identifier)
58        { return this->getIdentifier()->isA(identifier); }
59    /// Returns true if the object's class is exactly of the given type.
60    bool Identifiable::isExactlyA(const Identifier* identifier)
61        { return this->getIdentifier()->isExactlyA(identifier); }
62    /// Returns true if the object's class is a child of the given type.
63    bool Identifiable::isChildOf(const Identifier* identifier)
64        { return this->getIdentifier()->isChildOf(identifier); }
65    /// Returns true if the object's class is a direct child of the given type.
66    bool Identifiable::isDirectChildOf(const Identifier* identifier)
67        { return this->getIdentifier()->isDirectChildOf(identifier); }
68    /// Returns true if the object's class is a parent of the given type.
69    bool Identifiable::isParentOf(const Identifier* identifier)
70        { return this->getIdentifier()->isParentOf(identifier); }
71    /// Returns true if the object's class is a direct parent of the given type.
72    bool Identifiable::isDirectParentOf(const Identifier* identifier)
73        { return this->getIdentifier()->isDirectParentOf(identifier); }
74
75
76    /// Returns true if the object's class is of the given type or a derivative.
77    bool Identifiable::isA(const Identifiable* object)
78        { return this->getIdentifier()->isA(object->getIdentifier()); }
79    /// Returns true if the object's class is exactly of the given type.
80    bool Identifiable::isExactlyA(const Identifiable* object)
81        { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
82    /// Returns true if the object's class is a child of the given type.
83    bool Identifiable::isChildOf(const Identifiable* object)
84        { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
85    /// Returns true if the object's class is a direct child of the given type.
86    bool Identifiable::isDirectChildOf(const Identifiable* object)
87        { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
88    /// Returns true if the object's class is a parent of the given type.
89    bool Identifiable::isParentOf(const Identifiable* object)
90        { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
91    /// Returns true if the object's class is a direct child of the given type.
92    bool Identifiable::isDirectParentOf(const Identifiable* object)
93        { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
94}
Note: See TracBrowser for help on using the repository browser.