Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
serialbox::StorageViewIterator Class Reference

Mutable forward iterator to access the data of a StorageView. More...

#include <StorageViewIterator.h>

Inheritance diagram for serialbox::StorageViewIterator:
serialbox::StorageViewIteratorBase< Byte >

Public Types

using Base = StorageViewIteratorBase< Byte >
 
- Public Types inherited from serialbox::StorageViewIteratorBase< Byte >
using value_type = Byte
 
using diffrence_type = std::ptrdiff_t
 
using pointer = value_type *
 
using refrence = value_type &
 
using iterator = StorageViewIteratorBase< Byte >
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

 StorageViewIterator (const StorageViewIterator &)=default
 Copy constructor.
 
 StorageViewIterator (StorageViewIterator &&)=default
 Move constructor.
 
 StorageViewIterator (Base::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...
 
- Public Member Functions inherited from serialbox::StorageViewIteratorBase< Byte >
int bytesPerElement () noexcept
 Get bytes per element.
 
value_type * ptr () noexcept
 Get current data pointer.
 
match_cv_qualifier< value_type, T >::type & as () noexcept
 Interpret current data pointer as type ´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.
 
 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...
 
iteratoroperator= (const iterator &)=default
 Copy assignment.
 
iteratoroperator= (iterator &&)=default
 Move assignment.
 
bool operator== (const iterator &right) const noexcept
 Test for equality.
 
bool operator!= (const iterator &right) const noexcept
 Test for inequality.
 
iteratoroperator++ () noexcept
 Pre-increment.
 
refrence operator* () noexcept
 Derefrence.
 
void swap (iterator &other) noexcept
 Swap with other.
 

Additional Inherited Members

- Protected Member Functions inherited from serialbox::StorageViewIteratorBase< Byte >
int computeCurrentIndex () const noexcept
 Compute the current linear index in the data according to the index vector.
 
- Protected Attributes inherited from serialbox::StorageViewIteratorBase< Byte >
value_type * curPtr_
 
std::vector< int > index_
 
bool end_
 
value_type * originPtr_
 
std::vector< int > dims_
 
std::vector< int > strides_
 
int bytesPerElement_
 
Slice slice_
 

Detailed Description

Mutable forward iterator to access the data of a StorageView.

The data is accessed in column-major order using operator++ (pre-increment).

Definition at line 229 of file StorageViewIterator.h.

Constructor & Destructor Documentation

◆ StorageViewIterator()

serialbox::StorageViewIterator::StorageViewIterator ( Base::value_type *  originPtr,
int  bytesPerElement,
const std::vector< int > &  dims,
const std::vector< int > &  strides,
const Slice slice,
bool  beginning 
)
inline

Construct iterator at specific location in the data.

Parameters
originPtrOrigin pointer of the associated StorageView
bytesPerElementNumber of bytes of the underlying data-type
dimsVector of dimensions
stridesVector of strides
sliceSlice of the data
beginningIndicate whether the iterator has reached the end

Definition at line 247 of file StorageViewIterator.h.


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