h5cpp
0.5.0
A modern C++ wrapper for the HDF5 C library
|
#include <dataset.hpp>
Public Member Functions | |
Dataset ()=default | |
default constructor More... | |
Dataset (const Node &node) | |
construct More... | |
Dataset (const Group &base, const Path &path, const datatype::Datatype &type, const dataspace::Dataspace &space=dataspace::Scalar(), const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::DatasetCreationList &dcpl=property::DatasetCreationList(), const property::DatasetAccessList &dapl=property::DatasetAccessList()) | |
constructor More... | |
dataspace::Dataspace | dataspace () const |
get dataspace of dataset More... | |
property::DatasetCreationList | creation_list () const |
get the dataset creation property list used for creation More... | |
property::DatasetAccessList | access_list () const |
get the dataset access property list for the instance More... | |
datatype::Datatype | datatype () const |
get datatype of dataset More... | |
void | extent (const Dimensions &dims) const |
set extent of the dataset More... | |
void | extent (size_t dim, ssize_t delta_elements) const |
void | resize (const Dimensions &dims) const |
resize the dataset More... | |
void | refresh () const |
refresh the dataset (since hdf5 1.10.0) More... | |
template<typename T > | |
void | write (const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Dataspace &file_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
write data to the dataset More... | |
template<typename T > | |
void | write (const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
write data to the dataset More... | |
template<typename T > | |
void | read (T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Dataspace &file_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
read data from the dataset More... | |
template<typename T > | |
void | read (T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | read_reshape (T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write (const T &data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
write entire dataset More... | |
template<typename T > | |
void | write (const T &data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write_reshape (const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
write entire dataset More... | |
void | write (const char *data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
write entire dataset More... | |
void | write (const char *data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write_chunk (const T &data, std::vector< unsigned long long > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
write dataset chunk More... | |
template<typename T > | |
void | write_chunk (const T &data, std::vector< unsigned long long > offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write_chunk (const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, std::vector< unsigned long long > &offset, std::uint32_t filter_mask=0, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
write dataset chunk More... | |
template<typename T > | |
std::uint32_t | read_chunk (T &data, std::vector< unsigned long long > offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
read dataset chunk (since hdf5 1.10.2) More... | |
template<typename T > | |
std::uint32_t | read_chunk (T &data, const datatype::Datatype &mem_type, std::vector< unsigned long long > &offset, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
read dataset chunk More... | |
unsigned long long | chunk_storage_size (std::vector< unsigned long long > offset) const |
read dataset chunk More... | |
template<typename T > | |
void | read (T &data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
read entire dataset More... | |
template<typename T > | |
void | read (T &data, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write (const T &data, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
write data to a selection More... | |
template<typename T > | |
void | write (const T &data, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | write_reshape (const T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
write data to a selection More... | |
template<typename T > | |
void | read (T &data, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) |
reading data from a selection More... | |
template<typename T > | |
void | read (T &data, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
template<typename T > | |
void | read_reshape (T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space, const dataspace::Selection &selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
reading data from a selection More... | |
template<typename T > | |
void | read (T &data, const datatype::Datatype &memory_type, const dataspace::Dataspace &memory_space, const dataspace::Selection &file_selection, const property::DatasetTransferList &dtpl=property::DatasetTransferList::get()) const |
reading data from a dataset More... | |
filter::ExternalFilters | filters () const |
get the dataset external filters for the instance More... | |
Public Member Functions inherited from hdf5::node::Node | |
Node (ObjectHandle &&handle, const Link &link) | |
constructor More... | |
Node () | |
default constructor More... | |
Node (const Node &) | |
copy constructor More... | |
Node & | operator= (const Node &node) |
copy assignment More... | |
virtual | ~Node () |
destructor More... | |
NodeType | type () const |
return the node type More... | |
ObjectId | id () const |
get unique ID More... | |
operator hid_t () const | |
bool | is_valid () const |
true if an object is valid More... | |
void | close () |
close the node More... | |
const Link & | link () const |
return link to object More... | |
Additional Inherited Members | |
Public Attributes inherited from hdf5::node::Node | |
attribute::AttributeManager | attributes |
access to the attribute manager More... | |
|
default |
Use default implementation here. We need this for some STL containers. After default construction the dataset is in an invalid state.
hdf5::node::Dataset::Dataset | ( | const Node & | node | ) |
Construct a dataset from a node instance.
std::runtime_error | in case that the node is not a dataset |
node | reference to the original node from which to construct the dataset. |
hdf5::node::Dataset::Dataset | ( | const Group & | base, |
const Path & | path, | ||
const datatype::Datatype & | type, | ||
const dataspace::Dataspace & | space = dataspace::Scalar() , |
||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::DatasetCreationList & | dcpl = property::DatasetCreationList() , |
||
const property::DatasetAccessList & | dapl = property::DatasetAccessList() |
||
) |
std::runtime_error | in case of a failure |
base | the base object for the dataset creation |
path | the path to the new dataset |
type | optional reference to a datatype |
space | optional reference to a dataspace (default is a scalar one) |
lcpl | optional reference to a link creation property list |
dcpl | optional reference to a dataset creation property list |
dapl | optional reference to a dataset access property list |
property::DatasetAccessList hdf5::node::Dataset::access_list | ( | ) | const |
Returns an instance of the dataset access property list for the dataset.
std::runtime_error | in case of a failure |
unsigned long long hdf5::node::Dataset::chunk_storage_size | ( | std::vector< unsigned long long > | offset | ) | const |
Read a chunk storage size from a dataset to an instance of T.
std::runtime_error | in case of a failure |
offset | logical position of the first element of the chunk in the dataset's dataspace |
property::DatasetCreationList hdf5::node::Dataset::creation_list | ( | ) | const |
Returns an instance of a dataset creation property list with the values used for the creation of the dataset.
std::runtime_error | in case of a failure |
dataspace::Dataspace hdf5::node::Dataset::dataspace | ( | ) | const |
Return a new instance of the dataspace describing the dataset.
std::runtime_error | in case of a failure |
datatype::Datatype hdf5::node::Dataset::datatype | ( | ) | const |
Return an instance of the datatype describing the elements stored in the file.
std::runtime_error | in case of a failure |
void hdf5::node::Dataset::extent | ( | const Dimensions & | dims | ) | const |
Allows to change the extent (number of elements along each dimensions) of a dataset. It is important to note that in such a case a previously requested dataspace though remaining a valid object does no longer describe the datasets layout correctly. The number of elements can be increased or decreased within the limits of the dataspace originally used to create the dataset.
std::runtime_error | in case of a failure |
dims | vector with new number of elements along each dimension |
void hdf5::node::Dataset::extent | ( | size_t | dim, |
ssize_t | delta_elements | ||
) | const |
filter::ExternalFilters hdf5::node::Dataset::filters | ( | ) | const |
Returns an instance of the dataset external filters for the dataset.
std::runtime_error | in case of a failure |
void hdf5::node::Dataset::read | ( | T & | data, |
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Reading data to an instance of T from a selection of a dataset. It reshapes the mem_space if its rank does not match to the selection rank
std::runtime_error | in case of a failure |
T | type of the destination object |
data | reference to the destination object |
selection | reference to the selection |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::read | ( | T & | data, |
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::read | ( | T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const dataspace::Dataspace & | file_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
This template function a very simple wrapper around the original HDF5 C-API function. The major difference is that a type trait is used to obtain a pointer to the data passed as the first argument. This template is provided for maximum flexibility as it allows virtually to do everything which could be done with the C-API.
std::runtime_error | in case of a failure |
T | type from which to write data |
data | const reference to the data source |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
file_space | reference to the dataspace in the file |
dtpl | data transfer property list |
void hdf5::node::Dataset::read | ( | T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::read | ( | T & | data, |
const datatype::Datatype & | memory_type, | ||
const dataspace::Dataspace & | memory_space, | ||
const dataspace::Selection & | file_selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
std::runtime_error | in case of a failure |
data | reference to the target to which to read the data |
memory_type | reference to the memory data type of the target |
memory_space | reference to the memory data space of the target |
file_selection | reference to the selection for the file dataspace |
dtpl | optional reference to a dataset transfer property list |
void hdf5::node::Dataset::read | ( | T & | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Read the entire data from a dataset to an instance of T.
std::runtime_error | in case of a failre |
T | destination type |
data | reference to the destination |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::read | ( | T & | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
std::uint32_t hdf5::node::Dataset::read_chunk | ( | T & | data, |
const datatype::Datatype & | mem_type, | ||
std::vector< unsigned long long > & | offset, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Read a chunk from a dataset to an instance of T.
std::runtime_error | in case of a failure |
T | source type |
data | reference to the source instance of T |
mem_type | reference to the memory data type |
offset | logical position of the first element of the chunk in the dataset's dataspace |
dtpl | reference to a dataset transfer property list |
std::uint32_t hdf5::node::Dataset::read_chunk | ( | T & | data, |
std::vector< unsigned long long > | offset, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Read a chunk from a dataset to an instance of T.
std::runtime_error | in case of a failure |
T | source type |
data | reference to the source instance of T |
offset | logical position of the first element of the chunk in the dataset's dataspace |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::read_reshape | ( | T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Reading data to an instance of T from a selection of a dataset. This template method tries to deduce the memory type and memory space for the target type (where to write the data to) automatically using the appropriate type traits.
std::runtime_error | in case of a failure |
T | type of the destination object |
data | reference to the destination object |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
selection | reference to the selection |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::read_reshape | ( | T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::refresh | ( | ) | const |
std::runtime_error | in case of a failure |
void hdf5::node::Dataset::resize | ( | const Dimensions & | dims | ) | const |
Allows to change the shape (number of elements along each dimensions) of a dataset. It is important to note that in such a case a previously requested dataspace though remaining a valid object does no longer describe the datasets layout correctly. The number of elements can be increased or decreased within the limits of the dataspace originally used to create the dataset.
std::runtime_error | in case of a failure |
dims | vector with new number of elements along each dimension |
void hdf5::node::Dataset::write | ( | const char * | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Write the entire dataset from an instance of const char *
std::runtime_error | in caes of a failure |
data | pointer to the source instance of const char * |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write | ( | const char * | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::write | ( | const T & | data, |
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Write data from an instance of T to a selection of the dataset.
std::runtime_error | in case of a failure |
T | type of the source |
data | reference to the source |
selection | reference to the selection |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write | ( | const T & | data, |
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::write | ( | const T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const dataspace::Dataspace & | file_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
This template function a very simple wrapper around the original HDF5 C-API function. The major difference is that a type trait is used to obtain a pointer to the data passed as the first argument. This template is provided for maximum flexibility as it allows virtually to do everything which could be done with the C-API.
std::runtime_error | in case of a failure |
T | type from which to write data |
data | const reference to the data source |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
file_space | reference to the dataspace in the file |
dtpl | data transfer property list |
void hdf5::node::Dataset::write | ( | const T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
This function allows specification of the memory dataspace and dataspace and optionally the dataset transfer property list.
void hdf5::node::Dataset::write | ( | const T & | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Write the entire dataset from an instance of T.
std::runtime_error | in caes of a failure |
T | source type |
data | reference to the source instance of T |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write | ( | const T & | data, |
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::write_chunk | ( | const T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
std::vector< unsigned long long > & | offset, | ||
std::uint32_t | filter_mask = 0 , |
||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Write a dataset chunk from an instance of T.
std::runtime_error | in case of a failure |
T | source type |
data | reference to the source instance of T |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
offset | logical position of the first element of the chunk in the dataset's dataspace |
filter_mask | mask of which filters are used with the chunk |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write_chunk | ( | const T & | data, |
std::vector< unsigned long long > | offset, | ||
std::uint32_t | filter_mask = 0 , |
||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) |
Write a dataset chunk from an instance of T.
std::runtime_error | in case of a failure |
T | source type |
data | reference to the source instance of T |
offset | logical position of the first element of the chunk in the dataset's dataspace |
filter_mask | mask of which filters are used with the chunk |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write_chunk | ( | const T & | data, |
std::vector< unsigned long long > | offset, | ||
std::uint32_t | filter_mask = 0 , |
||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
void hdf5::node::Dataset::write_reshape | ( | const T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const dataspace::Selection & | selection, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Write data from an instance of T to a selection of the dataset. It reshapes the mem_space if its rank does not match to the selection rank
std::runtime_error | in case of a failure |
T | type of the source |
data | reference to the source |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
selection | reference to the selection |
dtpl | reference to a dataset transfer property list |
void hdf5::node::Dataset::write_reshape | ( | const T & | data, |
const datatype::Datatype & | mem_type, | ||
const dataspace::Dataspace & | mem_space, | ||
const property::DatasetTransferList & | dtpl = property::DatasetTransferList::get() |
||
) | const |
Write the entire dataset from an instance of T. It reshapes the mem_space if its rank does not match to the selection rank
std::runtime_error | in caes of a failure |
T | source type |
data | reference to the source instance of T |
mem_type | reference to the memory data type |
mem_space | reference to the memory data space |
dtpl | reference to a dataset transfer property list |