Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | List of all members
orxonox::Iterator< T > Class Template Reference

The Iterator allows to iterate through a given ObjectList. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/CorePrereqs.h>

Inheritance diagram for orxonox::Iterator< T >:
orxonox::IteratorBase< T, Iterator< T > > orxonox::ObjectListElementRemovalListener

Public Member Functions

 Iterator ()
 Constructor: Sets the element, whereon the iterator points, to zero. More...
 
template<class OT , class OI >
 Iterator (const IteratorBase< OT, OI > &other)
 Constructor: Sets this element to the element of another Iterator. More...
 
T * operator* () const
 Overloading of the *it operator: returns the pointer to the object. More...
 
T * operator-> () const
 Overloading of the it-> operator: returns the pointer to the object. More...
 
Iterator< T > & operator= (ObjectListBaseElement *element)
 Assigns a given element. More...
 
- Public Member Functions inherited from orxonox::IteratorBase< T, Iterator< T > >
 IteratorBase (ObjectListElement< T > *element=nullptr)
 Constructor: Sets the element, whereon the iterator points, to the given element. More...
 
 IteratorBase (const IteratorBase< OT, OI > &other)
 Constructor: Sets the element, whereon the iterator points, to the given element of another type. More...
 
 ~IteratorBase ()
 Unregisters the Iterator from the ObjectList. More...
 
ObjectListBaseElementgetElement () const
 
 operator bool () const
 Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object. More...
 
bool operator!= (const IteratorBase< T, Iterator< T > > &compare) const
 Overloading of the != operator to compare with another Iterator. More...
 
const IteratorBase< T, Iterator< T > > & operator++ ()
 Overloading of the ++it operator: Iterator points to the next object in the list. More...
 
Iterator< T > operator++ (int)
 Overloading of the it++ operator: Iterator points to the next object in the list. More...
 
const IteratorBase< T, Iterator< T > > & operator-- ()
 Overloading of the –it operator: Iterator points to the previous object in the list. More...
 
Iterator< T > operator-- (int i)
 Overloading of the it– operator: Iterator points to the previous object in the list. More...
 
IteratorBase< T, Iterator< T > > & operator= (ObjectListElement< T > *element)
 Assigns a given element. More...
 
IteratorBase< T, Iterator< T > > & operator= (const IteratorBase< T, Iterator< T > > &other)
 Assigns the element of another Iterator. More...
 
bool operator== (const IteratorBase< T, Iterator< T > > &compare) const
 Overloading of the == operator to compare with another Iterator. More...
 
virtual void removedElement (ObjectListBaseElement *element) override
 Increments the Iterator if it points at the given element. More...
 
- Public Member Functions inherited from orxonox::ObjectListElementRemovalListener
 ObjectListElementRemovalListener ()=default
 
virtual ~ObjectListElementRemovalListener ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from orxonox::IteratorBase< T, Iterator< T > >
void registerIterator ()
 Registers the Iterator at the list to which it belongs. More...
 
void setElement (ObjectListBaseElement *element)
 
void unregisterIterator ()
 Unregisters the Iterator from the list (if any) More...
 
- Protected Attributes inherited from orxonox::IteratorBase< T, Iterator< T > >
ObjectListBaseElementelement_
 The element the Iterator points at. More...
 
ObjectListBaselist_
 The list in which the Iterator registered itself. More...
 

Detailed Description

template<class T>
class orxonox::Iterator< T >

The Iterator allows to iterate through a given ObjectList.

Independent of the object-list's type, the objects in the list are always casted to T using dynamic_cast.

See also
See Iterator.h for more information an example.

Constructor & Destructor Documentation

template<class T>
orxonox::Iterator< T >::Iterator ( )
inline

Constructor: Sets the element, whereon the iterator points, to zero.

template<class T>
template<class OT , class OI >
orxonox::Iterator< T >::Iterator ( const IteratorBase< OT, OI > &  other)
inline

Constructor: Sets this element to the element of another Iterator.

Parameters
otherThe other Iterator

Member Function Documentation

template<class T>
T* orxonox::Iterator< T >::operator* ( ) const
inline

Overloading of the *it operator: returns the pointer to the object.

Returns
The object the Iterator points at
template<class T>
T* orxonox::Iterator< T >::operator-> ( ) const
inline

Overloading of the it-> operator: returns the pointer to the object.

Returns
The object the Iterator points at
template<class T>
Iterator<T>& orxonox::Iterator< T >::operator= ( ObjectListBaseElement element)
inline

Assigns a given element.

Parameters
elementThe element

The documentation for this class was generated from the following files: