9#ifndef H5EASY_BITS_PUBLIC_HPP
10#define H5EASY_BITS_PUBLIC_HPP
12#include "../H5Easy.hpp"
19 m_compression_level = 9;
21 m_compression_level = 0;
32 return m_compression_level;
37 m_overwrite =
static_cast<bool>(mode);
42 m_flush =
static_cast<bool>(mode);
47 m_compression_level = level.
get();
50template <
class T,
class... Args>
60 m_chunk_size = std::vector<hsize_t>(shape.begin(), shape.end());
65 m_chunk_size = std::vector<hsize_t>(shape.begin(), shape.end());
80 return m_compression_level > 0;
85 return m_compression_level;
90 return m_chunk_size.size() > 0;
98inline size_t getSize(
const File& file,
const std::string& path) {
102inline std::vector<size_t>
getShape(
const File& file,
const std::string& path) {
108 const std::string& path,
111 return detail::io_impl<T>::dump(file, path, data, options);
116 const std::string& path,
119 return detail::io_impl<T>::dump(file, path, data,
DumpOptions(mode));
124 const std::string& path,
126 const std::vector<size_t>& idx,
128 return detail::io_impl<T>::dump_extend(file, path, data, idx, options);
133 const std::string& path,
135 const std::initializer_list<size_t>& idx,
137 return detail::io_impl<T>::dump_extend(file, path, data, idx, options);
142 const std::string& path,
144 const std::vector<size_t>& idx) {
145 return detail::io_impl<T>::dump_extend(file, path, data, idx,
DumpOptions());
150 const std::string& path,
152 const std::initializer_list<size_t>& idx) {
153 return detail::io_impl<T>::dump_extend(file, path, data, idx,
DumpOptions());
157inline T
load(
const File& file,
const std::string& path,
const std::vector<size_t>& idx) {
158 return detail::io_impl<T>::load_part(file, path, idx);
162inline T
load(
const File& file,
const std::string& path) {
163 return detail::io_impl<T>::load(file, path);
168 const std::string& path,
169 const std::string& key,
172 return detail::io_impl<T>::dumpAttribute(file, path, key, data,
DumpOptions(mode));
177 const std::string& path,
178 const std::string& key,
181 return detail::io_impl<T>::dumpAttribute(file, path, key, data, options);
186 return detail::io_impl<T>::loadAttribute(file, path, key);
Signal to set compression level for written DataSets.
Definition H5Easy.hpp:92
unsigned get() const
Return compression level.
Definition H5Easy_public.hpp:30
Compression(bool enable=true)
Enable compression with the highest compression level (9). or disable compression (set compression le...
Definition H5Easy_public.hpp:16
Define options for dumping data.
Definition H5Easy.hpp:126
bool flush() const
Get flush-mode.
Definition H5Easy_public.hpp:73
bool isChunked() const
Get chunking mode: true is manually set, false if chunk-size should be computed automatically.
Definition H5Easy_public.hpp:88
std::vector< hsize_t > getChunkSize() const
Get chunk size. Use DumpOptions::getChunkSize to check if chunk-size should be automatically computed...
Definition H5Easy_public.hpp:93
unsigned getCompressionLevel() const
Get compression level.
Definition H5Easy_public.hpp:83
bool overwrite() const
Get overwrite-mode.
Definition H5Easy_public.hpp:68
void set(DumpMode mode)
Overwrite H5Easy::DumpMode setting.
Definition H5Easy_public.hpp:35
bool compress() const
Get compress-mode.
Definition H5Easy_public.hpp:78
void setChunkSize(const std::vector< T > &shape)
Set chunk-size. If the input is rank (size) zero, automatic chunking is enabled.
Definition H5Easy_public.hpp:58
Class representing an attribute of a dataset or group.
Definition H5Attribute.hpp:25
Class representing a dataset.
Definition H5DataSet.hpp:31
size_t getElementCount() const
Get the total number of elements in the current dataset. E.g. 2x2x2 matrix has size 8....
Definition H5DataSet.hpp:89
std::vector< size_t > getDimensions() const
Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()
Definition H5DataSet.hpp:80
File class.
Definition H5File.hpp:26
DataSet getDataSet(const std::string &dataset_name, const DataSetAccessProps &accessProps=DataSetAccessProps::Default()) const
get an existing dataset in the current file
Definition H5Node_traits_misc.hpp:99
Read/dump DataSets or Attribute using a minimalistic syntax. To this end, the functions are templated...
Definition H5Easy.hpp:60
size_t getSize(const File &file, const std::string &path)
Get the size of an existing DataSet in an open HDF5 file.
Definition H5Easy_public.hpp:98
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
DumpMode
Write mode for DataSets.
Definition H5Easy.hpp:76
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 DataSet in an open HDF5 file to a scalar.
Definition H5Easy_public.hpp:157
std::vector< size_t > getShape(const File &file, const std::string &path)
Get the shape of an existing DataSet in an readable file.
Definition H5Easy_public.hpp:102
Flush
Signal to enable/disable automatic flushing after write operations.
Definition H5Easy.hpp:84