STK++ 0.9.13
STK::InnerIteratorBase< Array, Derived > Class Template Reference

InnerIteratorBase is a base class for all iterators on allocators. More...

#include <STK_InnerIteratorBase.h>

Inheritance diagram for STK::InnerIteratorBase< Array, Derived >:
Inheritance graph

Public Types

enum  {
  structure_ = hidden::Traits< Array >::structure_ , orient_ = hidden::Traits< Array >::orient_ , sizeCols_ = hidden::Traits< Array >::sizeCols_ , sizeRows_ = hidden::Traits< Array >::sizeRows_ ,
  size_ = hidden::Traits< Array >::size_ , storage_ = hidden::Traits< Array >::storage_
}
 
typedef hidden::Traits< Array >::Type Type
 
typedef hidden::Traits< Array >::TypeConst TypeConst
 
typedef hidden::RemoveConst< Type >::Typereference
 
typedef hidden::RemoveConst< Type >::Typepointer
 

Public Member Functions

int col () const
 get current column of the iterator
 
int row () const
 get current row of the iterator
 
Derived constnext () const
 go to next position
 
Derived constprev () const
 go to previous position
 
Derived constoperator++ () const
 go to next position
 
Derived constoperator++ (int) const
 go to next position
 
Derived constoperator-- () const
 go to previous position
 
Derived constoperator-- (int) const
 go to previous position
 
TypeConst value () const
 get current value of the iterator
 
reference valueRef () const
 get current value of the iterator
 
reference operator* () const
 get a reference on the current element (the one at position pos_)
 
pointer operator-> () const
 get address of the current element (the one at position pos_)
 
- Public Member Functions inherited from STK::IRecursiveTemplate< Derived >
Derived & asDerived ()
 static cast : return a reference of this with a cast to the derived class.
 
Derived constasDerived () const
 static cast : return a const reference of this with a cast to the derived class.
 
Derived * asPtrDerived ()
 static cast : return a ptr on a Derived of this with a cast to the derived class.
 
Derived constasPtrDerived () const
 static cast : return a ptr on a constant Derived of this with a cast to the derived class.
 
Derived * clone () const
 create a leaf using the copy constructor of the Derived class.
 
Derived * clone (bool isRef) const
 create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not.
 

Protected Member Functions

 InnerIteratorBase (Array *p_array)
 default constructor.
 
 InnerIteratorBase (InnerIteratorBase const &it)
 copy constructor.
 
 ~InnerIteratorBase ()
 destructor
 
- Protected Member Functions inherited from STK::IRecursiveTemplate< Derived >
 IRecursiveTemplate ()
 constructor.
 
 ~IRecursiveTemplate ()
 destructor.
 

Protected Attributes

Array *const p_array_
 pointer on instance
 
int row_
 current row position
 
int col_
 current column position
 

Detailed Description

template<class Array, class Derived>
class STK::InnerIteratorBase< Array, Derived >

InnerIteratorBase is a base class for all iterators on allocators.

Derived class can iterate through allocators what ever how storage is implemented.

Derived classes have to implement the following pseudo virtual methods

TypeConst valueImpl() const; // get current element
reference valueRefImpl() const; // get current element
Derived& nextImpl() const; // move to next element
Derived& prevImpl() const; // move to previous element
hidden::Traits< Array >::TypeConst TypeConst
hidden::RemoveConst< Type >::Type & reference
Template Parameters
Derivedarray to iterate
Arrayarray to iterate

Definition at line 61 of file STK_InnerIteratorBase.h.

Member Typedef Documentation

◆ pointer

template<class Array , class Derived >
typedef hidden::RemoveConst<Type>::Type* STK::InnerIteratorBase< Array, Derived >::pointer

Definition at line 98 of file STK_InnerIteratorBase.h.

◆ reference

template<class Array , class Derived >
typedef hidden::RemoveConst<Type>::Type& STK::InnerIteratorBase< Array, Derived >::reference

Definition at line 97 of file STK_InnerIteratorBase.h.

◆ Type

template<class Array , class Derived >
typedef hidden::Traits<Array>::Type STK::InnerIteratorBase< Array, Derived >::Type

Definition at line 94 of file STK_InnerIteratorBase.h.

◆ TypeConst

template<class Array , class Derived >
typedef hidden::Traits<Array>::TypeConst STK::InnerIteratorBase< Array, Derived >::TypeConst

Definition at line 95 of file STK_InnerIteratorBase.h.

Member Enumeration Documentation

◆ anonymous enum

template<class Array , class Derived >
anonymous enum
Enumerator
structure_ 
orient_ 
sizeCols_ 
sizeRows_ 
size_ 
storage_ 

Definition at line 84 of file STK_InnerIteratorBase.h.

85 {
86 structure_ = hidden::Traits< Array >::structure_,
87 orient_ = hidden::Traits< Array >::orient_,
88 sizeCols_ = hidden::Traits< Array >::sizeCols_,
89 sizeRows_ = hidden::Traits< Array >::sizeRows_,
90 size_ = hidden::Traits< Array >::size_,
91 storage_ = hidden::Traits< Array >::storage_
92 };

Constructor & Destructor Documentation

◆ InnerIteratorBase() [1/2]

template<class Array , class Derived >
STK::InnerIteratorBase< Array, Derived >::InnerIteratorBase ( Array *  p_array)
inlineprotected

default constructor.

Parameters
p_arraypointer on the instance to iterate

Definition at line 67 of file STK_InnerIteratorBase.h.

