23#ifndef LIBH5_GROUP_HPP
24#define LIBH5_GROUP_HPP
60 group(
object obj,
file _parent_file) :
object{obj}, parent_file{std::move(_parent_file)} {}
64 [[nodiscard]] std::string
name()
const;
75 [[nodiscard]]
bool has_key(std::string
const &key)
const;
83 [[nodiscard]]
bool has_subgroup(std::string
const &key)
const;
91 [[nodiscard]]
bool has_dataset(std::string
const &key)
const;
102 void unlink(std::string
const &key,
bool error_if_absent =
false)
const;
139 void create_softlink(std::string
const &target_key, std::string
const &key,
bool delete_if_exists =
true)
const;
A handle to an HDF5 file.
A handle to an HDF5 group.
bool has_dataset(std::string const &key) const
Check if a dataset with the given key exists in the group and is accessible.
dataset create_dataset(std::string const &key, datatype ty, dataspace sp, hid_t pl) const
Create a dataset with the given key, datatype, dataspace and dataset creation property list in this g...
dataset open_dataset(std::string const &key) const
Open a dataset with the given key in the group.
std::string name() const
Get the name of the group.
bool has_subgroup(std::string const &key) const
Check if a subgroup with the given key exists in the group and is accessible.
group create_group(std::string const &key, bool delete_if_exists=true) const
Create a subgroup with the given key in the group.
group open_group(std::string const &key) const
Open a subgroup with the given key in the group.
void create_softlink(std::string const &target_key, std::string const &key, bool delete_if_exists=true) const
Create a softlink with the given key to a target with a given target key in this group.
std::vector< std::string > get_all_subgroup_dataset_names() const
Get all the names of the subgroups and datasets in the current group.
bool has_key(std::string const &key) const
Check if a link with the given key exists in the group.
std::vector< std::string > keys() const
Get all the names of the subgroups and datasets in the current group.
std::vector< std::string > get_all_dataset_names() const
Get all the names of the datasets in the current group.
file get_file() const
Get the parent file to which the group belongs.
void unlink(std::string const &key, bool error_if_absent=false) const
Remove a link with the given key from the group.
std::vector< std::string > get_all_subgroup_names() const
Get all the names of the subgroups in the current group.
group()=default
Default constructor (only necessary for the Python interface).
object(hid_t id=0)
Construct a new h5::object for a given HDF5 ID by taking ownership, i.e. without increasing the refer...
Provides a handle to an HDF5 file.
object datatype
Type alias for an HDF5 datatype.
object dataset
Type alias for an HDF5 dataset.
object dataspace
Type alias for an HDF5 dataspace.
void write_attribute(object obj, std::string const &key, T const &x)
Generic implementation for writing a variable to an HDF5 attribute.
T read_attribute(object obj, std::string const &key)
Generic implementation for reading an HDF5 attribute.
int64_t hid_t
ID type used in HDF5.