HighFive 2.10.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5Object.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
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#pragma once
10
11#include <ctime>
12
13#include <H5Ipublic.h>
14#include <H5Opublic.h>
15
17#include "bits/H5Friends.hpp"
18
19namespace HighFive {
20
24enum class ObjectType {
25 File,
26 Group,
29 Dataset,
31 Other // Internal/custom object type
32};
33
34namespace detail {
50Object make_object(hid_t hid);
51} // namespace detail
52
53
54class Object {
55 public:
56 // move constructor, reuse hid
57 Object(Object&& other) noexcept;
58
59 // decrease reference counter
60 ~Object();
61
66 bool isValid() const noexcept;
67
73 hid_t getId() const noexcept;
74
78 ObjectInfo getInfo() const;
79
85 ObjectType getType() const;
86
87 // Check if refer to same object
88 bool operator==(const Object& other) const noexcept {
89 return _hid == other._hid;
90 }
91
92 protected:
93 // empty constructor
94 Object();
95
96 // copy constructor, increase reference counter
97 Object(const Object& other);
98
99 // Init with an low-level object id
100 explicit Object(hid_t);
101
102 // Copy-Assignment operator
103 Object& operator=(const Object& other);
104
105 hid_t _hid;
106
107 private:
108 friend Object detail::make_object(hid_t);
109 friend class Reference;
110 friend class CompoundType;
111
112#if HIGHFIVE_HAS_FRIEND_DECLARATIONS
113 template <typename Derivate>
114 friend class NodeTraits;
115 template <typename Derivate>
116 friend class AnnotateTraits;
117 template <typename Derivate>
118 friend class PathTraits;
119#endif
120};
121
122
127 public:
130 H5_DEPRECATED("Deprecated since HighFive 2.2. Soon supporting VOL tokens")
131 haddr_t getAddress() const noexcept;
132
134 size_t getRefCount() const noexcept;
135
137 time_t getCreationTime() const noexcept;
138
140 time_t getModificationTime() const noexcept;
141
142 protected:
143#if (H5Oget_info_vers < 3)
144 H5O_info_t raw_info;
145#else
146 // Use compat H5O_info1_t while getAddress() is supported (deprecated)
147 H5O_info1_t raw_info;
148#endif
149
150 friend class Object;
151};
152
153} // namespace HighFive
154
155#include "bits/H5Object_misc.hpp"
#define H5_DEPRECATED(msg)
Definition H5_definitions.hpp:9
Definition H5Annotate_traits.hpp:18
Create a compound HDF5 datatype.
Definition H5DataType.hpp:198
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Definition H5Object.hpp:54
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:69
ObjectInfo getInfo() const
Retrieve several infos about the current object (address, dates, etc)
Definition H5Object_misc.hpp:97
~Object()
Definition H5Object_misc.hpp:57
ObjectType getType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:92
Object()
Definition H5Object_misc.hpp:25
bool isValid() const noexcept
isValid
Definition H5Object_misc.hpp:65
hid_t _hid
Definition H5Object.hpp:105
Object & operator=(const Object &other)
Definition H5Object_misc.hpp:43
bool operator==(const Object &other) const noexcept
Definition H5Object.hpp:88
A class for accessing hdf5 objects info.
Definition H5Object.hpp:126
time_t getCreationTime() const noexcept
Retrieve the object's creation time.
Definition H5Object_misc.hpp:115
haddr_t getAddress() const noexcept
Retrieve the address of the object (within its file)
Definition H5Object_misc.hpp:109
size_t getRefCount() const noexcept
Retrieve the number of references to this object.
Definition H5Object_misc.hpp:112
H5O_info_t raw_info
Definition H5Object.hpp:144
time_t getModificationTime() const noexcept
Retrieve the object's last modification time.
Definition H5Object_misc.hpp:118
Definition H5Path_traits.hpp:16
An HDF5 (object) reference type.
Definition H5Reference.hpp:33
Definition H5_definitions.hpp:22
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24