h5cpp  0.5.1
A modern C++ wrapper for the HDF5 C library
hdf5::dataspace::Hyperslab Class Reference

hyperslab selection class More...

#include <hyperslab.hpp>

Inheritance diagram for hdf5::dataspace::Hyperslab:
Collaboration diagram for hdf5::dataspace::Hyperslab:

Public Member Functions

 Hyperslab ()
 default constructor More...
 
 ~Hyperslab () override
 destructor More...
 
 Hyperslab (const Hyperslab &)=default
 copy constructor More...
 
 Hyperslab (size_t rank)
 constructor More...
 
 Hyperslab (const Dimensions &offset, const Dimensions &block, const Dimensions &count, const Dimensions &stride)
 constructor More...
 
 Hyperslab (const Dimensions &offset, const Dimensions &block)
 constructor More...
 
 Hyperslab (const Dimensions &offset, const Dimensions &count, const Dimensions &stride)
 constructor More...
 
size_t rank () const noexcept
 get rank More...
 
void offset (size_t index, size_t value)
 set start value for a dimension More...
 
void offset (const Dimensions &values)
 set all start values More...
 
const Dimensionsoffset () const
 get start values More...
 
void stride (size_t index, size_t value)
 set stride value for an individual dimension More...
 
void stride (const Dimensions &values)
 set all stride values for the Hyperslab More...
 
const Dimensionsstride () const
 get stride values for the Hyperslab More...
 
void count (size_t index, size_t value)
 set count value for a particular dimension More...
 
void count (const Dimensions &values)
 set all count values More...
 
const Dimensionscount () const
 get count values More...
 
void block (size_t index, size_t value)
 set block size for dimension More...
 
void block (const Dimensions &values)
 set all block values More...
 
const Dimensionsblock () const
 get block values More...
 
virtual void apply (const Dataspace &space, SelectionOperation ops) const override
 apply a selection onto a dataspace More...
 
virtual Dimensions dimensions () const override
 get current dimensions More...
 
virtual size_t size () const override
 get the selection size More...
 
virtual SelectionType type () const override
 get the selection type More...
 
- Public Member Functions inherited from hdf5::dataspace::Selection
 Selection ()=default
 default constructor More...
 
 Selection (const Selection &)=default
 copy constructor More...
 
virtual ~Selection ()
 destructor More...
 

Additional Inherited Members

- Public Types inherited from hdf5::dataspace::Selection
using UniquePointer = std::unique_ptr< Selection >
 pointer for selection stacks More...
 
using SharedPointer = std::shared_ptr< Selection >
 

Detailed Description

Hyperslabs represent complex multidimensional selections within an HDF5 dataset. The number of dimensions for every hyperslab is determined during construction and cannot be altered once it has been fixed.

Todo:

  • we may have to add a function to check if all the Dimension instances have the same size. However, this might be an expensive procedure and we should take performance considerations into account here.

Constructor & Destructor Documentation

◆ Hyperslab() [1/6]

hdf5::dataspace::Hyperslab::Hyperslab ( )

The default constructor is present to allow Hyperslabs in STL containers. It must be noted that any attempt to change an internal value will result in a std::runtime_error exception. The rank of a default constructed Hyperslab would be 0. As a Hyperslab of rank 0 would not make any sense one could use this to identify a default constructed Hyperslab.

Postcondition
all internal buffers remain unallocated

◆ ~Hyperslab()

hdf5::dataspace::Hyperslab::~Hyperslab ( )
override

◆ Hyperslab() [2/6]

hdf5::dataspace::Hyperslab::Hyperslab ( const Hyperslab )
default

Use compiler generated default implementation here

◆ Hyperslab() [3/6]

hdf5::dataspace::Hyperslab::Hyperslab ( size_t  rank)

Construct a Hyperslab selection of a given rank.

Parameters
rankthe number of dimensions
Postcondition
all start values are set to 0
all stride values are set to 1
all count values are set to 0
all block values are set to 0

◆ Hyperslab() [4/6]

hdf5::dataspace::Hyperslab::Hyperslab ( const Dimensions offset,
const Dimensions block,
const Dimensions count,
const Dimensions stride 
)

This constructor exposes the full capabilities of a hyperslab. All parameters can be adjusted.

Parameters
offsetthe offset from which to start the selection
blockthe size of a single block in the selection
countthe number of blocks along each dimensions
stridethe stride along each dimension between the blocks

◆ Hyperslab() [5/6]

hdf5::dataspace::Hyperslab::Hyperslab ( const Dimensions offset,
const Dimensions block 
)

Construct a hyperslab which constists of a single block starting at a particular offset.

Parameters
offsetthe start offset of the block
blockthe size of the single block

◆ Hyperslab() [6/6]

