TRIQS/h5 1.3.0
C++ interface to HDF5
|
Specialized functions to read/write a std::vector from/to HDF5.
The following code writes a std::vector to an HDF5 file, reads the same vector and outputs it to stdout:
Output:
Contents of vec.h5
:
Classes | |
struct | h5::hdf5_format_impl< std::vector< std::string > > |
Specialization of h5::hdf5_format_impl for std::vector<std::string>. More... | |
struct | h5::hdf5_format_impl< std::vector< T > > |
Specialization of h5::hdf5_format_impl for std::vector. More... | |
Functions | |
void | h5::from_char_buf (char_buf const &cb, std::vector< std::string > &v) |
Create a vector of strings from an h5::char_buf. | |
void | h5::from_char_buf (char_buf const &cb, std::vector< std::vector< std::string > > &v) |
Create a vector of vectors of strings from an h5::char_buf. | |
template<typename T > | |
void | h5::h5_read (group g, std::string name, std::vector< T > &v) |
Read a std::vector from an HDF5 dataset/subgroup. | |
void | h5::h5_read_attribute (object obj, std::string const &name, std::vector< std::string > &v) |
Read a vector of strings from an HDF5 attribute. | |
void | h5::h5_read_attribute (object obj, std::string const &name, std::vector< std::vector< std::string > > &v) |
Read a vector of vectors of strings from an HDF5 attribute. | |
template<typename T > | |
void | h5::h5_write (group g, std::string const &name, std::vector< T > const &v) |
Write a std::vector to an HDF5 dataset/subgroup. | |
void | h5::h5_write_attribute (object obj, std::string const &name, std::vector< std::string > const &v) |
Write a vectors of strings to an HDF5 attribute. | |
void | h5::h5_write_attribute (object obj, std::string const &name, std::vector< std::vector< std::string > > const &v) |
Write a vector of vectors of strings to an HDF5 attribute. | |
char_buf | h5::to_char_buf (std::vector< std::string > const &v) |
Create an h5::char_buf from a vector of strings. | |
char_buf | h5::to_char_buf (std::vector< std::vector< std::string > > const &v) |
Create an h5::char_buf from a vector of vectors of strings. | |
void h5::from_char_buf | ( | char_buf const & | cb, |
std::vector< std::string > & | v ) |
#include <h5/stl/vector.cpp>
Create a vector of strings from an h5::char_buf.
cb | h5::char_buf. |
v | Vector of strings. |
Definition at line 73 of file vector.cpp.
void h5::from_char_buf | ( | char_buf const & | cb, |
std::vector< std::vector< std::string > > & | v ) |
#include <h5/stl/vector.cpp>
Create a vector of vectors of strings from an h5::char_buf.
cb | h5::char_buf. |
v | Vector of vectors of strings. |
Definition at line 90 of file vector.cpp.
void h5::h5_read | ( | group | g, |
std::string | name, | ||
std::vector< T > & | v ) |
#include <h5/stl/vector.hpp>
Read a std::vector from an HDF5 dataset/subgroup.
Depending on the type of T
, the following is read:
T
is a simple type (arithmetic or complex), a 1d dataset is read.T
is std::string
, an h5::char_buf is read, i.e. a 2d dataset of char with dimensions (length of vector, max length of strings).T | Value tupe of std::vector. |
g | h5::group containing the dataset/subgroup. |
name | Name of the dataset/subgroup from which the std::vector is read. |
v | std::vector to read into. |
Definition at line 149 of file vector.hpp.
void h5::h5_read_attribute | ( | object | obj, |
std::string const & | name, | ||
std::vector< std::string > & | v ) |
#include <h5/stl/vector.cpp>
Read a vector of strings from an HDF5 attribute.
obj | Parent h5::object to which the attribute is attached. |
name | Name of the attribute. |
v | Vector of strings to read into. |
Definition at line 116 of file vector.cpp.
void h5::h5_read_attribute | ( | object | obj, |
std::string const & | name, | ||
std::vector< std::vector< std::string > > & | v ) |
#include <h5/stl/vector.cpp>
Read a vector of vectors of strings from an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
v | Vector of vectors of strings to read into. |
Definition at line 122 of file vector.cpp.
void h5::h5_write | ( | group | g, |
std::string const & | name, | ||
std::vector< T > const & | v ) |
#include <h5/stl/vector.hpp>
Write a std::vector to an HDF5 dataset/subgroup.
Depending on the type of T
, the following is written:
T
is a simple type (arithmetic or complex), a 1d dataset is written.T
is std::string
, an h5::char_buf is written, i.e. a 2d dataset of char with dimensions (length of vector, max length of strings).T | Value tupe of std::vector. |
g | h5::group in which the dataset/subgroup is created. |
name | Name of the dataset/subgroup to which the std::vector is written. |
v | std::vector to be written. |
Definition at line 119 of file vector.hpp.
void h5::h5_write_attribute | ( | object | obj, |
std::string const & | name, | ||
std::vector< std::string > const & | v ) |
#include <h5/stl/vector.cpp>
Write a vectors of strings to an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
v | Vector of strings to be written. |
Definition at line 110 of file vector.cpp.
void h5::h5_write_attribute | ( | object | obj, |
std::string const & | name, | ||
std::vector< std::vector< std::string > > const & | v ) |
#include <h5/stl/vector.cpp>
Write a vector of vectors of strings to an HDF5 attribute.
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
v | Vector of vectors of strings to be written. |
Definition at line 112 of file vector.cpp.
char_buf h5::to_char_buf | ( | std::vector< std::string > const & | v | ) |
#include <h5/stl/vector.cpp>
Create an h5::char_buf from a vector of strings.
v | Vector of strings. |
Definition at line 33 of file vector.cpp.
char_buf h5::to_char_buf | ( | std::vector< std::vector< std::string > > const & | v | ) |
#include <h5/stl/vector.cpp>
Create an h5::char_buf from a vector of vectors of strings.
v | Vector of a vector of strings. |
Definition at line 52 of file vector.cpp.