22#ifndef LIBH5_OBJECT_HPP
23#define LIBH5_OBJECT_HPP
83 object(
object &&x) noexcept : id(x.id) { x.id = 0; }
107 operator hid_t()
const {
return id; }
113 [[nodiscard]]
bool is_valid()
const;
144 template <
typename T>
155 template <
typename T>
A generic handle for HDF5 objects.
object(object &&x) noexcept
Move constructor steals the underlying HDF5 ID without increasing its reference count.
bool is_valid() const
Ensure that the wrapped HDF5 ID is valid (by calling H5Iis_valid).
int get_ref_count() const
Get the current reference count.
~object()
Destructor decreases the reference count and sets the object's ID to zero.
object & operator=(object const &x)
Copy assignment operator copies the underlying HDF5 ID and increases its reference count.
object(hid_t id=0)
Construct a new h5::object for a given HDF5 ID by taking ownership, i.e. without increasing the refer...
static object from_borrowed(hid_t id)
Create an h5::object for a given HDF5 ID and increase its reference count.
void close()
Release the HDF5 handle by decreasing the reference count and by setting the object's ID to zero.
object datatype
Type alias for an HDF5 datatype.
object dataset
Type alias for an HDF5 dataset.
bool hdf5_type_equal(datatype dt1, datatype dt2)
Check if two HDF5 datatypes are equal.
datatype hdf5_type()
Map a given C++ type to an HDF5 datatype.
datatype get_hdf5_type(dataset ds)
Get the HDF5 type stored in a given h5::dataset.
std::string get_name_of_h5_type(datatype dt)
Get the name of an h5::datatype (for error messages).
int64_t hid_t
ID type used in HDF5.
Provides some utility functions for h5.