My Project 1.10.10
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_info_t getLinkInfo(const char *link_name,
130 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
131 H5L_info_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_info_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_info_t &objinfo, unsigned fields = H5O_INFO_BASIC,
165 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
166 void getObjinfo(const H5std_string &name, H5O_info_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_info_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_info_t &objinfo, unsigned fields = H5O_INFO_BASIC,
175 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
176
177#ifndef H5_NO_DEPRECATED_SYMBOLS
178 // Returns the type of an object in this group, given the
179 // object's index.
180 H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
181 H5G_obj_t getObjTypeByIdx(hsize_t idx, char *type_name) const;
182 H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const;
183
184 // Returns information about an HDF5 object, given by its name,
185 // at this location. - Deprecated
186 void getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const;
187 void getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const;
188 void getObjinfo(const char *name, H5G_stat_t &statbuf) const;
189 void getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const;
190
191 // Iterates over the elements of this group - not implemented in
192 // C++ style yet.
193 int iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data);
194 int iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data);
195#endif /* H5_NO_DEPRECATED_SYMBOLS */
196
197 // Creates a soft link from link_name to target_name.
198 void link(const char *target_name, const char *link_name,
199 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
200 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
201 void link(const H5std_string &target_name, const H5std_string &link_name,
202 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
203 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
204
205 // Creates a hard link from new_name to curr_name.
206 void link(const char *curr_name, const Group &new_loc, const char *new_name,
207 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
208 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
209 void link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
210 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
211 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
212
213 // Creates a hard link from new_name to curr_name in same location.
214 void link(const char *curr_name, const hid_t same_loc, const char *new_name,
215 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
216 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
217 void link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
218 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
219 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
220
221 // Creates a link of the specified type from new_name to current_name;
222 // both names are interpreted relative to the specified location id.
223 // Deprecated due to inadequate functionality.
224 void link(H5L_type_t link_type, const char *curr_name, const char *new_name) const;
225 void link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const;
226
227 // Removes the specified link from this location.
228 void unlink(const char *link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
229 void unlink(const H5std_string &link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
230
231 // Mounts the file 'child' onto this location.
232 void mount(const char *name, const H5File &child, const PropList &plist) const;
233 void mount(const H5std_string &name, const H5File &child, const PropList &plist) const;
234
235 // Unmounts the file named 'name' from this parent location.
236 void unmount(const char *name) const;
237 void unmount(const H5std_string &name) const;
238
239 // Copies a link from a group to another.
240 void copyLink(const char *src_name, const Group &dst, const char *dst_name,
241 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
242 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
243 void copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
244 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
245 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
246
247 // Makes a copy of a link in the same group.
248 void copyLink(const char *src_name, const char *dst_name,
249 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
250 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
251 void copyLink(const H5std_string &src_name, const H5std_string &dst_name,
252 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
253 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
254
255 // Renames a link in this group and moves to a new location.
256 void moveLink(const char *src_name, const Group &dst, const char *dst_name,
257 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
258 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
259 void moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
260 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
261 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
262
263 // Renames a link in this group.
264 void moveLink(const char *src_name, const char *dst_name,
265 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
266 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
267 void moveLink(const H5std_string &src_name, const H5std_string &dst_name,
268 const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
269 const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
270
271 // Renames an object at this location.
272 // Deprecated due to inadequate functionality.
273 void move(const char *src, const char *dst) const;
274 void move(const H5std_string &src, const H5std_string &dst) const;
275
276 // end From CommonFG
277
279 virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
280
281 // Default constructor
283
284 protected:
285#ifndef DOXYGEN_SHOULD_SKIP_THIS
286 // *** Deprecation warning ***
287 // The following two constructors are no longer appropriate after the
288 // data member "id" had been moved to the sub-classes.
289 // The copy constructor is a noop and is removed in 1.8.15 and the
290 // other will be removed from 1.10 release, and then from 1.8 if its
291 // removal does not raise any problems in two 1.10 releases.
292
293 // Creates a copy of an existing object giving the location id.
294 // H5Location(const hid_t loc_id);
295
296 // Creates a reference to an HDF5 object or a dataset region.
297 void p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const;
298
299 // Dereferences a ref into an HDF5 id.
300 hid_t p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
301 const char *from_func);
302
303#ifndef H5_NO_DEPRECATED_SYMBOLS
304 // Retrieves the type of object that an object reference points to.
305 H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
306#endif /* H5_NO_DEPRECATED_SYMBOLS */
307
308 // Retrieves the type of object that an object reference points to.
309 H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
310
311 // Sets the identifier of this object to a new value. - this one
312 // doesn't increment reference count
313 // virtual void p_setId(const hid_t new_id);
314
315#endif // DOXYGEN_SHOULD_SKIP_THIS
316
317 // Noop destructor.
318 virtual ~H5Location();
319
320}; // end of H5Location
321} // namespace H5
322
323#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