A container class for HDF5 DataSets loaded by an HDF5File.
More...
#include <hdf5.h>
A container class for HDF5 DataSets loaded by an HDF5File.
Definition at line 32 of file hdf5.h.
◆ HDF5Data()
template<typename T >
template IO::HDF5Data::HDF5Data |
( |
const T & |
location, |
|
|
const std::string & |
name |
|
) |
| |
Constructor. Loads reads DataSet from file.
- Parameters
-
[in] | location | Location to read data from. |
[in] | name | Name of object to read. |
- Template Parameters
-
IO::HDF5Data
Definition at line 18 of file hdf5.cpp.
19 :
dataset_(location.openDataSet(name))
24 auto *dims =
new hsize_t[
rank_];
25 space_.getSimpleExtentDims(dims);
const hsize_t * dims_
Dimensions of the dataset (rank_ dimensions)
const void * data_
Data itself.
const H5::DataSet dataset_
Dataset being read from.
const int rank_
Rank of the dataset.
const H5T_class_t type_
Type of the dataset.
const H5::DataSpace space_
Size of the dataset.
std::tuple< H5::PredType, unsigned int, std::string > getDataProperties() const
Return information about the data type of the data.
◆ ~HDF5Data()
IO::HDF5Data::~HDF5Data |
( |
| ) |
|
Destructor. Cleans up all read data.
Definition at line 42 of file hdf5.cpp.
#define ROBOWFLEX_PUSH_DISABLE_GCC_WARNING(warning)
#define ROBOWFLEX_POP_GCC
◆ get()
template<typename T >
template const double & IO::HDF5Data::get |
( |
const std::vector< hsize_t > & |
index | ) |
const |
Get the value at an index.
- Parameters
-
[in] | index | The indices at each dimension. |
- Template Parameters
-
The | return type of the data. |
- Returns
- The value at the index in the data.
Definition at line 99 of file hdf5.cpp.
102 throw Exception(1,
"Index size must be the same as data rank!");
104 const T *data =
reinterpret_cast<const T *
>(
data_);
105 unsigned int offset = 0;
107 for (
int i = 0; i <
rank_; ++i)
108 offset += hpow(
dims_[i], i) * index[
rank_ - (i + 1)];
Exception that contains a message and an error code.
◆ getData()
const void * IO::HDF5Data::getData |
( |
| ) |
const |
Get a pointer to the underlying data array. It is of size type[dim0][dim1]...
- Returns
- A pointer to the data array.
Definition at line 59 of file hdf5.cpp.
◆ getDataProperties()
Return information about the data type of the data.
- Returns
- The H5 type, the size of, and the name of the data type.
Definition at line 116 of file hdf5.cpp.
121 return std::make_tuple(H5::PredType::NATIVE_INT,
sizeof(
int),
"integer");
123 return std::make_tuple(H5::PredType::NATIVE_DOUBLE,
sizeof(
double),
"double");
◆ getDims()
const std::vector< hsize_t > IO::HDF5Data::getDims |
( |
| ) |
const |
Gets the dimensions of the data. Can be used to create the array necessary to store results.
- Returns
- The dimensions of the data.
Definition at line 54 of file hdf5.cpp.
◆ getStatus()
Get a string describing the data.
- Returns
- A string describing the data.
Definition at line 64 of file hdf5.cpp.
68 ss <<
"Rank: " <<
rank_ <<
", ";
71 for (
int i = 0; i <
rank_; ++i)
◆ data_
const void* robowflex::IO::HDF5Data::data_ |
|
private |
Data itself.
Definition at line 84 of file hdf5.h.
◆ dataset_
const H5::DataSet robowflex::IO::HDF5Data::dataset_ |
|
private |
Dataset being read from.
Definition at line 77 of file hdf5.h.
◆ dims_
const hsize_t* robowflex::IO::HDF5Data::dims_ |
|
private |
Dimensions of the dataset (rank_ dimensions)
Definition at line 82 of file hdf5.h.
◆ rank_
const int robowflex::IO::HDF5Data::rank_ |
|
private |
Rank of the dataset.
Definition at line 81 of file hdf5.h.
◆ space_
const H5::DataSpace robowflex::IO::HDF5Data::space_ |
|
private |
Size of the dataset.
Definition at line 78 of file hdf5.h.
◆ type_
const H5T_class_t robowflex::IO::HDF5Data::type_ |
|
private |
Type of the dataset.
Definition at line 80 of file hdf5.h.
The documentation for this class was generated from the following files: