h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5Reference.hpp
1/*
2 * Copyright (c), 2020, EPFL - Blue Brain Project
3 *
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9
10#ifndef H5REFERENCE_HPP
11#define H5REFERENCE_HPP
12
13#include <string>
14#include <vector>
15
16#include <H5Ipublic.h>
17#include <H5Rpublic.h>
18
19#include "H5Object.hpp"
20#include "bits/H5_definitions.hpp"
21
22namespace h5gt {
23
31class Reference {
32public:
34 Reference() = default;
35
40 Reference(const Object& location, const Object& object);
41
47 template <typename T>
48 T dereference(const Object& location) const;
49
54 ObjectType getType(const Object& location) const;
55
56protected:
58 inline explicit Reference(const hobj_ref_t h5_ref)
59 : href(h5_ref) {};
60
65 void create_ref(hobj_ref_t* refptr) const;
66
67private:
68
69 Object get_ref(const Object& location) const;
70
71 hobj_ref_t href{};
72 std::string obj_name{};
73 hid_t parent_id{};
74
75 friend details::data_converter<std::vector<Reference>>;
76};
77
78} // namespace h5gt
79
80#include "bits/H5Reference_misc.hpp"
81
82#endif // H5REFERENCE_HPP
Definition H5Object.hpp:55
An HDF5 (object) reference type.
Definition H5Reference.hpp:31
void create_ref(hobj_ref_t *refptr) const
Create the low-level reference and store it at refptr.
Definition H5Reference_misc.hpp:26
ObjectType getType(const Object &location) const
Get only the type of the referenced Object.
Definition H5Reference_misc.hpp:33
Reference(const hobj_ref_t h5_ref)
Create a Reference from a low-level HDF5 object reference.
Definition H5Reference.hpp:58
T dereference(const Object &location) const
Retrieve the Object being referenced by the Reference.
Definition H5Reference_misc.hpp:38
Reference()=default
Create an empty Reference to be initialized later.