TRIQS/h5 1.3.0
C++ interface to HDF5
|
Specialized functions to read/write std::string, const char *
and a generic character buffer (h5::char_buf) from/to HDF5.
The following code writes a string to an HDF5 file, reads the same string and outputs it to stdout:
Output:
Contents of string.h5
:
Classes | |
struct | h5::char_buf |
Stores an arbitrary number of strings in a 1-dimensional std::vector<char>. More... | |
struct | h5::hdf5_format_impl< std::string > |
Specialization of h5::hdf5_format_impl for std::string. More... | |
Functions | |
void | h5::h5_read (group g, std::string const &name, char *s)=delete |
Read a string from an HDF5 dataset into a char* . | |
void | h5::h5_read (group g, std::string const &name, char_buf &cb) |
Read an h5::char_buf from an HDF5 dataset. | |
void | h5::h5_read (group g, std::string const &name, std::string &s) |
Read a string from an HDF5 dataset into a std::string. | |
void | h5::h5_read_attribute (object obj, std::string const &name, char *s)=delete |
Read a string from an HDF5 attribute into a char* . | |
void | h5::h5_read_attribute (object obj, std::string const &name, char_buf &cb) |
Read an h5::char_buf from an HDF5 attribute. | |
void | h5::h5_read_attribute (object obj, std::string const &name, std::string &s) |
Read a string from an HDF5 attribute into a std::string. | |
void | h5::h5_read_attribute_from_key (group g, std::string const &key, std::string const &name, std::string &s) |
Read a string from an HDF5 attribute into a std::string. | |
void | h5::h5_write (group g, std::string const &name, char_buf const &cb) |
Write an h5::char_buf to an HDF5 dataset. | |
void | h5::h5_write (group g, std::string const &name, const char *s) |
Write a const char* to an HDF5 dataset. | |
void | h5::h5_write (group g, std::string const &name, std::string const &s) |
Write a std::string to an HDF5 dataset. | |
void | h5::h5_write_attribute (object obj, std::string const &name, char_buf const &cb) |
Write an h5::char_buf to an HDF5 attribute. | |
void | h5::h5_write_attribute (object obj, std::string const &name, const char *s) |
Write a const char* to an HDF5 attribute. | |
void | h5::h5_write_attribute (object obj, std::string const &name, std::string const &s) |
Write a std::string to an HDF5 attribute. | |
void | h5::h5_write_attribute_to_key (group g, std::string const &key, std::string const &name, const char *s) |
Write a const char* to an HDF5 attribute. | |
void | h5::h5_write_attribute_to_key (group g, std::string const &key, std::string const &name, std::string const &s) |
Write a std::string to an HDF5 attribute. | |
|
inlinedelete |
#include <h5/stl/string.hpp>
Read a string from an HDF5 dataset into a char*
.
char*
is not allowed. Use h5::h5_read(group, std::string const &, std::string &) instead. #include <h5/stl/string.cpp>
Read an h5::char_buf from an HDF5 dataset.
g | h5::group containing the dataset. |
name | Name of the dataset. |
cb | h5::char_buf to read into. |
Definition at line 215 of file string.cpp.
void h5::h5_read | ( | group | g, |
std::string const & | name, | ||
std::string & | s ) |
#include <h5/stl/string.cpp>
Read a string from an HDF5 dataset into a std::string.
g | h5::group containing the dataset. |
name | Name of the dataset. |
s | std::string to read into. |
Definition at line 67 of file string.cpp.
|
inlinedelete |
#include <h5/stl/string.hpp>
Read a string from an HDF5 attribute into a char*
.
char*
is not allowed. Use h5::h5_read_attribute(object, std::string const &, std::string &) instead. #include <h5/stl/string.cpp>
Read an h5::char_buf from an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
cb | h5::char_buf to read into. |
Definition at line 257 of file string.cpp.
void h5::h5_read_attribute | ( | object | obj, |
std::string const & | name, | ||
std::string & | s ) |
#include <h5/stl/string.cpp>
Read a string from an HDF5 attribute into a std::string.
If the attribute does not exist, an empty string is returned.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
s | std::string to read into. |
Definition at line 114 of file string.cpp.
void h5::h5_read_attribute_from_key | ( | group | g, |
std::string const & | key, | ||
std::string const & | name, | ||
std::string & | s ) |
#include <h5/stl/string.cpp>
Read a string from an HDF5 attribute into a std::string.
If the attribute does not exist, an empty string is returned.
g | h5::group containing the HDF5 object to which the attribute is attached. |
key | Name of the object. |
name | Name of the attribute. |
s | std::string to read into. |
Definition at line 161 of file string.cpp.
#include <h5/stl/string.cpp>
Write an h5::char_buf to an HDF5 dataset.
g | h5::group in which the dataset is created. |
name | Name of the dataset. |
cb | h5::char_buf to be written. |
Definition at line 204 of file string.cpp.
|
inline |
#include <h5/stl/string.hpp>
Write a const char*
to an HDF5 dataset.
g | h5::group in which the dataset is created. |
name | Name of the dataset. |
s | const char* to be written. |
Definition at line 63 of file string.hpp.
void h5::h5_write | ( | group | g, |
std::string const & | name, | ||
std::string const & | s ) |
#include <h5/stl/string.cpp>
Write a std::string to an HDF5 dataset.
g | h5::group in which the dataset is created. |
name | Name of the dataset. |
s | std::string to be written. |
Definition at line 55 of file string.cpp.
#include <h5/stl/string.cpp>
Write an h5::char_buf to an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
cb | h5::char_buf to be written. |
Definition at line 243 of file string.cpp.
|
inline |
#include <h5/stl/string.hpp>
Write a const char*
to an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
s | 'const char*' to be written. |
Definition at line 96 of file string.hpp.
void h5::h5_write_attribute | ( | object | obj, |
std::string const & | name, | ||
std::string const & | s ) |
#include <h5/stl/string.cpp>
Write a std::string to an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
s | std::string to be written. |
Definition at line 99 of file string.cpp.
|
inline |
#include <h5/stl/string.hpp>
Write a const char*
to an HDF5 attribute.
g | h5::group containing the HDF5 object to which the attribute is attached. |
key | Name of the object. |
name | Name of the attribute. |
s | const char* to be written. |
Definition at line 133 of file string.hpp.
void h5::h5_write_attribute_to_key | ( | group | g, |
std::string const & | key, | ||
std::string const & | name, | ||
std::string const & | s ) |
#include <h5/stl/string.cpp>
Write a std::string to an HDF5 attribute.
g | h5::group containing the HDF5 object to which the attribute is attached. |
key | Name of the object. |
name | Name of the attribute. |
s | std::string to be written. |
Definition at line 147 of file string.cpp.