|
musrfit 1.10.0
|
Template class for storing HDF4 dataset content with attributes. More...
#include <PNeXus.h>
Public Member Functions | |
| PNXdata () | |
| Default constructor. | |
| PNXdata (const H4DataType &dataType) | |
| Constructor with datatype. | |
| H4DataType | GetDataType () const |
| Get the HDF4 DataType. | |
| void | SetDataType (const H4DataType &dataType) |
| Set the HDF4 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< uint32_t > & | GetDimensions () const |
| Get the dimensions of the dataset. | |
| void | SetDimensions (const std::vector< uint32_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 | |
| H4DataType | fDataType |
| HDF4 datatype of the dataset. | |
| std::vector< T > | fData |
| Data storage (flattened multi-dimensional array) | |
| std::vector< uint32_t > | fDimensions |
| Dimensions of the dataset. | |
| std::map< std::string, std::any > | fAttributes |
| Attributes associated with this dataset. | |
Template class for storing HDF4 dataset content with attributes.
The PNXdata class stores data read from an HDF4 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 HDF4 path.
| T | The element type of the dataset (int, float, std::string, etc.) |
Key features:
|
inline |
Default constructor.
Definition at line 375 of file PNeXus.h.
References fDataType, and nxH4::kINT32.
|
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 449 of file PNeXus.h.
References fAttributes.
Referenced by nxH4::PNeXus::ReadDatasetAttributes().
|
inline |
Get an attribute by name.
| name | Attribute name |
| std::out_of_range | if attribute doesn't exist |
Definition at line 459 of file PNeXus.h.
References fAttributes.
|
inline |
Get mutable reference to all attributes.
Definition at line 484 of file PNeXus.h.
References fAttributes.
|
inline |
Get all attributes.
Definition at line 476 of file PNeXus.h.
References fAttributes.
Referenced by nxH4::PNeXus::WriteDatasetAttributes().
|
inline |
|
inline |
Get the data as a vector.
Definition at line 399 of file PNeXus.h.
References fData.
Referenced by nxH4::PNeXus::WriteFloatDataset(), nxH4::PNeXus::WriteIntDataset(), and nxH4::PNeXus::WriteStringDataset().
|
inline |
|
inline |
Get the dimensions of the dataset.
Definition at line 417 of file PNeXus.h.
References fDimensions.
Referenced by nxH4::PNeXus::WriteFloatDataset(), and nxH4::PNeXus::WriteIntDataset().
|
inline |
Get total number of elements.
Definition at line 435 of file PNeXus.h.
References fDimensions.
|
inline |
Get the number of dimensions.
Definition at line 429 of file PNeXus.h.
References fDimensions.
|
inline |
Check if an attribute exists.
| name | Attribute name |
Definition at line 468 of file PNeXus.h.
References fAttributes.
|
inline |
Set the data vector.
| data | Vector of data to store |
Definition at line 411 of file PNeXus.h.
References fData.
Referenced by nxH4::PNeXus::AddDataset(), nxH4::PNeXus::ReadFloatDataset(), nxH4::PNeXus::ReadIntDataset(), and nxH4::PNeXus::ReadStringDataset().
|
inline |
|
inline |
Set the dimensions of the dataset.
| dims | Vector of dimension sizes |
Definition at line 423 of file PNeXus.h.
References fDimensions.
Referenced by nxH4::PNeXus::AddDataset(), nxH4::PNeXus::ReadFloatDataset(), nxH4::PNeXus::ReadIntDataset(), and nxH4::PNeXus::ReadStringDataset().
|
private |
Attributes associated with this dataset.
Definition at line 492 of file PNeXus.h.
Referenced by AddAttribute(), GetAttribute(), GetAttributes(), GetAttributes(), and HasAttribute().
|
private |
|
private |
HDF4 datatype of the dataset.
Definition at line 489 of file PNeXus.h.
Referenced by GetDataType(), PNXdata(), PNXdata(), and SetDataType().
|
private |
Dimensions of the dataset.
Definition at line 491 of file PNeXus.h.
Referenced by GetDimensions(), GetNumElements(), GetRank(), and SetDimensions().