cisst-saw
|
#include <vctVarStrideVectorIterator.h>
Public Types | |
typedef vctVarStrideVectorConstIterator < _elementType > | ThisType |
typedef std::iterator < std::random_access_iterator_tag, _elementType > | BaseType |
typedef BaseType::iterator_category | iterator_category |
Public Member Functions | |
VCT_CONTAINER_TRAITS_TYPEDEFS (_elementType) | |
vctVarStrideVectorConstIterator () | |
vctVarStrideVectorConstIterator (value_type *dataPtr, difference_type stride=1) | |
vctVarStrideVectorConstIterator (const value_type *dataPtr, difference_type stride=1) | |
ThisType & | operator++ () |
ThisType | operator++ (int) |
ThisType & | operator-- () |
ThisType | operator-- (int) |
ThisType & | operator+= (difference_type difference) |
ThisType & | operator-= (difference_type difference) |
difference_type | operator- (const ThisType &other) const |
const value_type & | operator[] (difference_type index) const |
const value_type & | operator* () const |
bool | operator< (const ThisType &other) const |
bool | operator<= (const ThisType &other) const |
bool | operator== (const ThisType &other) const |
bool | operator> (const ThisType &other) const |
bool | operator>= (const ThisType &other) const |
bool | operator!= (const ThisType &other) const |
Protected Attributes | |
value_type * | DataPtr |
difference_type | Stride |
Define an iterator over a memory array with stride. The iterator is defined according to the STL specifications of random-access-iterarator. It is almost identical to std::vector::iterator, except that the ++, –, +=, -=, +, -, operations all work in Stride increments.
We first define a const iterator, which only allows to read the referenced object. The non-const iterator hass all the functionality of a const_iterator, plus the mutability of the objects. We therefore derive vctVarStrideVectorIterator from vctVarStrideVectorConstIterator (as done with std::list iterators).
In the current version, we do not define operator=, and rely on explicit declarations of objects and the default operator= and copy constructor.
_elementType | the type of the element that the iterator refers to. |
typedef std::iterator<std::random_access_iterator_tag, _elementType> vctVarStrideVectorConstIterator< _elementType >::BaseType |
Base type for this iterator, i.e. std::iterator.
typedef BaseType::iterator_category vctVarStrideVectorConstIterator< _elementType >::iterator_category |
Type (i.e. category) of iterator, i.e. std::random_access_iterator_tag.
typedef vctVarStrideVectorConstIterator<_elementType> vctVarStrideVectorConstIterator< _elementType >::ThisType |
The type of the iterator itself.
|
inline |
Default constructor: create an uninitialized object.
|
inlineexplicit |
Constructor taking a non-const element pointer. Note that only read operations will be performed!
|
inlineexplicit |
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.
|
inline |
Complementary operation to operator ==
|
inline |
Dereference (const)
|
inline |
Pre-increment.
|
inline |
Post increment.
|
inline |
Increase by given difference.
|
inline |
Find difference between iterators. This method does not test for reachability, and may return invalid values if the two iterators are not reachable. It is the user's responsibility to ensure the correctness.
|
inline |
Pre-decrement.
|
inline |
Post decrement.
|
inline |
Decrease by given difference.
|
inline |
Order relation between iterators, required by STL.
|
inline |
|
inline |
Equality of iterators, required by STL
|
inline |
Complementary operation to operator <
|
inline |
|
inline |
Random access (return const reference).
vctVarStrideVectorConstIterator< _elementType >::VCT_CONTAINER_TRAITS_TYPEDEFS | ( | _elementType | ) |
|
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 vctVarStrideVectorConstIterator are declared const to protect the data from writing.
|
protected |