26                          const std::vector<int>& strides)
    27     : originPtr_(reinterpret_cast<
Byte*>(originPtr)), type_(type), dims_(dims), strides_(strides),
    28       slice_((
Slice::Empty())) {
    29   assert(!dims_.empty() && 
"empty dimension");
    30   assert(dims_.size() == strides_.size() && 
"dimension mismatch");
    31   assert(slice_.
empty());
    36     : originPtr_(reinterpret_cast<
Byte*>(originPtr)), type_(type), dims_(
dims), strides_(
strides),
    37       slice_((
Slice::Empty())) {
    38   assert(!dims_.empty() && 
"empty dimension");
    39   assert(dims_.size() == strides_.size() && 
"dimension mismatch");
    40   assert(slice_.
empty());
    44   std::swap(originPtr_, other.originPtr_);
    45   std::swap(type_, other.type_);
    46   dims_.swap(other.dims_);
    47   strides_.swap(other.strides_);
    51   return (originPtr_ == right.originPtr_ && type_ == right.type_ && dims_ == right.dims_);
    55   stream << 
"StorageView = {\n";
    56   stream << 
"  originPtr: " << 
static_cast<void*
>(s.originPtr_) << 
"\n";
    57   stream << 
"  type: " << s.type_ << 
"\n";
    63   stream << 
" ]\n  strides: [";
    64   for(
auto i : s.strides_)
    73     throw Exception(
"number of slices (%i) exceeds number of dimensions (%i)",
    81   for(std::size_t i = 0; i < slice.
sliceTriples().size(); ++i) {
    88   slice_ = std::move(slice);
   102   for(std::size_t i = 1; i < dims_.size(); ++i) {
   103     stride *= dims_[i - 1];
   104     if(strides_[i] != stride)
   111   std::size_t 
size = 1;
   112   for(std::size_t i = 0; i < dims_.size(); ++i)
   113     size *= (dims_[i] == 0 ? 1 : dims_[i]);
 Byte * originPtr() noexcept
Get raw data pointer. 
friend std::ostream & operator<<(std::ostream &stream, const StorageView &s)
Convert to stream. 
std::size_t sizeInBytes() const noexcept
Size of the allocated, sliced data (without padding) in Bytes. 
Represent a mutable view to a multi-dimensional storage. 
void setSlice(Slice slice)
Set the slice of the StorageView 
TypeID type() const noexcept
Get type. 
Namespace of the serialbox library. 
TypeID
Type-id of types recognized by serialbox. 
char Byte
Represent a byte i.e sizeof(Byte) == 1. 
const std::vector< int > & dims() const noexcept
Get dimensions. 
std::vector< SliceTriple > & sliceTriples() noexcept
Get slice triples. 
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) 
bool empty() const noexcept
Check if slice is empty. 
const std::vector< int > & strides() const noexcept
Get strides. 
StorageView(void *originPtr, TypeID type, const std::vector< int > &dims, const std::vector< int > &strides)
Construct StorageView. 
bool operator==(const StorageView &right) const noexcept
Test for equality. 
Specification of the slice indices which is used for partial loading of serialized data...
void swap(StorageView &other) noexcept
Swap with other. 
Exception class which stores a human-readable error description. 
int bytesPerElement() const noexcept
Get bytes per element.