HighFive 3.0.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
14#include "bits/H5Friends.hpp"
15
16#include "H5Exception.hpp"
17#include "bits/h5o_wrapper.hpp"
18#include "bits/h5i_wrapper.hpp"
19
20namespace HighFive {
21
25enum class ObjectType {
26 File,
27 Group,
30 Dataset,
32 Other // Internal/custom object type
33};
34
35
36class Object {
37 public:
38 // move constructor, reuse hid
39 Object(Object&& other) noexcept;
40
45 bool isValid() const noexcept;
46
52 hid_t getId() const noexcept;
53
57 ObjectInfo getInfo() const;
58
67 haddr_t getAddress() const;
68
74 ObjectType getType() const;
75
76 // Check if refer to same object
77 bool operator==(const Object& other) const noexcept {
78 return _hid == other._hid;
79 }
80
81 protected:
82 // empty constructor
83 Object();
84
85 // copy constructor, increase reference counter
86 Object(const Object& other);
87
88 // Init with an low-level object id
89 explicit Object(hid_t) noexcept;
90
91 // decrease reference counter
92 ~Object();
93
94 // Copy-Assignment operator
95 Object& operator=(const Object& other);
96 Object& operator=(Object&& other);
97
98 hid_t _hid;
99
100 private:
101 friend class Reference;
102 friend class CompoundType;
103
104#if HIGHFIVE_HAS_FRIEND_DECLARATIONS
105 template <typename Derivate>
106 friend class NodeTraits;
107 template <typename Derivate>
108 friend class AnnotateTraits;
109 template <typename Derivate>
110 friend class PathTraits;
111#endif
112};
113
114
119 public:
120 ObjectInfo(const Object& obj);
121
123 size_t getRefCount() const noexcept;
124
126 time_t getCreationTime() const noexcept;
127
129 time_t getModificationTime() const noexcept;
130
131 private:
132 detail::h5o_info1_t raw_info;
133
134 friend class Object;
135};
136
137} // namespace HighFive
138
139#include "bits/H5Object_misc.hpp"
Definition H5Annotate_traits.hpp:18
Class representing an Attribute of a DataSet or Group.
Definition H5Attribute.hpp:47
Create a compound HDF5 datatype.
Definition H5DataType.hpp:200
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:39
File class.
Definition H5File.hpp:25
Represents an hdf5 group.
Definition H5Group.hpp:46
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Definition H5Object.hpp:36
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:75
ObjectInfo getInfo() const
Retrieve several infos about the current object (address, dates, etc)
Definition H5Object_misc.hpp:103
~Object()
Definition H5Object_misc.hpp:63
ObjectType getType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:98
haddr_t getAddress() const
Address of an HDF5 object in the file.
Definition H5Object_misc.hpp:107
Object()
Definition H5Object_misc.hpp:20
bool isValid() const noexcept
isValid
Definition H5Object_misc.hpp:71
hid_t _hid
Definition H5Object.hpp:98
Object & operator=(const Object &other)
Definition H5Object_misc.hpp:49
bool operator==(const Object &other) const noexcept
Definition H5Object.hpp:77
A class for accessing hdf5 objects info.
Definition H5Object.hpp:118
time_t getCreationTime() const noexcept
Retrieve the object's creation time.
Definition H5Object_misc.hpp:120
size_t getRefCount() const noexcept
Retrieve the number of references to this object.
Definition H5Object_misc.hpp:117
time_t getModificationTime() const noexcept
Retrieve the object's last modification time.
Definition H5Object_misc.hpp:123
Definition H5Path_traits.hpp:16
An HDF5 (object) reference type.
Definition H5Reference.hpp:33
Definition assert_compatible_spaces.hpp:15
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:25