echelon  0.8.0
hdf5/precursor/object_reference.hpp
1 // Copyright (c) 2012-2014 Christopher Hinz
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef ECHELON_HDF5_PRECURSOR_OBJECT_REFERENCE_HPP
7 #define ECHELON_HDF5_PRECURSOR_OBJECT_REFERENCE_HPP
8 
9 #include <hdf5.h>
10 #include <string>
11 
12 namespace echelon
13 {
14 namespace hdf5
15 {
16 namespace precursor
17 {
18 class dataset;
19 
20 class object_reference
21 {
22 public:
23  /*
24  * \warning I am not sure, if HDF5 really denotes a null reference with a
25  * zero-initialized
26  * hobj_ref_t object, since the HDF5 documentation is (at best)
27  * very vague about such matters.
28  * I got the idea while studying the h5py source code. Since h5py
29  * seems to be well tested, this
30  * assumption should be valid. To be forearmed against future
31  * changes, which could break this
32  * assumption, we should verify this behavior via unit tests.
33  */
34  object_reference() = default;
35 
36  explicit object_reference(hid_t obj_id_);
37  explicit object_reference(hobj_ref_t obj_ref_);
38  object_reference(hid_t loc_id_, const std::string& name_);
39 
40  const hobj_ref_t& native_ref() const;
41 
42  H5O_type_t get_object_type(hid_t valid_obj_id) const;
43 
44  hid_t dereference(hid_t valid_obj_id) const;
45 
46  explicit operator bool() const;
47 
48 private:
49  hobj_ref_t obj_ref_;
50 };
51 }
52 }
53 }
54 
55 #endif
echelon&#39;s core namespace
Definition: attribute.cpp:10