HighFive 2.10.1
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
h5g_wrapper.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <H5Dpublic.h>
4#include <H5Ipublic.h>
5
7
8namespace HighFive {
9namespace detail {
10
11inline hid_t h5g_create2(hid_t loc_id,
12 const char* name,
13 hid_t lcpl_id,
14 hid_t gcpl_id,
15 hid_t gapl_id) {
16 hid_t group_id = H5Gcreate2(loc_id, name, lcpl_id, gcpl_id, gapl_id);
17 if (group_id == H5I_INVALID_HID) {
18 HDF5ErrMapper::ToException<GroupException>(std::string("Unable to create the group \"") +
19 name + "\":");
20 }
21
22 return group_id;
23}
24
25inline hid_t h5g_open2(hid_t loc_id, const char* name, hid_t gapl_id) {
26 hid_t group_id = H5Gopen2(loc_id, name, gapl_id);
27 if (group_id == H5I_INVALID_HID) {
28 HDF5ErrMapper::ToException<GroupException>(std::string("Unable to open the group \"") +
29 name + "\":");
30 }
31 return group_id;
32}
33
34inline herr_t h5g_get_num_objs(hid_t loc_id, hsize_t* num_objs) {
35 herr_t err = H5Gget_num_objs(loc_id, num_objs);
36 if (err < 0) {
38 std::string("Unable to count objects in existing group or file"));
39 }
40
41 return err;
42}
43
44
45} // namespace detail
46} // namespace HighFive
Definition H5_definitions.hpp:22
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43