The Pedigree Project  0.1
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T > Class Template Reference

An iterator applicable for many data structures. More...

#include <Iterator.h>

+ Collaboration diagram for TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >:

Public Types

typedef TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T const > Const
 
typedef TreeIterator< originalT, Struct, FunctionNext, FunctionPrev, K, T > Reverse
 
typedef TreeIterator< originalT, Struct, FunctionNext, FunctionPrev, K, T const > ConstReverse
 

Public Member Functions

 TreeIterator ()
 
 TreeIterator (const TreeIterator &x)
 
template<typename K2 , typename T2 >
 TreeIterator (const TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K2, T2 > &x)
 
 TreeIterator (Struct *Node)
 
 ~TreeIterator ()
 
TreeIteratoroperator= (const TreeIterator &x)
 
TreeIteratoroperator++ ()
 
TreeIteratoroperator-- ()
 
operator* ()
 
operator-> ()
 
 operator Const ()
 
Struct * __getNode ()
 
key ()
 
value ()
 
const T & value (const T &failed=T()) const
 

Protected Attributes

Struct * m_Node
 

Friends

template<typename _originalT , class _Struct , _Struct *(_Struct::*)() _FunctionPrev, _Struct *(_Struct::*)() _FunctionNext, typename _K , typename _T >
class TreeIterator
 
template<typename _originalT , class _Struct , _Struct *(_Struct::*)() _FunctionPrev, _Struct *(_Struct::*)() _FunctionNext, typename _K1 , typename _T1 , typename _K2 , typename _T2 >
bool operator== (const TreeIterator< _originalT, _Struct, _FunctionPrev, _FunctionNext, _K1, _T1 > &x1, const TreeIterator< _originalT, _Struct, _FunctionPrev, _FunctionNext, _K2, _T2 > &x2)
 

Detailed Description

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
class TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >

An iterator applicable for many data structures.

General iterator for structures that provide functions for the next and previous structure in the datastructure and a "value" member. This template provides a bidirectional, a constant bidirectional, a reverse bidirectional and a constant reverse bidirectional iterator. This specific Tree-style implementation provides access to a key and value stored in the Struct

Parameters
[in]originalTthe original element type of the iterator
[in]Structthe datastructure that provides functions for the next/previous datastructure and a "value" member
[in]previouspointer to the member function used to iterate forward
[in]nextpointer to the member function used to iterate backwards
[in]Tthe real element type of the iterator

Definition at line 180 of file Iterator.h.

Member Typedef Documentation

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
typedef TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T const> TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::Const

Type of the constant bidirectional iterator

Definition at line 206 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
typedef TreeIterator< originalT, Struct, FunctionNext, FunctionPrev, K, T const> TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::ConstReverse

Type of the constant reverse iterator

Definition at line 213 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
typedef TreeIterator<originalT, Struct, FunctionNext, FunctionPrev, K, T> TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::Reverse

Type of the reverse iterator

Definition at line 209 of file Iterator.h.

Constructor & Destructor Documentation

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::TreeIterator ( )
inline

The default constructor constructs an invalid/unusable iterator

Definition at line 216 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::TreeIterator ( const TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T > &  x)
inline

The copy-constructor

Parameters
[in]TreeIteratorthe reference object

Definition at line 221 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
template<typename K2 , typename T2 >
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::TreeIterator ( const TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K2, T2 > &  x)
inline

The constructor

Parameters
[in]TreeIteratorthe reference object

Definition at line 227 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::TreeIterator ( Struct *  Node)
inline

Constructor from a pointer to an instance of the data structure

Parameters
[in]Nodepointer to an instance of the data structure

Definition at line 234 of file Iterator.h.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::~TreeIterator ( )
inline

The destructor does nothing

Definition at line 238 of file Iterator.h.

Member Function Documentation

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
Struct* TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::__getNode ( )
inline

Get the Node

Definition at line 279 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator Const ( )
inline

Conversion Operator to a constant iterator

Definition at line 273 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
T TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator* ( )
inline

Dereference operator yields the element value

Definition at line 262 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator& TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator++ ( )
inline

Preincrement operator

Definition at line 250 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator& TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator-- ( )
inline

Predecrement operator

Definition at line 256 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
T TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator-> ( )
inline

Dereference operator yields the element value

Definition at line 267 of file Iterator.h.

References Iterator< originalT, Struct, FunctionPrev, FunctionNext, T >::m_Node.

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
TreeIterator& TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator= ( const TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T > &  x)
inline

Friends And Related Function Documentation

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
template<typename _originalT , class _Struct , _Struct *(_Struct::*)() _FunctionPrev, _Struct *(_Struct::*)() _FunctionNext, typename _K1 , typename _T1 , typename _K2 , typename _T2 >
bool operator== ( const TreeIterator< _originalT, _Struct, _FunctionPrev, _FunctionNext, _K1, _T1 > &  x1,
const TreeIterator< _originalT, _Struct, _FunctionPrev, _FunctionNext, _K2, _T2 > &  x2 
)
friend

The assignment operator is extern

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
template<typename _originalT , class _Struct , _Struct *(_Struct::*)() _FunctionPrev, _Struct *(_Struct::*)() _FunctionNext, typename _K , typename _T >
friend class TreeIterator
friend

All iterators must be friend in order to allow casts between some iterator types

Definition at line 188 of file Iterator.h.

Member Data Documentation

template<typename originalT, class Struct, Struct *(Struct::*)() FunctionPrev = &Struct::previous, Struct *(Struct::*)() FunctionNext = &Struct::next, typename K = originalT, typename T = originalT>
Struct* TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::m_Node
protected

Pointer to the instance of the data structure or 0

Definition at line 316 of file Iterator.h.

Referenced by TreeIterator< originalT, Struct, FunctionPrev, FunctionNext, K, T >::operator=(), and operator==().


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