1#ifndef UTOPIA_DATAIO_HDFOBJECT_HH
2#define UTOPIA_DATAIO_HDFOBJECT_HH
35template < HDFCategory
objectcategory >
56 std::shared_ptr< spdlog::logger >
_log;
188 std::string path = {})
192 throw std::runtime_error(
"Error: Cannot bind object to new "
193 "identifier while the old is still valid");
198 throw std::invalid_argument(
199 "Error: invalid argument! The id given "
200 "for an object of " +
202 " cannot be managed by an HDFObject instance!");
209 if (path.size() == 0)
277 std::string path = {}) :
312 other._id.set_id(-1);
334template < HDFCategory cat >
Wrapper class around an hdf5 identifier, used to manage reference counts of the object this identifie...
Definition hdfidentifier.hh:29
auto get_refcount() const
Get the number of references currently referring to the object identified by this ID.
Definition hdfidentifier.hh:89
void close()
Close the identifier and render the C-Level id held invalid.
Definition hdfidentifier.hh:134
hid_t get_id() const
Get the HDF5 id held by this object.
Definition hdfidentifier.hh:53
void open(hid_t id, std::function< herr_t(hid_t) > closing_func)
Open the object and bind it to another C-Level id.
Definition hdfidentifier.hh:156
hid_t _id
Definition hdfidentifier.hh:30
Common base class for all HDF5 classes in the DATAIO Module i.e., for all classes that wrap HDF5-C-Li...
Definition hdfobject.hh:37
static constexpr HDFCategory category
Named variable for template arg.
Definition hdfobject.hh:63
HDFObject()
Construct HDFObject from the given arguments.
Definition hdfobject.hh:246
auto get_logger() const
Get the logger object.
Definition hdfobject.hh:110
HDFObject & operator=(HDFObject &&other)
move assignment operator
Definition hdfobject.hh:306
HDFObject & operator=(const HDFObject &other)
Copy assignment operator.
Definition hdfobject.hh:290
auto get_id_object() const
Get the id object.
Definition hdfobject.hh:99
HDFObject(hid_t id, std::function< herr_t(hid_t) > closing_func, std::string path={})
Construct HDFObject from the given argument.
Definition hdfobject.hh:275
std::string _path
Name of the object.
Definition hdfobject.hh:50
auto get_refcount()
Get the reference count of object.
Definition hdfobject.hh:131
virtual ~HDFObject()
Destroy the HDFObject object. Has to be implemented in subclass!
Definition hdfobject.hh:321
std::string get_path() const
Get the name or path object.
Definition hdfobject.hh:88
void close()
Close function which takes care of correctly closing the object and managing the reference counter.
Definition hdfobject.hh:161
virtual bool is_valid() const
Check if the object is still valid.
Definition hdfobject.hh:143
void swap(HDFObject &other)
swap the state of the caller with the state of the argument
Definition hdfobject.hh:71
std::shared_ptr< spdlog::logger > _log
pointer to the logger for dataio
Definition hdfobject.hh:56
HDFIdentifier _id
Identifier object that binds an instance of this class to an HDF5 object.
Definition hdfobject.hh:44
HDFObject(HDFObject &&other)
Construct HDFObject by moving.
Definition hdfobject.hh:254
hid_t get_C_id() const
Get the C id object.
Definition hdfobject.hh:120
void bind_to(hid_t id, std::function< herr_t(hid_t) > closing_func, std::string path={})
Open the object and bind it to a HDF5 object identified by 'id' with name 'path'. Object should be cr...
Definition hdfobject.hh:186
HDFObject(const HDFObject &other)=default
Construct HDFObject by copying another object.
void swap(WriteTask< BGB, DW, DB, AWG, AWD > &lhs, WriteTask< BGB, DW, DB, AWG, AWD > &rhs)
Swaps the state of lhs and rhs.
Definition write_task.hh:240
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
bool check_validity(htri_t valid, const std::string_view object_name)
Check for validity of a hdf5 htri_t type or similar.
Definition hdfutilities.hh:73
std::string generate_object_name(const Object &object)
Use category and path variable of object to make a string that identifies the object it is applied to...
Definition hdfutilities.hh:220
HDFCategory
Enumerate the different HDF5 object types for use in HDFObject class.
Definition hdfutilities.hh:173
This file provides metafunctions for automatically determining the nature of a C/C++ types at compile...
Definition parallel.hh:235