11 #include <H5Ipublic.h>
18 template <
typename Derivate>
20 static_assert(std::is_same<Derivate, Group>::value
21 || std::is_same<Derivate, DataSet>::value
22 || std::is_same<Derivate, Attribute>::value,
23 "PathTraits can only be applied to Group, DataSet and Attribute");
24 const auto& obj =
static_cast<const Derivate&
>(*this);
28 const hid_t file_id = H5Iget_file_id(obj.getId());
30 HDF5ErrMapper::ToException<PropertyException>(
31 "getFile(): Could not obtain file of object");
33 _file_obj.reset(
new File(file_id));
36 template <
typename Derivate>
38 return details::get_name([
this](
char* buffer, hsize_t length) {
39 return H5Iget_name(
static_cast<const Derivate*
>(
this)->getId(), buffer,
static_cast<size_t>(length));
43 template <
typename Derivate>
File class.
Definition: H5File.hpp:26
PathTraits()
Definition: H5Path_traits_misc.hpp:19
File & getFile() const noexcept
Return a reference to the File object this object belongs.
Definition: H5Path_traits_misc.hpp:44
std::string getPath() const
return the path to the current object
Definition: H5Path_traits_misc.hpp:37
Definition: H5_definitions.hpp:15