ERC CISST - cisst software

vctVarStrideMatrixConstIterator< _elementType > Class Template Reference

#include <vctVarStrideMatrixIterator.h>

Inheritance diagram for vctVarStrideMatrixConstIterator< _elementType >:

Inheritance graph
[legend]
Collaboration diagram for vctVarStrideMatrixConstIterator< _elementType >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class _elementType>
class vctVarStrideMatrixConstIterator< _elementType >

Parameters:
_elementType the type of the element that the iterator refers to.
See also:
vctVarStrideMatrixIterator

Definition at line 41 of file vctVarStrideMatrixIterator.h.

Public Types

Public Member Functions

Public Attributes

Protected Member Functions

Protected Attributes


Member Typedef Documentation

template<class _elementType>
typedef vctVarStrideMatrixConstIterator<_elementType> vctVarStrideMatrixConstIterator< _elementType >::ThisType

The type of the iterator itself.

Reimplemented in vctVarStrideMatrixIterator< _elementType >.

Definition at line 49 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
typedef std::iterator<std::random_access_iterator_tag, _elementType> vctVarStrideMatrixConstIterator< _elementType >::BaseType

Base type for this iterator, i.e. std::iterator.

Reimplemented in vctVarStrideMatrixIterator< _elementType >.

Definition at line 52 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
typedef BaseType::iterator_category vctVarStrideMatrixConstIterator< _elementType >::iterator_category

Type (i.e. category) of iterator, i.e. std::random_access_iterator_tag.

Definition at line 56 of file vctVarStrideMatrixIterator.h.


Constructor & Destructor Documentation

template<class _elementType>
vctVarStrideMatrixConstIterator< _elementType >::vctVarStrideMatrixConstIterator (  )  [inline]

Default constructor: create an uninitialized object.

Definition at line 100 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
vctVarStrideMatrixConstIterator< _elementType >::vctVarStrideMatrixConstIterator ( value_type *  dataPtr,
stride_type  columnStride,
size_type  numColumns,
stride_type  rowStride,
size_type  initialColumn = 0 
) [inline]

Constructor taking a non-const element pointer. Note that only read operations will be performed!

Definition at line 111 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
vctVarStrideMatrixConstIterator< _elementType >::vctVarStrideMatrixConstIterator ( const value_type *  dataPtr,
difference_type  columnStride,
size_type  numColumns,
stride_type  rowStride,
size_type  initialColumn = 0 
) [inline]

Constructor taking a const element pointer. We need it in order to deal with const containers being refered by this iterator. We have to perform const_cast to convert back to the stored non-const member pointer of this iterator. However, the non-const iterator class completely shadows the constructors of the const-iterator base class, and so we don't have to worry about creating a non-const iterator over a const container.

Definition at line 130 of file vctVarStrideMatrixIterator.h.


Member Function Documentation

template<class _elementType>
void vctVarStrideMatrixConstIterator< _elementType >::WrapToRight (  )  [inline, protected]

An auxiliary method to wrap the column index of the iterator. If the current column exceeds the number of columns in the matrix, more one row down and wrap to the corresponding column starting from the left

Definition at line 78 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, vctVarStrideMatrixConstIterator< _elementType >::NumColumns, and vctVarStrideMatrixConstIterator< _elementType >::RowStride.

Referenced by vctVarStrideMatrixIterator< _elementType >::operator++(), vctVarStrideMatrixConstIterator< _elementType >::operator++(), vctVarStrideMatrixConstIterator< _elementType >::operator+=(), vctVarStrideMatrixIterator< _elementType >::operator+=(), vctVarStrideMatrixConstIterator< _elementType >::operator-=(), and vctVarStrideMatrixIterator< _elementType >::operator-=().

template<class _elementType>
void vctVarStrideMatrixConstIterator< _elementType >::WrapToLeft (  )  [inline, protected]

An auxiliary method to wrap the column index of the iterator. If the current column is negative, move one row up, and wrap to the corresponding column starting from the right

Definition at line 90 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, vctVarStrideMatrixConstIterator< _elementType >::NumColumns, and vctVarStrideMatrixConstIterator< _elementType >::RowStride.

Referenced by vctVarStrideMatrixConstIterator< _elementType >::operator+=(), vctVarStrideMatrixIterator< _elementType >::operator+=(), vctVarStrideMatrixConstIterator< _elementType >::operator--(), vctVarStrideMatrixIterator< _elementType >::operator--(), vctVarStrideMatrixConstIterator< _elementType >::operator-=(), and vctVarStrideMatrixIterator< _elementType >::operator-=().

template<class _elementType>
ThisType& vctVarStrideMatrixConstIterator< _elementType >::operator++ (  )  [inline]

Pre-increment.

Definition at line 142 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, and vctVarStrideMatrixConstIterator< _elementType >::WrapToRight().

template<class _elementType>
ThisType vctVarStrideMatrixConstIterator< _elementType >::operator++ ( int   )  [inline]

Post-increment.

Definition at line 151 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
ThisType& vctVarStrideMatrixConstIterator< _elementType >::operator-- (  )  [inline]

Pre-decrement.

Definition at line 159 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, and vctVarStrideMatrixConstIterator< _elementType >::WrapToLeft().

template<class _elementType>
ThisType vctVarStrideMatrixConstIterator< _elementType >::operator-- ( int   )  [inline]

