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

Represent a mutable view to a multi-dimensional storage. More...

#include <StorageView.h>

Public Member Functions

void setSlice (Slice slice)
 Set the slice of the StorageView
 
SlicegetSlice () noexcept
 Get the slice of the StorageView
 
const SlicegetSlice () const noexcept
 
bool isMemCopyable () const noexcept
 Return true if the storage is contiguous in memory (i.e no padding) and is column-major ordered.
 
std::size_t size () const noexcept
 Size of the allocated, sliced data (without padding)
 
std::size_t sizeInBytes () const noexcept
 Size of the allocated, sliced data (without padding) in Bytes.
 
Constructors
 StorageView (void *originPtr, TypeID type, const std::vector< int > &dims, const std::vector< int > &strides)
 Construct StorageView.
 
 StorageView (void *originPtr, TypeID type, std::vector< int > &&dims, std::vector< int > &&strides)
 Construct StorageView (move version)
 
 StorageView (const StorageView &other)=default
 Copy constructor.
 
 StorageView (StorageView &&other)=default
 Move constructor.
 
Iterator
StorageViewIterator begin () noexcept
 Iterator to the beginning of the data.
 
ConstStorageViewIterator begin () const noexcept
 
StorageViewIterator end () noexcept
 Iterator to the end of the data.
 
ConstStorageViewIterator end () const noexcept
 
Getter
template<class T >
T * originPtrAs () noexcept
 Get data pointer as type T of the origin of the data.
 
template<class T >
const T * originPtrAs () const noexcept
 
ByteoriginPtr () noexcept
 Get raw data pointer.
 
const ByteoriginPtr () const noexcept
 
TypeID type () const noexcept
 Get type.
 
int bytesPerElement () const noexcept
 Get bytes per element.
 
const std::vector< int > & dims () const noexcept
 Get dimensions.
 
const std::vector< int > & strides () const noexcept
 Get strides.
 

Operators

StorageViewoperator= (const StorageView &other)=default
 Copy assignment.
 
StorageViewoperator= (StorageView &&other)=default
 Move assignment.
 
void swap (StorageView &other) noexcept
 Swap with other.
 
bool operator== (const StorageView &right) const noexcept
 Test for equality.
 
bool operator!= (const StorageView &right) const noexcept
 Test for inequality.
 
std::ostream & operator<< (std::ostream &stream, const StorageView &s)
 Convert to stream.
 

Detailed Description

Represent a mutable view to a multi-dimensional storage.

Definition at line 33 of file StorageView.h.


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