6 #ifndef ECHELON_HDF5_GROUP_HPP 7 #define ECHELON_HDF5_GROUP_HPP 9 #include <echelon/hdf5/object.hpp> 10 #include <echelon/hdf5/type.hpp> 11 #include <echelon/hdf5/type_factory.hpp> 12 #include <echelon/hdf5/precursor/group.hpp> 13 #include <echelon/hdf5/attribute_repository.hpp> 14 #include <echelon/hdf5/dataset.hpp> 15 #include <echelon/hdf5/scalar_dataset.hpp> 16 #include <echelon/hdf5/object_reference.hpp> 17 #include <echelon/hdf5/utility.hpp> 18 #include <echelon/hdf5/link.hpp> 20 #include <echelon/hdf5/broken_contract_exception.hpp> 22 #include <echelon/hdf5/precursor/dataspace.hpp> 37 using precursor::unlimited;
60 const char*
what() const noexcept
override 83 auto_chunking_ = value;
96 compression_level_ = value;
105 shuffle_filter_ = value;
118 chunk_shape_ = std::move(value);
127 return auto_chunking_;
134 return compression_level_;
141 return shuffle_filter_;
152 bool auto_chunking_ =
false;
153 bool shuffle_filter_ =
false;
154 int compression_level_ = -1;
155 std::vector<hsize_t> chunk_shape_ = {};
181 group create_group(
const std::string& name);
198 dataset create_dataset(
const std::string& name,
const type& datatype,
199 const std::vector<hsize_t>& dims,
const dataset_options& options = {});
221 dataset create_dataset(
const std::string& name,
const type& datatype,
222 const std::vector<hsize_t>& dims,
const std::vector<hsize_t>& max_dims,
242 template <
typename T>
246 return create_dataset(name, get_hdf5_type<T>(), dims, options);
271 template <
typename T>
273 const std::vector<hsize_t>& max_dims,
const dataset_options& options = {})
275 return create_dataset(name, get_hdf5_type<T>(), dims, max_dims, options);
296 template <
typename T>
299 return create_scalar_dataset(name, get_hdf5_type<T>());
313 template <
typename T>
329 object operator[](
const std::string& name)
const;
336 void remove(
const std::string& name)
const;
346 group require_group(
const std::string& name);
378 dataset require_dataset(
const std::string& name,
const type& datatype,
379 const std::vector<hsize_t>& dims,
const dataset_options& options = {});
413 template <
typename T>
417 return require_dataset(name, get_hdf5_type<T>(), dims, options);
468 template <
typename T>
471 return require_scalar_dataset(name, get_hdf5_type<T>());
500 template <
typename T>
503 type datatype = get_hdf5_type<T>();
505 if (exists(*
this, name) &&
506 get_object_type_by_name(*
this, name) == object_type::scalar_dataset)
508 scalar_dataset ds(hdf5::precursor::dataset(native_handle().
id(), name,
509 hdf5::precursor::default_property_list));
513 "match the datatype of the dataset.");
532 void iterate_links(
const std::function<
void(
const link&)>& op)
const;
539 void visit_links(
const std::function<
void(
const link&)>& visitor)
const;
547 void visit_objects(
const std::function<
void(
const object&)>& visitor)
const;
559 explicit operator bool()
const;
561 friend class constructor_access;
564 enum class creation_mode
570 explicit group(
const file& loc,
const std::string& name =
"/");
571 group(
const object& parent,
const std::string& name, creation_mode mode);
573 dataset create_dataset(
const std::string& name,
const type& datatype,
574 const std::vector<hsize_t>& dims,
const std::vector<hsize_t>& max_dims,
575 int comp_level,
bool auto_chunking,
bool shuffle_filter,
576 const std::vector<hsize_t> chunk_shape);
578 hdf5::precursor::group group_wrapper_;
echelon's core namespace
Definition: attribute.cpp:10
A handle to an HDF5 dataset.
Definition: hdf5/dataset.hpp:62
~non_existing_member_exception() noexcept
The destructor.
Definition: hdf5/group.hpp:54
Polymorphic handle to an HDF5 object.
Definition: hdf5/object.hpp:57
scalar_dataset create_scalar_dataset(const std::string &name)
Creates a new HDF5 scalar dataset within this group.
Definition: hdf5/group.hpp:297
scalar_dataset require_scalar_dataset(const std::string &name)
Returns the requested scalar dataset, if it already exists, otherwise the scalar dataset is created...
Definition: hdf5/group.hpp:469
const std::vector< hsize_t > & chunk_shape() const
chunk shape
Definition: hdf5/group.hpp:146
dataset_options & auto_chunking(bool value)
Enables/Disables auto-chunking.
Definition: hdf5/group.hpp:81
dataset create_dataset(const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options={})
Creates a new HDF5 dataset within this group.
Definition: hdf5/group.hpp:243
A handle to an HDF5 group object.
Definition: hdf5/group.hpp:161
dataset create_dataset(const std::string &name, const std::vector< hsize_t > &dims, const std::vector< hsize_t > &max_dims, const dataset_options &options={})
Creates a new HDF5 dataset within this group.
Definition: hdf5/group.hpp:272
Exception, which is thrown, if a requested object does not exist.
Definition: hdf5/group.hpp:41
A handle to an HDF5 file object.
Definition: hdf5/file.hpp:26
type datatype() const
The value type of the scalar dataset.
Definition: hdf5/scalar_dataset.cpp:27
dataset require_dataset(const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options={})
Returns the requested dataset, if it already exists, otherwise a new dataset is created.
Definition: hdf5/group.hpp:414
dataset_options & compression_level(int value)
Sets the gzip compression level (0 - 9) of the dataset.
Definition: hdf5/group.hpp:94
A link (directed edge) between two HDF5 objects.
Definition: hdf5/link.hpp:18
non_existing_member_exception(std::string what_)
Creates a new exception with a given error description.
Definition: hdf5/group.hpp:48
hdf5::precursor::group native_handle_type
Type of the underlying HDF5 low-level handle.
Definition: hdf5/group.hpp:166
A handle to an HDF5 type.
Definition: hdf5/type.hpp:23
Attribute manager, which should be embedded into a parent object, which supports attributes.
Definition: hdf5/attribute_repository.hpp:52
scalar_dataset require_scalar_dataset(const std::string &name, const T &value)
Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created...
Definition: hdf5/group.hpp:501
bool auto_chunking() const
auto-chunking option
Definition: hdf5/group.hpp:125
dataset_options & chunk_shape(std::vector< hsize_t > value)
Sets the chunk shape of the dataset.
Definition: hdf5/group.hpp:116
dataset_options & shuffle_filter(bool value)
Enables/disables the shuffle filter.
Definition: hdf5/group.hpp:103
scalar_dataset create_scalar_dataset(const std::string &name, const T &value)
Creates a new HDF5 scalar dataset within this group and initializes it with a given value...
Definition: hdf5/group.hpp:314
A reference to an HDF5 object.
Definition: hdf5/object_reference.hpp:25
int compression_level() const
gzip compression level
Definition: hdf5/group.hpp:132
A handle to an HDF5 scalar dataset.
Definition: hdf5/scalar_dataset.hpp:27
Additional options for the dataset creation.
Definition: hdf5/group.hpp:72
bool shuffle_filter() const
shuffle filter option
Definition: hdf5/group.hpp:139
Exception, which is thrown, if a require_*-type method can't fulfill the contract.
Definition: broken_contract_exception.hpp:20
const char * what() const noexceptoverride
An associated error description.
Definition: hdf5/group.hpp:60