Orxonox  0.0.5 Codename: Arcturus
ObjectListIterator.h
Go to the documentation of this file.
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 
55 #ifndef _ObjectListIterator_H__
56 #define _ObjectListIterator_H__
57 
58 #include "core/CorePrereqs.h"
59 #include "core/class/Identifier.h"
60 #include "ObjectList.h"
61 #include "IteratorBase.h"
62 
63 namespace orxonox
64 {
70  template <class T>
71  class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T>>
72  {
73  public:
78 
84 
89  template <class OI>
91 
96  inline T* operator*() const
97  {
98  return static_cast<ObjectListElement<T>*>(this->element_)->object_;
99  }
100 
105  inline T* operator->() const
106  {
107  return static_cast<ObjectListElement<T>*>(this->element_)->object_;
108  }
109  };
110 }
111 
112 #endif /* _ObjectListIterator_H__ */
The list-element that actually contains the object.
Definition: CorePrereqs.h:208
ObjectListIterator(ObjectListElement< T > *element)
Constructor: Sets this element to a given element.
Definition: ObjectListIterator.h:83
Shared library macros, enums, constants and forward declarations for the core library ...
Definition of the IteratorBase class, used to iterate through object-lists.
ObjectListBaseElement * element_
The element the Iterator points at.
Definition: IteratorBase.h:219
Declaration of Identifier, definition of ClassIdentifier<T>; used to identify the class of an object...
T * operator->() const
Overloading of the it-> operator: returns the pointer to the object.
Definition: ObjectListIterator.h:105
The Iterator allows to iterate through object lists.
Definition: IteratorBase.h:49
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
T * operator*() const
Overloading of the *it operator: returns the pointer to the object.
Definition: ObjectListIterator.h:96
Definition: InputPrereqs.h:78
Definition of the ObjectList class, a wrapper of ObjectListBase.
ObjectListIterator<T> allows to iterate through the ObjectList of class T.
Definition: CorePrereqs.h:210
ObjectListIterator()
Constructor: Sets the element, whereon the ObjectListIterator points, to zero.
Definition: ObjectListIterator.h:77
ObjectListIterator(const IteratorBase< T, OI > &other)
Constructor: Sets this element to the element of another ObjectListIterator.
Definition: ObjectListIterator.h:90