libpniio
|
dataspace object More...
#include <h5dataspace.hpp>
Public Types | |
typedef type_imp::index_type | value_type |
value type for buffers More... | |
typedef type_imp::index_vector_type::const_iterator | iterator |
buffer iterator More... | |
Public Member Functions | |
h5dataspace () | |
default constructor More... | |
h5dataspace (object_imp &&o) | |
constructor More... | |
h5dataspace (const type_imp::index_vector_type &shape) | |
constructor More... | |
h5dataspace (type_imp::index_vector_type &&shape) | |
constructor More... | |
size_t | rank () const |
rank of dataset More... | |
hid_t | id () const noexcept |
get object reference More... | |
bool | is_valid () const |
check validity status More... | |
size_t | size () const |
total number of elements More... | |
bool | has_selection () const |
true if selection is set on this dataspace More... | |
const type_imp::index_vector_type & | shape () const noexcept |
return reference to the current dimensions buffer More... | |
void | grow (size_t dim=0, size_t ext=1) |
grow dataspace More... | |
void | apply_selection (const selection &s) const |
apply selection More... | |
void | reset_selection () const noexcept |
reset selection More... | |
const object_imp & | object () const noexcept |
get reference to object More... | |
Private Member Functions | |
void | __init_buffers () noexcept |
initialize buffers More... | |
void | __update_dataspace () |
setup dataspace More... | |
void | __update_buffers () |
update the buffers More... | |
Private Attributes | |
object_imp | _object |
The HDF5 object representing the dataspace. More... | |
type_imp::index_vector_type | _dims |
number of elements More... | |
type_imp::index_vector_type | _maxdims |
maximum number of elements dimensions More... | |
This class encapsulates an HDF5 dataspace. A dataspace describes the organization of dataelements within a dataset in the file or of data stored in memory. A dataspace in HDF5 can either be
simple
- which is in fact a simple multidimensional array.A dataspace object provides information items which are necessary to describe the data organization
The object encapsulates two buffers (instances of std::vector) which provide this information. (not a dataspace) can grow. This number can be a finite one or can be set to H5Dataspace::UNLIMITED which allows the dataset to grow infinitely along this dimension.
At any time during the lifetime of a H5Dataspace object the dataspace it describes can be resized to any required shape (see the resize() and grow() methods). This makes it easy to adopt the object to your needs. There are many possibilities how to construct a dataspace.
A dataspace representing a scalar value has a rank of 0 and a size of 1.
typedef type_imp::index_vector_type::const_iterator pni::io::nx::h5::h5dataspace::iterator |
|
explicit |
By default a scalar dataspace is constructed. This constructor can always be used in order to store a scalar value. Consequently even a default constructed H5Dataspace is always a valid HDF5 object.
object_error | in case of default construction problems |
pni::io::nx::h5::h5dataspace::h5dataspace | ( | object_imp && | o | ) |
Construct a dataspace from an instance of object_imp.
type_error | in case that the object is not a dataspace |
invalid_object_error | if the object is not valid |
object_error | in case of any other error |
o | rvalue reference to an instance of object_imp |
|
explicit |
This constructor takes a const reference to a container with the current shape of the dataspace. The maximum shape will be equal to the current shape.
object_error | in case of failure |
shape | vector with shape data |
|
explicit |
The constructors takes an rvalue reference to the current shape of the dataspace. The maximum shape will have the same value as the current shape.
object_error | in case of any failure |
shape | rvalue reference to the current shape |
|
privatenoexcept |
|
private |
|
private |
This method will update a dataspace according to the values stored in the two internal buffers.
object_error | if dataspace extent could not have been set |
void pni::io::nx::h5::h5dataspace::apply_selection | ( | const selection & | s | ) | const |
Apply a selection on this dataspace
invalid_object_error | if dataspace is not valid |
object_error | if applying the selection fails |
s | reference to a selection object |
void pni::io::nx::h5::h5dataspace::grow | ( | size_t | dim = 0 , |
size_t | ext = 1 |
||
) |
Grow the dataspace along dimension dim by ext elements. This is a very simple method to enlarge a dataspace along a particular dimension. If dim is larger than the rank of the dataspace an exception will be thrown.
index_error | if dim exceeds rank of dataspace |
invalid_object_error | if the dataspace is not valid |
object_error | if dataspace update fails |
dim | dimension along which to grow |
ext | extend by which to grow |
bool pni::io::nx::h5::h5dataspace::has_selection | ( | ) | const |
Return true if a selection is applied to this dataspace.
object_error | if selection space cannot be determined |
|
noexcept |
bool pni::io::nx::h5::h5dataspace::is_valid | ( | ) | const |
Returns true if the dataspace instance is valid, false otherwise.
object_error | if validity status cannot be obtained |
|
noexcept |
Return a const reference to the object instance holding the HDF5 identifier of the dataset.
size_t pni::io::nx::h5::h5dataspace::rank | ( | ) | const |
Returns the rank (the number of dimensions) of the dataset. This method always returns the total number of dimensions even if a selection is set.
invalid_object_error | if dataspace is not valid |
object_error | in case of any other error |
|
noexcept |
|
noexcept |
size_t pni::io::nx::h5::h5dataspace::size | ( | ) | const |
Returns the total number of elemenets that can be stored in the dataspace. For a scalar dataspace this method returns 1.
invalid_object_error | if dataspace not valid |
object_error | if size could not be determined |
|
private |
|
private |
|
private |