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


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois