[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

StridedMultiIterator< N, T, REFERENCE, POINTER > Class Template Reference

A multi-dimensional hierarchical iterator to be used with vigra::MultiArrayView if it is not strided. More...

`#include <vigra/multi_iterator.hxx>`

## Public Types

enum |
typedef StridedMultiIterator< N-1, T, REFERENCE, POINTER > | base_type
typedef const value_type * | const_pointer
typedef const value_type & | const_reference
typedef MultiArrayIndex | difference_type
typedef StridedMultiIterator< 1, T, REFERENCE, POINTER > | iterator
typedef multi_dimensional_traverser_tag | iterator_category
typedef MultiArrayShape< N >::type | multi_difference_type
typedef base_type | next_type
typedef POINTER | pointer
typedef REFERENCE | reference
typedef T | value_type

## Public Member Functions

next_type | begin () const
template<unsigned int K>
StridedMultiIterator< K+1, T, REFERENCE, POINTER > & | dim ()
next_type | end () const
pointer | get () const
iterator | iteratorForDimension (unsigned int d) const
bool | operator!= (const StridedMultiIterator &rhs) const
reference | operator* () const
StridedMultiIterator | operator+ (difference_type n) const
StridedMultiIterator | operator+ (multi_difference_type const &d) const
void | operator++ ()
StridedMultiIterator | operator++ (int)
StridedMultiIterator & | operator+= (difference_type n)
StridedMultiIterator & | operator+= (multi_difference_type const &d)
StridedMultiIterator | operator- (difference_type n) const
StridedMultiIterator | operator- (multi_difference_type const &d) const
difference_type | operator- (StridedMultiIterator const &d) const
void | operator-- ()
StridedMultiIterator | operator-- (int)
StridedMultiIterator & | operator-= (difference_type n)
StridedMultiIterator & | operator-= (multi_difference_type const &d)
pointer | operator-> () const
bool | operator< (const StridedMultiIterator &rhs) const
bool | operator<= (const StridedMultiIterator &rhs) const
bool | operator== (const StridedMultiIterator &rhs) const
bool | operator> (const StridedMultiIterator &rhs) const
bool | operator>= (const StridedMultiIterator &rhs) const
reference | operator[] (difference_type n) const
reference | operator[] (multi_difference_type const &d) const
| StridedMultiIterator ()
| StridedMultiIterator (pointer ptr, const difference_array_type &stride, const difference_array_type &shape)

## Detailed Description

template<unsigned int N, class T, class REFERENCE, class POINTER>
class vigra::StridedMultiIterator< N, T, REFERENCE, POINTER >

A multi-dimensional hierarchical iterator to be used with vigra::MultiArrayView if it is not strided.

See Multi-dimensional Array Iterators for further documentation.

#include <vigra/multi_iterator.hxx>
Namespace: vigra

## Member Typedef Documentation

## ◆ base_type

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef StridedMultiIterator<N-1, T, REFERENCE, POINTER> base_type

the type of the parent in the inheritance hierarchy.

## ◆ value_type

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef T value_type

the iterator's value type

## ◆ reference

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef REFERENCE reference

reference type (result of operator[])

## ◆ const_reference

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef const value_type& const_reference

const reference type (result of operator[] const)

## ◆ pointer

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef POINTER pointer

pointer type

## ◆ const_pointer

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef const value_type* const_pointer

const pointer type

## ◆ multi_difference_type

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef MultiArrayShape<N>::type multi_difference_type

multi difference type (used for offsetting along all axes simultaneously)

## ◆ difference_type

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef MultiArrayIndex difference_type

difference type (used for offsetting)

## ◆ next_type

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef base_type next_type

the StridedMultiIterator for the next lower dimension.

## ◆ iterator

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef StridedMultiIterator<1, T, REFERENCE, POINTER> iterator

the 1-dimensional iterator for this iterator hierarchy (result of iteratorForDimension()).

## ◆ iterator_category

template<unsigned int N, class T , class REFERENCE , class POINTER >

typedef multi_dimensional_traverser_tag iterator_category

the iterator tag (image traverser)

## Member Enumeration Documentation

## ◆ anonymous enum

template<unsigned int N, class T , class REFERENCE , class POINTER >

anonymous enum

the iterator's level in the dimension hierarchy

## Constructor & Destructor Documentation

## ◆ StridedMultiIterator() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator | ( |  | ) |

default constructor.

## ◆ StridedMultiIterator() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator | ( | pointer | ptr,
|  | const difference_array_type & | stride,
|  | const difference_array_type & | shape
| ) |  |

construct from pointer, strides (offset of a sample to the next) for every dimension, and the shape.

## Member Function Documentation

## ◆ operator++() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

void operator++ | ( |  | ) |

prefix-increment the iterator in its current dimension

## ◆ operator--() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

void operator-- | ( |  | ) |

prefix-decrement the iterator in its current dimension

## ◆ operator++() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator++ | ( | int |  | ) |

postfix-increment the iterator in its current dimension

## ◆ operator--() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator-- | ( | int |  | ) |

postfix-decrement the iterator in its current dimension

## ◆ operator+=() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator & operator+= | ( | difference_type | n | ) |

increment the iterator in its current dimension by the given value.

## ◆ operator+=() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator & operator+= | ( | multi_difference_type const & | d | ) |

increment the iterator in all dimensions by the given offset.

