File indexing completed on 2026-09-18 09:17:09
0001 #pragma once
0002
0003 #include <H5Opublic.h>
0004
0005 namespace HighFive {
0006 namespace detail {
0007
0008 inline hid_t h5o_open(hid_t loc_id, const char* name, hid_t lapl_id) {
0009 hid_t hid = H5Oopen(loc_id, name, lapl_id);
0010 if (hid < 0) {
0011 HDF5ErrMapper::ToException<GroupException>(std::string("Unable to open \"") + name + "\":");
0012 }
0013
0014 return hid;
0015 }
0016
0017 inline herr_t h5o_close(hid_t id) {
0018 herr_t err = H5Oclose(id);
0019 if (err < 0) {
0020 HDF5ErrMapper::ToException<ObjectException>("Unable to close object.");
0021 }
0022
0023 return err;
0024 }
0025
0026 #if H5O_info_t_vers >= 1
0027 using h5o_info1_t = H5O_info1_t;
0028 #else
0029 using h5o_info1_t = H5O_info_t;
0030 #endif
0031
0032 inline herr_t h5o_get_info1(hid_t loc_id, h5o_info1_t* info) {
0033 #if H5Oget_info_vers >= 1
0034 herr_t err = H5Oget_info1(loc_id, info);
0035 #else
0036 herr_t err = H5Oget_info(loc_id, info);
0037 #endif
0038
0039 if (err < 0) {
0040 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
0041 }
0042 return err;
0043 }
0044
0045 #if H5_VERSION_GE(1, 10, 3)
0046 inline herr_t h5o_get_info2(hid_t loc_id, h5o_info1_t* info, unsigned fields) {
0047 herr_t err = H5Oget_info2(loc_id, info, fields);
0048 if (err < 0) {
0049 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
0050 }
0051 return err;
0052 }
0053 #endif
0054
0055 #if H5_VERSION_GE(1, 12, 0)
0056 inline herr_t h5o_get_info3(hid_t loc_id, H5O_info2_t* info, unsigned fields) {
0057 herr_t err = H5Oget_info3(loc_id, info, fields);
0058 if (err < 0) {
0059 HDF5ErrMapper::ToException<ObjectException>("Unable to obtain info for object");
0060 }
0061 return err;
0062 }
0063 #endif
0064
0065 }
0066 }