68 : p_array_(p_array)
69 , row_(p_array->beginRows())
70 , col_(p_array->beginCols())
71 {}
int row_
current row position
Array *const p_array_
pointer on instance
int col_
current column position

◆ InnerIteratorBase() [2/2]

template<class Array , class Derived >
STK::InnerIteratorBase< Array, Derived >::InnerIteratorBase ( InnerIteratorBase< Array, Derived > const it)
inlineprotected

copy constructor.

Parameters
ititerator to copy

Definition at line 75 of file STK_InnerIteratorBase.h.

76 : p_array_(it.p_array)
77 , row_(it.row_)
78 , col_(it.col_)
79 {}

◆ ~InnerIteratorBase()

template<class Array , class Derived >
STK::InnerIteratorBase< Array, Derived >::~InnerIteratorBase ( )
inlineprotected

destructor

Definition at line 81 of file STK_InnerIteratorBase.h.

81{}

Member Function Documentation

◆ col()

template<class Array , class Derived >
int STK::InnerIteratorBase< Array, Derived >::col ( ) const
inline

get current column of the iterator

Definition at line 101 of file STK_InnerIteratorBase.h.

101{return col_;}

References STK::InnerIteratorBase< Array, Derived >::col_.

◆ next()

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::next ( ) const
inline

go to next position

Definition at line 106 of file STK_InnerIteratorBase.h.

106{ return this->asDerived().nextImpl();}
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.

References STK::IRecursiveTemplate< Derived >::asDerived().

Referenced by STK::InnerIteratorBase< Array, Derived >::operator++(), and STK::InnerIteratorBase< Array, Derived >::operator++().

◆ operator*()

template<class Array , class Derived >
reference STK::InnerIteratorBase< Array, Derived >::operator* ( ) const
inline

get a reference on the current element (the one at position pos_)

Definition at line 123 of file STK_InnerIteratorBase.h.

123{ return value();}
TypeConst value() const
get current value of the iterator

References STK::InnerIteratorBase< Array, Derived >::value().

◆ operator++() [1/2]

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::operator++ ( ) const
inline

go to next position

Definition at line 110 of file STK_InnerIteratorBase.h.

110{ return next();}
Derived const & next() const
go to next position

References STK::InnerIteratorBase< Array, Derived >::next().

◆ operator++() [2/2]

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::operator++ ( int  ) const
inline

go to next position

Definition at line 112 of file STK_InnerIteratorBase.h.

112{ return next();}

References STK::InnerIteratorBase< Array, Derived >::next().

◆ operator--() [1/2]

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::operator-- ( ) const
inline

go to previous position

Definition at line 114 of file STK_InnerIteratorBase.h.

114{ return prev();}
Derived const & prev() const
go to previous position

References STK::InnerIteratorBase< Array, Derived >::prev().

◆ operator--() [2/2]

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::operator-- ( int  ) const
inline

go to previous position

Definition at line 116 of file STK_InnerIteratorBase.h.

116{ return prev();}

References STK::InnerIteratorBase< Array, Derived >::prev().

◆ operator->()

template<class Array , class Derived >
pointer STK::InnerIteratorBase< Array, Derived >::operator-> ( ) const
inline

get address of the current element (the one at position pos_)

Definition at line 125 of file STK_InnerIteratorBase.h.

125{ return &(value());}

References STK::InnerIteratorBase< Array, Derived >::value().

◆ prev()

template<class Array , class Derived >
Derived const & STK::InnerIteratorBase< Array, Derived >::prev ( ) const
inline

◆ row()

template<class Array , class Derived >
int STK::InnerIteratorBase< Array, Derived >::row ( ) const
inline

get current row of the iterator

Definition at line 103 of file STK_InnerIteratorBase.h.

103{return row_;}

References STK::InnerIteratorBase< Array, Derived >::row_.

◆ value()

template<class Array , class Derived >
TypeConst STK::InnerIteratorBase< Array, Derived >::value ( ) const
inline

get current value of the iterator

Definition at line 119 of file STK_InnerIteratorBase.h.

119{ return this->asDerived().valueImpl();}

References STK::IRecursiveTemplate< Derived >::asDerived().

Referenced by STK::InnerIteratorBase< Array, Derived >::operator*(), and STK::InnerIteratorBase< Array, Derived >::operator->().

◆ valueRef()

template<class Array , class Derived >
reference STK::InnerIteratorBase< Array, Derived >::valueRef ( ) const
inline

get current value of the iterator

Definition at line 121 of file STK_InnerIteratorBase.h.

121{ return this->asDerived().valueRefImpl();}

References STK::IRecursiveTemplate< Derived >::asDerived().

Member Data Documentation

◆ col_

template<class Array , class Derived >
int STK::InnerIteratorBase< Array, Derived >::col_
mutableprotected

current column position

Definition at line 133 of file STK_InnerIteratorBase.h.

Referenced by STK::InnerIteratorBase< Array, Derived >::col().

◆ p_array_

template<class Array , class Derived >
Array* const STK::InnerIteratorBase< Array, Derived >::p_array_
protected

pointer on instance

Definition at line 129 of file STK_InnerIteratorBase.h.

◆ row_

template<class Array , class Derived >
int STK::InnerIteratorBase< Array, Derived >::row_
mutableprotected

current row position

Definition at line 131 of file STK_InnerIteratorBase.h.

Referenced by STK::InnerIteratorBase< Array, Derived >::row().


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