## ◆ operator-=() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator & operator-= | ( | difference_type | n | ) |

decrement the iterator in its current dimension by the given value.

## ◆ operator-=() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator & operator-= | ( | multi_difference_type const & | d | ) |

decrement the iterator in all dimensions by the given offset.

## ◆ operator+() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator+ | ( | difference_type | n | ) | const

addition within current dimension

## ◆ operator+() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator+ | ( | multi_difference_type const & | d | ) | const

addition along all dimensions

## ◆ operator-() [1/3]

template<unsigned int N, class T , class REFERENCE , class POINTER >

difference_type operator- | ( | StridedMultiIterator< N, T, REFERENCE, POINTER > const & | d | ) | const

difference of two iterators in the current dimension. The result of this operation is undefined if the iterator doesn't point to element 0 in all dimensions below its current dimension.

## ◆ operator-() [2/3]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator- | ( | difference_type | n | ) | const

subtraction within current dimension

## ◆ operator-() [3/3]

template<unsigned int N, class T , class REFERENCE , class POINTER >

StridedMultiIterator operator- | ( | multi_difference_type const & | d | ) | const

subtraction along all dimensions

## ◆ operator*()

template<unsigned int N, class T , class REFERENCE , class POINTER >

reference operator* | ( |  | ) | const

derefenrence item

## ◆ get()

template<unsigned int N, class T , class REFERENCE , class POINTER >

pointer get | ( |  | ) | const

get address of current item

## ◆ operator->()

template<unsigned int N, class T , class REFERENCE , class POINTER >

pointer operator-> | ( |  | ) | const

call method of current item

## ◆ operator!=()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator!= | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

inequality. True if iterators reference different items.

## ◆ operator==()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator== | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

equality. True if iterators reference the same items.

## ◆ operator<()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator< | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

less than.

## ◆ operator<=()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator<= | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

less or equal.

## ◆ operator>()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator> | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

greater than.

## ◆ operator>=()

template<unsigned int N, class T , class REFERENCE , class POINTER >

bool operator>= | ( | const StridedMultiIterator< N, T, REFERENCE, POINTER > & | rhs | ) | const

greater or equal.

## ◆ operator[]() [1/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

reference operator[] | ( | difference_type | n | ) | const

access the array element at the given offset in the current dimension.

## ◆ operator[]() [2/2]

template<unsigned int N, class T , class REFERENCE , class POINTER >

reference operator[] | ( | multi_difference_type const & | d | ) | const

access the array element at the given offset.

## ◆ begin()

template<unsigned int N, class T , class REFERENCE , class POINTER >

next_type begin | ( |  | ) | const

Return the (N-1)-dimensional multi-iterator that points to the first (N-1)-dimensional subarray of the N-dimensional array this iterator is referring to. The result is only valid if this iterator refers to location 0 in all dimensions below its current dimension N, otherwise it is undefined. Usage:

StridedMultiIterator<2, int> outer = ...; // this iterator
StridedMultiIterator<2, int>::next_type inner = outer.begin();
for(; inner != outer.end(); ++inner)
{
// manipulate current 1D subimage
}
vigra::RGBValue
Class for a single RGB value.
Definition rgbvalue.hxx:128
vigra::TinyVectorBase::end
iterator end()
Definition tinyvector.hxx:864
vigra::TinyVectorBase::begin
iterator begin()
Definition tinyvector.hxx:861

## ◆ end()

template<unsigned int N, class T , class REFERENCE , class POINTER >

next_type end | ( |  | ) | const

Return the (N-1)-dimensional multi-iterator that points beyond the last (N-1)-dimensional subarray of the N-dimensional array this iterator is referring to. The result is only valid if this iterator refers to location 0 in all dimensions below its current dimension N, otherwise it is undefined.

## ◆ iteratorForDimension()

template<unsigned int N, class T , class REFERENCE , class POINTER >

iterator iteratorForDimension | ( | unsigned int | d | ) | const

Get a 1-dimensional, STL-compatible iterator for the given dimension, pointing to the current element of `this`. Usage:

StridedMultiIterator<3, int> outer = ...; // this iterator
StridedMultiIterator<3, int>::iterator i = outer.iteratorForDimension(1);
StridedMultiIterator<3, int>::iterator end = i + height;
for(; i != end; ++i)
{
// go down the current column starting at the location of 'outer'
}
vigra::StridedMultiIterator::iterator
StridedMultiIterator< 1, T, REFERENCE, POINTER > iterator
Definition multi_iterator.hxx:1970
vigra::StridedMultiIterator::end
next_type end() const
Definition multi_iterator.hxx:2189

## ◆ dim()

template<unsigned int N, class T , class REFERENCE , class POINTER >
template<unsigned int K>

StridedMultiIterator< K+1, T, REFERENCE, POINTER > & dim | ( |  | ) |

Return the multi-iterator that operates on dimension K in order to manipulate this dimension directly. Usage:

StridedMultiIterator<3, int> i3 = ...;
i3.template dim<2>()++; // increment outer dimension
i3.template dim<0>()++; // increment inner dimension

For convenience, the same functionality is also available as `dim0()`, `dim1()` etc. up to `dim4()`:

StridedMultiIterator<3, int> i3 = ...;
i3.dim2()++; // increment outer dimension
i3.dim0()++; // increment inner dimension

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

- vigra/multi_fwd.hxx
- vigra/multi_iterator.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.1