10 #ifndef H5REFERENCE_MISC_HPP
11 #define H5REFERENCE_MISC_HPP
14 #include <H5Ppublic.h>
21 : parent_id(location.getId()) {
23 return H5Iget_name(
object.getId(), buffer, length); });
27 if (H5Rcreate(refptr, parent_id, obj_name.c_str(), H5R_OBJECT, -1) < 0) {
28 HDF5ErrMapper::ToException<ReferenceException>(
29 std::string(
"Unable to create the reference for \"") + obj_name +
"\":");
34 return get_ref(location).
getType();
39 static_assert(std::is_same<DataSet, T>::value || std::is_same<Group, T>::value,
40 "We can only (de)reference HighFive::Group or HighFive:DataSet");
41 auto obj = get_ref(location) ;
42 if (obj.getType() != T::type) {
43 HDF5ErrMapper::ToException<ReferenceException>(
44 "Trying to dereference the wrong type");
46 return std::move(obj);
49 inline Object Reference::get_ref(
const Object& location)
const {
51 #if (H5Rdereference_vers == 2)
52 if ((res = H5Rdereference(location.
getId(), H5P_DEFAULT, H5R_OBJECT, &href)) < 0) {
53 HDF5ErrMapper::ToException<ReferenceException>(
"Unable to dereference.");
56 if ((res = H5Rdereference(location.
getId(), H5R_OBJECT, &href)) < 0) {
57 HDF5ErrMapper::ToException<ReferenceException>(
"Unable to dereference.");
65 #endif // H5REFERENCE_MISC_HPP