My Project 1.14.3
Loading...
Searching...
No Matches
H5Location.h
1// C++ informative line for the emacs editor: -*- C++ -*-
2/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 * Copyright by The HDF Group. *
4 * All rights reserved. *
5 * *
6 * This file is part of HDF5. The full HDF5 copyright notice, including *
7 * terms governing use, modification, and redistribution, is contained in *
8 * the COPYING file, which can be found at the root of the source code *
9 * distribution tree, or in https://www.hdfgroup.org/licenses. *
10 * If you do not have access to either file, you may request a copy from *
11 * help@hdfgroup.org. *
12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14#ifndef H5Location_H
15#define H5Location_H
16
17#include "H5Classes.h" // contains forward class declarations
18
19namespace H5 {
20
29// Inheritance: IdComponent
30class H5_DLLCPP H5Location : public IdComponent {
31 public:
32 // Checks if a link of a given name exists in a location
33 bool nameExists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
34 bool nameExists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
35
36 // Checks if a link of a given name exists in a location
37 // Deprecated in favor of nameExists for better name.
38 bool exists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
39 bool exists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
40
41 // Flushes all buffers associated with this location to disk.
42 void flush(H5F_scope_t scope) const;
43
44 // Gets the name of the file, specified by this location.
45 H5std_string getFileName() const;
46
47#ifndef H5_NO_DEPRECATED_SYMBOLS
48 // Retrieves the type of object that an object reference points to.
49 H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
50#endif /* H5_NO_DEPRECATED_SYMBOLS */
51
52 // Retrieves the type of object that an object reference points to.
53 H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
54 // Note: getRefObjType deprecates getObjType, but getObjType's name is
55 // misleading, so getRefObjType is used in the new function instead.
56
57 // Sets the comment for an HDF5 object specified by its name.
58 void setComment(const char *name, const char *comment) const;
59 void setComment(const H5std_string &name, const H5std_string &comment) const;
60 void setComment(const char *comment) const;
61 void setComment(const H5std_string &comment) const;
62
63 // Retrieves comment for the HDF5 object specified by its name.
64 ssize_t getComment(const char *name, size_t buf_size, char *comment) const;
65 H5std_string getComment(const char *name, size_t buf_size = 0) const;
66 H5std_string getComment(const H5std_string &name, size_t buf_size = 0) const;
67
68 // Removes the comment for the HDF5 object specified by its name.
69 void removeComment(const char *name) const;
70 void removeComment(const H5std_string &name) const;
71
72 // Creates a reference to a named object or to a dataset region
73 // in this object.
74 void reference(void *ref, const char *name, H5R_type_t ref_type = H5R_OBJECT) const;
75 void reference(void *ref, const H5std_string &name, H5R_type_t ref_type = H5R_OBJECT) const;
76 void reference(void *ref, const char *name, const DataSpace &dataspace,
77 H5R_type_t ref_type = H5R_DATASET_REGION) const;
78 void reference(void *ref, const H5std_string &name, const DataSpace &dataspace,
79 H5R_type_t ref_type = H5R_DATASET_REGION) const;
80
81 // Open a referenced object whose location is specified by either
82 // a file, an HDF5 object, or an attribute.
83 void dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
84 const PropList &plist = PropList::DEFAULT);
85 // Removed in 1.10.1, because H5Location is baseclass
86 // void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const
87 // PropList& plist = PropList::DEFAULT);
88
89 // Retrieves a dataspace with the region pointed to selected.
90 DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
91
92 // Create a new group with using link create property list.
93 Group createGroup(const char *name, const LinkCreatPropList &lcpl) const;
94 Group createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const;
95
96 // From CommonFG
97 // Creates a new group at this location which can be a file
98 // or another group.
99 Group createGroup(const char *name, size_t size_hint = 0) const;
100 Group createGroup(const H5std_string &name, size_t size_hint = 0) const;
101
102 // Opens an existing group in a location which can be a file
103 // or another group.
104 Group openGroup(const char *name) const;
105 Group openGroup(const H5std_string &name) const;
106
107 // Creates a new dataset in this location.
108 DataSet createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space,
109 const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
110 const DSetAccPropList &dapl = DSetAccPropList::DEFAULT,
111 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
112 DataSet createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
113 const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
114 const DSetAccPropList &dapl = DSetAccPropList::DEFAULT,
115 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
116
117 // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3
118 // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const
119 // DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; DataSet createDataSet(const
120 // H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList&
121 // create_plist = DSetCreatPropList::DEFAULT) const;
122
123 // Opens an existing dataset at this location.
124 // DSetAccPropList is added - 1.10.3
125 DataSet openDataSet(const char *name, const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
126 DataSet openDataSet(const H5std_string &name,
127 const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
128
129 H5L_info2_t getLinkInfo(const char *link_name,
130 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
131 H5L_info2_t getLinkInfo(const H5std_string &link_name,
132 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
133
134 // Returns the value of a symbolic link.
135 H5std_string getLinkval(const char *link_name, size_t size = 0) const;
136 H5std_string getLinkval(const H5std_string &link_name, size_t size = 0) const;
137
138 // Returns the number of objects in this group.
139 // Deprecated - moved to H5::Group in 1.10.2.
140 hsize_t getNumObjs() const;
141
142 // Retrieves the name of an object in this group, given the
143 // object's index.
144 H5std_string getObjnameByIdx(hsize_t idx) const;
145 ssize_t getObjnameByIdx(hsize_t idx, char *name, size_t size) const;
146 ssize_t getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const;
147
148 // Retrieves the type of an object in this file or group, given the
149 // object's name
150 H5O_type_t childObjType(const H5std_string &objname) const;
151 H5O_type_t childObjType(const char *objname) const;
152 H5O_type_t childObjType(hsize_t index, H5_index_t index_type = H5_INDEX_NAME,
153 H5_iter_order_t order = H5_ITER_INC, const char *objname = ".") const;
154
155 // Returns the object header version of an object in this file or group,
156 // given the object's name.
157 unsigned childObjVersion(const char *objname) const;
158 unsigned childObjVersion(const H5std_string &objname) const;
159
160 // Retrieves information about an HDF5 object.
161 void getObjinfo(H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC) const;
162
163 // Retrieves information about an HDF5 object, given its name.
164 void getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
165 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
166 void getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
167 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
168
169 // Retrieves information about an HDF5 object, given its index.
170 void getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
171 H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
172 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
173 void getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
174 H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
175 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
176
177 // Retrieves native native information about an HDF5 object.
178 void getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const;
179
180 // Retrieves native information about an HDF5 object, given its name.
181 void getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
182 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
183 void getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo,
184 unsigned fields = H5O_NATIVE_INFO_HDR,
185 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
186
187 // Retrieves native information about an HDF5 object, given its index.
188 void getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
189 H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
190 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
191 void getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order,
192 hsize_t idx, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
193 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
194
195#ifndef H5_NO_DEPRECATED_SYMBOLS
196 // Returns the type of an object in this group, given the
197 // object's index.
198 H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
199 H5G_obj_t getObjTypeByIdx(hsize_t idx, char *type_name) const;
200 H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const;
201
202 // Returns information about an HDF5 object, given by its name,
203 // at this location. - Deprecated
204 void getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const;
205 void getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const;
206 void getObjinfo(const char *name, H5G_stat_t &statbuf) const;
207 void getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const;
208
209 // Iterates over the elements of this group - not implemented in
210 // C++ style yet.
211 int iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data);
212 int iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data);
213#endif /* H5_NO_DEPRECATED_SYMBOLS */
214
215 // Creates a soft link from link_name to target_name.
216 void link(const char *target_name, const char *link_name,
217 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
218 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
219 void link(const H5std_string &target_name, const H5std_string &link_name,
220 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
221 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
222
223 // Creates a hard link from new_name to curr_name.
224 void link(const char *curr_name, const Group &new_loc, const char *new_name,
225 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
226 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
227 void link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
228 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
229 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
230
231 // Creates a hard link from new_name to curr_name in same location.
232 void link(const char *curr_name, const hid_t same_loc, const char *new_name,
233 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
234 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
235 void link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
236 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
237 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
238
239 // Creates a link of the specified type from new_name to current_name;
240 // both names are interpreted relative to the specified location id.
241 // Deprecated due to inadequate functionality.
242 void link(H5L_type_t link_type, const char *curr_name, const char *new_name) const;
243 void link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const;
244
245 // Removes the specified link from this location.
246 void unlink(const char *link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
247 void unlink(const H5std_string &link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
248
249 // Mounts the file 'child' onto this location.
250 void mount(const char *name, const H5File &child, const PropList &plist) const;
251 void mount(const H5std_string &name, const H5File &child, const PropList &plist) const;
252
253 // Unmounts the file named 'name' from this parent location.
254 void unmount(const char *name) const;
255 void unmount(const H5std_string &name) const;
256
257 // Copies a link from a group to another.
258 void copyLink(const char *src_name, const Group &dst, const char *dst_name,
259 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
260 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
261 void copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
262 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
263 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
264
265 // Makes a copy of a link in the same group.
266 void copyLink(const char *src_name, const char *dst_name,
267 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
268 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
269 void copyLink(const H5std_string &src_name, const H5std_string &dst_name,
270 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
271 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
272
273 // Renames a link in this group and moves to a new location.
274 void moveLink(const char *src_name, const Group &dst, const char *dst_name,
275 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
276 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
277 void moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
278 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
279 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
280
281 // Renames a link in this group.
282 void moveLink(const char *src_name, const char *dst_name,
283 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
284 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
285 void moveLink(const H5std_string &src_name, const H5std_string &dst_name,
286 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
287 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
288
289 // Renames an object at this location.
290 // Deprecated due to inadequate functionality.
291 void move(const char *src, const char *dst) const;
292 void move(const H5std_string &src, const H5std_string &dst) const;
293
294 // end From CommonFG
295
297 virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
298
299 // Default constructor
301
302 protected:
303#ifndef DOXYGEN_SHOULD_SKIP_THIS
304 // *** Deprecation warning ***
305 // The following two constructors are no longer appropriate after the
306 // data member "id" had been moved to the sub-classes.
307 // The copy constructor is a noop and is removed in 1.8.15 and the
308 // other will be removed from 1.10 release, and then from 1.8 if its
309 // removal does not raise any problems in two 1.10 releases.
310
311 // Creates a copy of an existing object giving the location id.
312 // H5Location(const hid_t loc_id);
313
314 // Creates a reference to an HDF5 object or a dataset region.
315 void p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const;
316
317 // Dereferences a ref into an HDF5 id.
318 hid_t p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
319 const char *from_func);
320
321#ifndef H5_NO_DEPRECATED_SYMBOLS
322 // Retrieves the type of object that an object reference points to.
323 H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
324#endif /* H5_NO_DEPRECATED_SYMBOLS */
325
326 // Retrieves the type of object that an object reference points to.
327 H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
328
329 // Sets the identifier of this object to a new value. - this one
330 // doesn't increment reference count
331 // virtual void p_setId(const hid_t new_id);
332
333#endif // DOXYGEN_SHOULD_SKIP_THIS
334
335 // Noop destructor.
336 virtual ~H5Location() override;
337
338}; // end of H5Location
339} // namespace H5
340
341#endif // H5Location_H
Class DSetAccPropList inherits from LinkAccPropList and provides wrappers for the HDF5 dataset access...
Definition H5DaccProp.h:24
Class DSetCreatPropList inherits from ObjCreatPropList and provides wrappers for the HDF5 dataset cre...
Definition H5DcreatProp.h:28
Class DataSet operates on HDF5 datasets.
Definition H5DataSet.h:27
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition H5DataSpace.h:24
Class DataType provides generic operations on HDF5 datatypes.
Definition H5DataType.h:27
Class Group represents an HDF5 group.
Definition H5Group.h:23
Class H5File represents an HDF5 file and inherits from class Group as file is a root group.
Definition H5File.h:24
H5Location is an abstract base class, added in version 1.8.12.
Definition H5Location.h:30
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition H5IdComponent.h:26
Class PropList inherits from IdComponent and provides wrappers for the HDF5 generic property list.
Definition H5PropList.h:24
Definition H5AbstractDs.cpp:33


The HDF Group Help Desk:
  Copyright by The HDF Group