Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
orxonox::IteratorBase< T, I > Class Template Reference

The Iterator allows to iterate through object lists. More...

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

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

Public Member Functions

 IteratorBase (ObjectListElement< T > *element=nullptr)
 Constructor: Sets the element, whereon the iterator points, to the given element. More...
 
template<class OT , class OI >
 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, I > &compare) const
 Overloading of the != operator to compare with another Iterator. More...
 
const IteratorBase< T, I > & operator++ ()
 Overloading of the ++it operator: Iterator points to the next object in the list. More...
 
operator++ (int)
 Overloading of the it++ operator: Iterator points to the next object in the list. More...
 
const IteratorBase< T, I > & operator-- ()
 Overloading of the –it operator: Iterator points to the previous object in the list. More...
 
operator-- (int i)
 Overloading of the it– operator: Iterator points to the previous object in the list. More...
 
IteratorBase< T, I > & operator= (ObjectListElement< T > *element)
 Assigns a given element. More...
 
IteratorBase< T, I > & operator= (const IteratorBase< T, I > &other)
 Assigns the element of another Iterator. More...
 
bool operator== (const IteratorBase< T, I > &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
 

Protected Member Functions

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

ObjectListBaseElementelement_
 The element the Iterator points at. More...
 
ObjectListBaselist_
 The list in which the Iterator registered itself. More...
 

Detailed Description

template<class T, class I>
class orxonox::IteratorBase< T, I >

The Iterator allows to iterate through object lists.

It serves as base class for ObjectListIterator and Iterator

Constructor & Destructor Documentation

template<class T, class I>
orxonox::IteratorBase< T, I >::IteratorBase ( ObjectListElement< T > *  element = nullptr)
inline

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

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

Constructor: Sets the element, whereon the iterator points, to the given element of another type.

The element's type O must be a derivative of the Iterator's type T.

template<class T, class I>
orxonox::IteratorBase< T, I >::~IteratorBase ( )
inline

Unregisters the Iterator from the ObjectList.

Member Function Documentation

template<class T, class I>
ObjectListBaseElement* orxonox::IteratorBase< T, I >::getElement ( ) const
inline
template<class T, class I>
orxonox::IteratorBase< T, I >::operator bool ( ) const
inlineexplicit

Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.

Returns
True if the Iterator points to an existing object.
template<class T, class I>
bool orxonox::IteratorBase< T, I >::operator!= ( const IteratorBase< T, I > &  compare) const
inline

Overloading of the != operator to compare with another Iterator.

Parameters
compareThe other Iterator
Returns
True if the iterators point to different elements
template<class T, class I>
const IteratorBase<T, I>& orxonox::IteratorBase< T, I >::operator++ ( )
inline

Overloading of the ++it operator: Iterator points to the next object in the list.

Returns
The Iterator itself
template<class T, class I>
I orxonox::IteratorBase< T, I >::operator++ ( int  )
inline

Overloading of the it++ operator: Iterator points to the next object in the list.

Returns
The Iterator itself
template<class T, class I>
const IteratorBase<T, I>& orxonox::IteratorBase< T, I >::operator-- ( )
inline

Overloading of the –it operator: Iterator points to the previous object in the list.

Returns
The Iterator itself
template<class T, class I>
I orxonox::IteratorBase< T, I >::operator-- ( int  i)
inline

Overloading of the it– operator: Iterator points to the previous object in the list.

Returns
The Iterator itself
template<class T, class I>
IteratorBase<T, I>& orxonox::IteratorBase< T, I >::operator= ( ObjectListElement< T > *  element)
inline

Assigns a given element.

Parameters
elementThe element
template<class T, class I>
IteratorBase<T, I>& orxonox::IteratorBase< T, I >::operator= ( const IteratorBase< T, I > &  other)
inline

Assigns the element of another Iterator.

Parameters
otherThe other Iterator
template<class T, class I>
bool orxonox::IteratorBase< T, I >::operator== ( const IteratorBase< T, I > &  compare) const
inline

Overloading of the == operator to compare with another Iterator.

Parameters
compareThe other Iterator
Returns
True if the iterators point to the same element
template<class T, class I>
void orxonox::IteratorBase< T, I >::registerIterator ( )
inlineprotected

Registers the Iterator at the list to which it belongs.

template<class T, class I>
virtual void orxonox::IteratorBase< T, I >::removedElement ( ObjectListBaseElement element)
inlineoverridevirtual

Increments the Iterator if it points at the given element.

Parameters
elementThe element to compare with

Implements orxonox::ObjectListElementRemovalListener.

template<class T, class I>
void orxonox::IteratorBase< T, I >::setElement ( ObjectListBaseElement element)
inlineprotected
template<class T, class I>
void orxonox::IteratorBase< T, I >::unregisterIterator ( )
inlineprotected

Unregisters the Iterator from the list (if any)

Member Data Documentation

template<class T, class I>
ObjectListBaseElement* orxonox::IteratorBase< T, I >::element_
protected

The element the Iterator points at.

template<class T, class I>
ObjectListBase* orxonox::IteratorBase< T, I >::list_
protected

The list in which the Iterator registered itself.


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