HighFive 3.0.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
h5o_wrapper.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <H5Opublic.h>
4
5namespace HighFive {
6namespace detail {
7
8inline hid_t h5o_open(hid_t loc_id, const char* name, hid_t lapl_id) {
9 hid_t hid = H5Oopen(loc_id, name, lapl_id);
10 if (hid < 0) {
11 HDF5ErrMapper::ToException<GroupException>(std::string("Unable to open \"") + name + "\":");
12 }
13
14 return hid;
15}
16
17inline herr_t h5o_close(hid_t id) {
18 herr_t err = H5Oclose(id);
19 if (err < 0) {
20 HDF5ErrMapper::ToException<ObjectException>("Unable to close object.");
21 }
22
23 return err;
24}
25
26#if H5O_info_t_vers >= 1
27using h5o_info1_t = H5O_info1_t;
28#else
29using h5o_info1_t = H5O_info_t;
30#endif
31
32inline herr_t h5o_get_info1(hid_t loc_id, h5o_info1_t* info) {
33#if H5Oget_info_vers >= 1
34 herr_t err = H5Oget_info1(loc_id, info);
35#else
36 herr_t err = H5Oget_info(loc_id, info);
37#endif
38
39 if (err < 0) {
40 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
41 }
42 return err;
43}
44
45#if H5_VERSION_GE(1, 10, 3)
46inline herr_t h5o_get_info2(hid_t loc_id, h5o_info1_t* info, unsigned fields) {
47 herr_t err = H5Oget_info2(loc_id, info, fields);
48 if (err < 0) {
49 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
50 }
51 return err;
52}
53#endif
54
55#if H5_VERSION_GE(1, 12, 0)
56inline herr_t h5o_get_info3(hid_t loc_id, H5O_info2_t* info, unsigned fields) {
57 herr_t err = H5Oget_info3(loc_id, info, fields);
58 if (err < 0) {
59 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
60 }
61 return err;
62}
63#endif
64
65} // namespace detail
66} // namespace HighFive
Definition assert_compatible_spaces.hpp:15