#include <attribute.hpp>
◆ Attribute() [1/2]
- Parameters
-
handle | rvalue reference to the attributes handle |
parent_link | like to the parent object |
◆ Attribute() [2/2]
hdf5::attribute::Attribute::Attribute |
( |
| ) |
|
|
default |
Uses default compiler implementation.
◆ close()
void hdf5::attribute::Attribute::close |
( |
| ) |
|
This method will close the attribute and leave it in an invalid state. A subsequent call to is_valid should return false. The parent link remains valid though.
◆ dataspace()
Returns the dataspace used to create the attribute.
◆ datatype()
Returns a copy of the datatype used to create the attribute.
◆ is_valid()
bool hdf5::attribute::Attribute::is_valid |
( |
| ) |
const |
◆ name()
std::string hdf5::attribute::Attribute::name |
( |
| ) |
const |
◆ operator hid_t()
hdf5::attribute::Attribute::operator hid_t |
( |
| ) |
const |
|
inline |
◆ parent_link()
const node::Link& hdf5::attribute::Attribute::parent_link |
( |
| ) |
const |
|
noexcept |
Return a reference to the node to which the attribute is attached.
◆ read() [1/2]
template<typename T >
void hdf5::attribute::Attribute::read |
( |
T & |
data | ) |
const |
◆ read() [2/2]
template<typename T >
void hdf5::attribute::Attribute::read |
( |
T & |
data, |
|
|
const datatype::Datatype & |
mem_type |
|
) |
| const |
◆ write() [1/5]
void hdf5::attribute::Attribute::write |
( |
const char * |
data | ) |
const |
This is used whenever a string literal must be written to disk.
attribute::Attribute a = dataset.attributes.create<std::string>("note");
a.write("a short text");
You should be aware that this currently only works if the string type used for the attribute is a variable length string.
- Exceptions
-
std::runtime_error | in case of a failure |
◆ write() [2/5]
void hdf5::attribute::Attribute::write |
( |
const char * |
data, |
|
|
const datatype::Datatype & |
mem_type |
|
) |
| const |
◆ write() [3/5]
template<typename T >
void hdf5::attribute::Attribute::write |
( |
const std::initializer_list< T > & |
list | ) |
const |
|
inline |
This method is used if the data to write is provided via an initializer list.
Attribute a = dataset.attributes.create<
int>(
"index_list",{4});
a.write({56,23,4,12});
Attribute()=default
default constructor
Internaly this method stores the content of the list to an instance of std::vector<T> which is then written to the attribute.
- Template Parameters
-
T | type of the list elements |
- Parameters
-
list | reference to the initializer list |
◆ write() [4/5]
template<typename T >
void hdf5::attribute::Attribute::write |
( |
const T & |
data | ) |
const |
Write data to disk. This is the simplest form of writting datat to disk. Its only argument is a reference to the object holding the data which should be written.
- Exceptions
-
std::runtime_error | in case of a failure |
- Template Parameters
-
T | data type to write to disk |
- Parameters
-
data | reference to the datas instance |
◆ write() [5/5]
template<typename T >
void hdf5::attribute::Attribute::write |
( |
const T & |
data, |
|
|
const datatype::Datatype & |
mem_type |
|
) |
| const |
Write data to disk however we can pass a custom memory type to this method. This is particularly useful in the case of string types where the HDF5 datatype cannot be determined uniquely from a C++ type.
String fixed_type = String::fixed(20);
std::string data = "hello";
a.write(data,fixed_type);
@ String
indicates a string type
- Exceptions
-
std::runtime_error | in case of an error |
- Template Parameters
-
- Parameters
-
data | refernce to input data |
mem_type | HDF5 memory type of the input data |
The documentation for this class was generated from the following file: