TRIQS/h5 1.3.0
C++ interface to HDF5
|
Specialized functions to read/write a std::optional from/to HDF5.
The following code writes a std::optional to an HDF5 file, reads the same value and outputs it to stdout:
Output:
Contents of optional.h5
:
Classes | |
struct | h5::hdf5_format_impl< std::optional< T > > |
Specialization of h5::hdf5_format_impl for std::optional. More... | |
Functions | |
template<typename T > | |
void | h5::h5_read (group g, std::string name, std::optional< T > &opt) |
Read a std::optional from an HDF5 dataset/subgroup. | |
template<typename T > | |
void | h5::h5_write (group g, std::string const &name, std::optional< T > const &opt) |
Write a std::optional to an HDF5 dataset/subgroup (if it is set). | |
void h5::h5_read | ( | group | g, |
std::string | name, | ||
std::optional< T > & | opt ) |
#include <h5/stl/optional.hpp>
Read a std::optional from an HDF5 dataset/subgroup.
Calls the specialized h5_read
function for the value type of the std::optional.
T | Value type of std::optional. |
g | h5::group containing the dataset/subgroup. |
name | Name of the dataset/subgroup from which the std::optional value is read. |
opt | std::optional to read into. |
Definition at line 71 of file optional.hpp.
void h5::h5_write | ( | group | g, |
std::string const & | name, | ||
std::optional< T > const & | opt ) |
#include <h5/stl/optional.hpp>
Write a std::optional to an HDF5 dataset/subgroup (if it is set).
Calls the specialized h5_write
function for the value type of the std::optional.
T | Value type of std::optional. |
g | h5::group in which the dataset/subgroup is created. |
name | Name of the dataset/subgroup to which the std::optional value is written. |
opt | std::optional to be written. |
Definition at line 56 of file optional.hpp.