hdf5::dataspace::Hyperslab::Hyperslab ( const Dimensions offset,
const Dimensions count,
const Dimensions stride 
)

Construct a hyperslab which consists of count blocks of size 1 along each dimension separated by stride elements.

Parameters
offsetstarting offset of the selection
countnumber of blocks along each dimensions
stridethe stride between the blocks along each dimension

Member Function Documentation

◆ apply()

virtual void hdf5::dataspace::Hyperslab::apply ( const Dataspace space,
SelectionOperation  ops 
) const
overridevirtual

The current selection will be applied to dataspace space using the operator determined by ops.

Exceptions
std::runtime_errorin case of a failure
Parameters
spacereference to the dataspace onto which to apply the selection
opsoperator for the selection

Implements hdf5::dataspace::Selection.

◆ block() [1/3]

const Dimensions& hdf5::dataspace::Hyperslab::block ( ) const

Get a const reference to the block values of the hyperslab.

Exceptions
std::runtime_errorin case of a failure
Returns
const reference to the block values

◆ block() [2/3]

void hdf5::dataspace::Hyperslab::block ( const Dimensions values)

Set all block values for the hyperslab selection.

Exceptions
std::runtime_errorin case of a failure
Parameters
valuesreference to the new block values

◆ block() [3/3]

void hdf5::dataspace::Hyperslab::block ( size_t  index,
size_t  value 
)
Exceptions
std::runtime_errorin case of a failure
Parameters
indexdimension index
valuethe new block size for this dimension

◆ count() [1/3]

const Dimensions& hdf5::dataspace::Hyperslab::count ( ) const

Return a const reference to the count values of the Hypeslab. The values cannot be changed via this reference.

Exceptions
std::runtime_errorin case of a failure
Returns
reference to count values

◆ count() [2/3]

void hdf5::dataspace::Hyperslab::count ( const Dimensions values)
Exceptions
std::runtime_errorin case of a failure
Parameters
valuesreference to the new count values

◆ count() [3/3]

void hdf5::dataspace::Hyperslab::count ( size_t  index,
size_t  value 
)
Exceptions
std::runtime_errorin case of a failure
Parameters
indexdimension index
valuenew count value for this dimension

◆ dimensions()

virtual Dimensions hdf5::dataspace::Hyperslab::dimensions ( ) const
overridevirtual

Get a number of elements along each dimension a selection spans this is particularly useful in the case of a Hyperslab

Exceptions
std::runtime_errorin case of a failure
Returns
the selection dimentsions

Implements hdf5::dataspace::Selection.

◆ offset() [1/3]

const Dimensions& hdf5::dataspace::Hyperslab::offset ( ) const
Exceptions
std::runtime_errorif the Hyperslab is default constructed
Returns
const reference to the start values of the hyperslab

◆ offset() [2/3]

void hdf5::dataspace::Hyperslab::offset ( const Dimensions values)

Set the start values for all dimensions of the hyperslab. If the size of values exceeds the rank of the hyperslab an exception will be thrown.

Exceptions
std::runtime_errorin case of a failure
Parameters
valuesnew start values for the hyperslab

◆ offset() [3/3]

void hdf5::dataspace::Hyperslab::offset ( size_t  index,
size_t  value 
)

Set the start value of the hyperslab for a particular dimension determined by index to value. This method throws an exception if the dimension index exceeds the rank of the hyperslab.

Exceptions
std::runtime_errorin case of a failure
Parameters
indexdimension index
valuenew start value

◆ rank()

size_t hdf5::dataspace::Hyperslab::rank ( ) const
noexcept
Returns
number of dimensions in the selection

◆ size()

virtual size_t hdf5::dataspace::Hyperslab::size ( ) const
overridevirtual

Get the total number of elements adressed by an individual selection

Exceptions
std::runtime_errorin case of a failure
Returns
the selection type enumerator

Implements hdf5::dataspace::Selection.

◆ stride() [1/3]

const Dimensions& hdf5::dataspace::Hyperslab::stride ( ) const
Exceptions
std::runtime_errorin case of a failure
Returns
const reference to the stride values

◆ stride() [2/3]

void hdf5::dataspace::Hyperslab::stride ( const Dimensions values)
Exceptions
std::runtime_errorin case of a failure
Parameters
valuesnew stride values for the Hyperslab

◆ stride() [3/3]

void hdf5::dataspace::Hyperslab::stride ( size_t  index,
size_t  value 
)
Exceptions
std::runtime_errorin case of a failure
Parameters
indexdimension index for which to set the stride
valuenew stride value

◆ type()

virtual SelectionType hdf5::dataspace::Hyperslab::type ( ) const
overridevirtual

Get the type of the selection

Returns
the selection type enumerator

Implements hdf5::dataspace::Selection.


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