Forward iterator to access the data of a StorageView. More...
#include <StorageViewIterator.h>
Public Types | |
Typedefs | |
using | value_type = ValueType |
using | diffrence_type = std::ptrdiff_t |
using | pointer = value_type * |
using | refrence = value_type & |
using | iterator = StorageViewIteratorBase< ValueType > |
using | iterator_category = std::forward_iterator_tag |
Public Member Functions | |
int | bytesPerElement () noexcept |
Get bytes per element. | |
value_type * | ptr () noexcept |
Get current data pointer. | |
template<class T > | |
match_cv_qualifier< value_type, T >::type & | as () noexcept |
Interpret current data pointer as type ´T´ | |
template<class T > | |
match_cv_qualifier< value_type, T >::type & | as () const noexcept |
const std::vector< int > & | index () const noexcept |
Get current index position in the data. | |
Constructors | |
StorageViewIteratorBase (const iterator &)=default | |
Copy constructor. | |
StorageViewIteratorBase (iterator &&)=default | |
Move constructor. | |
StorageViewIteratorBase (value_type *originPtr, int bytesPerElement, const std::vector< int > &dims, const std::vector< int > &strides, const Slice &slice, bool beginning) | |
Construct iterator at specific location in the data. More... | |
Protected Member Functions | |
int | computeCurrentIndex () const noexcept |
Compute the current linear index in the data according to the index vector. | |
Protected Attributes | |
value_type * | curPtr_ |
std::vector< int > | index_ |
bool | end_ |
value_type * | originPtr_ |
std::vector< int > | dims_ |
std::vector< int > | strides_ |
int | bytesPerElement_ |
Slice | slice_ |
Operators | |
iterator & | operator= (const iterator &)=default |
Copy assignment. | |
iterator & | operator= (iterator &&)=default |
Move assignment. | |
bool | operator== (const iterator &right) const noexcept |
Test for equality. | |
bool | operator!= (const iterator &right) const noexcept |
Test for inequality. | |
iterator & | operator++ () noexcept |
Pre-increment. | |
refrence | operator* () noexcept |
Derefrence. | |
void | swap (iterator &other) noexcept |
Swap with other. | |
std::ostream & | operator<< (std::ostream &stream, const iterator &it) |
Convert to stream. | |
Forward iterator to access the data of a StorageView.
The data is accessed in column-major order using operator++ (pre-increment).
Definition at line 34 of file StorageViewIterator.h.
|
inline |
Construct iterator at specific location in the data.
originPtr | Origin pointer of the associated StorageView |
bytesPerElement | Number of bytes of the underlying data-type |
dims | Vector of dimensions |
strides | Vector of strides |
slice | Slice of the data |
beginning | Indicate whether the iterator has reached the end |
Definition at line 64 of file StorageViewIterator.h.