Post-decrement.

Definition at line 168 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
ThisType& vctVarStrideMatrixConstIterator< _elementType >::operator+= ( difference_type  difference  )  [inline]

Increment by offset.

Parameters:
difference offset to increment by

Definition at line 178 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, vctVarStrideMatrixConstIterator< _elementType >::NumColumns, vctVarStrideMatrixConstIterator< _elementType >::RowStride, vctVarStrideMatrixConstIterator< _elementType >::WrapToLeft(), and vctVarStrideMatrixConstIterator< _elementType >::WrapToRight().

template<class _elementType>
ThisType& vctVarStrideMatrixConstIterator< _elementType >::operator-= ( difference_type  difference  )  [inline]

Decrement by offset.

Parameters:
difference offset to decrement by

Definition at line 192 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, vctVarStrideMatrixConstIterator< _elementType >::NumColumns, vctVarStrideMatrixConstIterator< _elementType >::RowStride, vctVarStrideMatrixConstIterator< _elementType >::WrapToLeft(), and vctVarStrideMatrixConstIterator< _elementType >::WrapToRight().

template<class _elementType>
difference_type vctVarStrideMatrixConstIterator< _elementType >::operator- ( const ThisType other  )  const [inline]

Subtraction between iterators returns the number of increments needed for the second operand to reach the first operand, if it is reachable.

The number of increments is found by the following equations: DataPtr - (difference / NumColumns) * RowStride + (difference % NumColumns) * ColumnStride == other.DataPtr DataPtr - other.DataPtr == (difference / NumColumns) * RowStride + (difference % NumColumns) * ColumnStride

if (RowStride >= NumColumns * ColumnStride) { (DataPtr - other.DataPtr) / RowStride == row_diff == (difference / NumColumns) DataPtr - other.DataPtr - row_diff * RowStride == (difference % NumColumns) * ColumnStride (DataPtr - other.DataPtr - row_diff * RowStride) / ColumnStride == col_diff == (difference % NumColumns) difference == row_diff * NumColumns + col_diff } otherwise switch the roles of rows and columns.

Note:
this operation assumes reachability and does not test for it.

Definition at line 220 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::ColumnStride, vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, vctVarStrideMatrixConstIterator< _elementType >::DataPtr, vctVarStrideMatrixConstIterator< _elementType >::NumColumns, and vctVarStrideMatrixConstIterator< _elementType >::RowStride.

template<class _elementType>
const value_type& vctVarStrideMatrixConstIterator< _elementType >::operator[] ( difference_type  index  )  const [inline]

Random access (return const reference).

Definition at line 231 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
const value_type& vctVarStrideMatrixConstIterator< _elementType >::operator * (  )  const [inline]

Dereference (const).

Definition at line 239 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::DataPtr.

template<class _elementType>
bool vctVarStrideMatrixConstIterator< _elementType >::operator< ( const ThisType other  )  const [inline]

Order relation between iterators, required by STL.

Note:
The STL manual states that "if j is reachable from i then i<j". This does not imply the converse: "if i<j then j is reachable from i". In the case here, the converse does not hold.

Definition at line 251 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
bool vctVarStrideMatrixConstIterator< _elementType >::operator== ( const ThisType other  )  const [inline]

Equality of iterators, required by STL.

Definition at line 257 of file vctVarStrideMatrixIterator.h.

References vctVarStrideMatrixConstIterator< _elementType >::CurrentColumn, and vctVarStrideMatrixConstIterator< _elementType >::DataPtr.

template<class _elementType>
bool vctVarStrideMatrixConstIterator< _elementType >::operator> ( const ThisType other  )  const [inline]

Complementary operation to operator <.

Definition at line 263 of file vctVarStrideMatrixIterator.h.

template<class _elementType>
bool vctVarStrideMatrixConstIterator< _elementType >::operator!= ( const ThisType other  )  const [inline]

Complementary operation to operator ==.

Definition at line 269 of file vctVarStrideMatrixIterator.h.


Member Data Documentation

template<class _elementType>
value_type* vctVarStrideMatrixConstIterator< _elementType >::DataPtr [protected]

The data member points to the object being refered by this iterator. It is not declared const, so we will be able to use it in the non-const iterator class. But all the methods in vctVarStrideMatrixConstIterator are declared const to protect the data from writing.

Definition at line 65 of file vctVarStrideMatrixIterator.h.

Referenced by vctVarStrideMatrixConstIterator< _elementType >::operator *(), vctVarStrideMatrixIterator< _elementType >::operator *(), vctVarStrideMatrixIterator< _elementType >::operator++(), vctVarStrideMatrixConstIterator< _elementType >::operator++(), vctVarStrideMatrixConstIterator< _elementType >::operator+=(), vctVarStrideMatrixIterator< _elementType >::operator+=(), vctVarStrideMatrixConstIterator< _elementType >::operator-(), vctVarStrideMatrixConstIterator< _elementType >::operator--(), vctVarStrideMatrixIterator< _elementType >::operator--(), vctVarStrideMatrixConstIterator< _elementType >::operator-=(), vctVarStrideMatrixIterator< _elementType >::operator-=(), vctVarStrideMatrixConstIterator< _elementType >::operator==(), vctVarStrideMatrixConstIterator< _elementType >::WrapToLeft(), and vctVarStrideMatrixConstIterator< _elementType >::WrapToRight().


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu