9 #ifndef H5EASY_BITS_VECTOR_HPP
10 #define H5EASY_BITS_VECTOR_HPP
12 #include "../H5Easy.hpp"
21 struct is_vector : std::false_type {};
23 struct is_vector<std::vector<T>> : std::true_type {};
25 using HighFive::details::get_dim_vector;
26 using HighFive::details::type_of_array;
29 struct io_impl<T, typename std::enable_if<is_vector<T>::value>::type> {
31 inline static DataSet
dump(File& file,
32 const std::string& path,
34 const DumpOptions& options) {
35 using value_type =
typename type_of_array<T>::type;
36 DataSet dataset = initDataset<value_type>(file, path, get_dim_vector(data), options);
38 if (options.flush()) {
44 inline static T
load(
const File& file,
const std::string& path) {
45 DataSet dataset = file.getDataSet(path);
52 const std::string& path,
53 const std::string& key,
55 const DumpOptions& options) {
56 using value_type =
typename type_of_array<T>::type;
57 std::vector<size_t> shape = get_dim_vector(data);
58 Attribute attribute = initAttribute<value_type>(file, path, key, shape, options);
59 attribute.write(data);
60 if (options.flush()) {
67 const std::string& path,
68 const std::string& key) {
69 DataSet dataset = file.getDataSet(path);
70 Attribute attribute = dataset.getAttribute(key);
Definition: H5Easy.hpp:51
DataSet dump(File &file, const std::string &path, const T &data, DumpMode mode=DumpMode::Create)
Write object (templated) to a (new) DataSet in an open HDF5 file.
Definition: H5Easy_public.hpp:115
T loadAttribute(const File &file, const std::string &path, const std::string &key)
Load a Attribute in an open HDF5 file to an object (templated).
Definition: H5Easy_public.hpp:185
Attribute dumpAttribute(File &file, const std::string &path, const std::string &key, const T &data, DumpMode mode=DumpMode::Create)
Write object (templated) to a (new) Attribute in an open HDF5 file.
Definition: H5Easy_public.hpp:167
T load(const File &file, const std::string &path, const std::vector< size_t > &idx)
Load entry "(i,j)" from a rank-two DataSet in an open HDF5 file to a scalar.
Definition: H5Easy_public.hpp:157