|
musrfit 1.10.0
|
Template class for storing HDF5 dataset content with attributes. More...
#include <PNeXus.h>
Public Member Functions | |
| PNXdata () | |
| Default constructor. | |
| PNXdata (const H5::DataType &dataType) | |
| Constructor with datatype. | |
| H5::DataType | GetDataType () const |
| Get the HDF5 DataType. | |
| void | SetDataType (const H5::DataType &dataType) |
| Set the HDF5 DataType. | |
| const std::vector< T > & | GetData () const |
| Get the data as a vector. | |
| std::vector< T > & | GetData () |
| Get mutable reference to the data vector. | |
| void | SetData (const std::vector< T > &data) |
| Set the data vector. | |
| const std::vector< hsize_t > & | GetDimensions () const |
| Get the dimensions of the dataset. | |
| void | SetDimensions (const std::vector< hsize_t > &dims) |
| Set the dimensions of the dataset. | |
| size_t | GetRank () const |
| Get the number of dimensions. | |
| size_t | GetNumElements () const |
| Get total number of elements. | |
| void | AddAttribute (const std::string &name, const std::any &value) |
| Add an attribute to this dataset. | |
| std::any | GetAttribute (const std::string &name) const |
| Get an attribute by name. | |
| bool | HasAttribute (const std::string &name) const |
| Check if an attribute exists. | |
| const std::map< std::string, std::any > & | GetAttributes () const |
| Get all attributes. | |
| std::map< std::string, std::any > & | GetAttributes () |
| Get mutable reference to all attributes. | |
Private Attributes | |
| H5::DataType | fDataType |
| HDF5 datatype of the dataset. | |
| std::vector< T > | fData |
| Data storage (flattened multi-dimensional array) | |
| std::vector< hsize_t > | fDimensions |
| Dimensions of the dataset. | |
| std::map< std::string, std::any > | fAttributes |
| Attributes associated with this dataset. | |
Template class for storing HDF5 dataset content with attributes.
The PNXdata class stores data read from an HDF5 dataset along with metadata such as dimensions, datatype, and attributes. It is designed to be stored in std::map<std::string, std::any> where the key is the HDF5 path.
| T | The element type of the dataset (int, float, std::string, etc.) |
Key features:
|
inline |
|
inline |
|
inline |
Add an attribute to this dataset.
| name | Attribute name |
| value | Attribute value (stored as std::any to support different types) |
Definition at line 1395 of file PNeXus.h.
References fAttributes.
Referenced by nxH5::PNeXus::ReadDatasetAttributes().
|
inline |
Get an attribute by name.
| name | Attribute name |
| std::out_of_range | if attribute doesn't exist |
Definition at line 1405 of file PNeXus.h.
References fAttributes.
|
inline |
Get mutable reference to all attributes.
Definition at line 1430 of file PNeXus.h.
References fAttributes.
|
inline |
Get all attributes.
Definition at line 1422 of file PNeXus.h.
References fAttributes.
Referenced by nxH5::PNeXus::WriteDatasetAttributes().
|
inline |
|
inline |
Get the data as a vector.
Definition at line 1345 of file PNeXus.h.
References fData.
Referenced by nxH5::PNeXus::WriteFloatDataset(), nxH5::PNeXus::WriteIntDataset(), and nxH5::PNeXus::WriteStringDataset().
|
inline |
|
inline |
Get the dimensions of the dataset.
Definition at line 1363 of file PNeXus.h.
References fDimensions.
Referenced by nxH5::PNeXus::WriteFloatDataset(), nxH5::PNeXus::WriteIntDataset(), and nxH5::PNeXus::WriteStringDataset().
|
inline |
Get total number of elements.
Definition at line 1381 of file PNeXus.h.
References fDimensions.
Referenced by nxH5::PNeXus::WriteFloatDataset(), and nxH5::PNeXus::WriteIntDataset().
|
inline |
Get the number of dimensions.
Definition at line 1375 of file PNeXus.h.
References fDimensions.
|
inline |
Check if an attribute exists.
| name | Attribute name |
Definition at line 1414 of file PNeXus.h.
References fAttributes.
|
inline |
Set the data vector.
| data | Vector of data to store |
Definition at line 1357 of file PNeXus.h.
References fData.
Referenced by nxH5::PNeXus::AddDataset(), nxH5::PNeXus::ReadFloatDataset(), nxH5::PNeXus::ReadIntDataset(), and nxH5::PNeXus::ReadStringDataset().
|
inline |
|
inline |
Set the dimensions of the dataset.
| dims | Vector of dimension sizes |
Definition at line 1369 of file PNeXus.h.
References fDimensions.
Referenced by nxH5::PNeXus::AddDataset(), nxH5::PNeXus::ReadFloatDataset(), nxH5::PNeXus::ReadIntDataset(), and nxH5::PNeXus::ReadStringDataset().
|
private |
Attributes associated with this dataset.
Definition at line 1438 of file PNeXus.h.
Referenced by AddAttribute(), GetAttribute(), GetAttributes(), GetAttributes(), and HasAttribute().
|
private |
|
private |
HDF5 datatype of the dataset.
Definition at line 1435 of file PNeXus.h.
Referenced by GetDataType(), PNXdata(), PNXdata(), and SetDataType().
|
private |
Dimensions of the dataset.
Definition at line 1437 of file PNeXus.h.
Referenced by GetDimensions(), GetNumElements(), GetRank(), and SetDimensions().