HDF5 C++ API  1.10.0
 All Classes Namespaces Functions Variables Typedefs Friends Pages
H5CommonFG.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 files COPYING and Copyright.html. COPYING can be found at the root *
10  * of the source code distribution tree; Copyright.html can be found at the *
11  * root level of an installed copy of the electronic HDF5 document set and *
12  * is linked from the top-level documents page. It can also be found at *
13  * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
14  * access to either file, you may request a copy from help@hdfgroup.org. *
15  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 #ifndef __CommonFG_H
18 #define __CommonFG_H
19 
20 #ifndef H5_NO_NAMESPACE
21 namespace H5 {
22 #endif
23 
24 // Class forwarding
25 class Group;
26 class H5File;
27 class ArrayType;
28 class VarLenType;
29 
35 class H5_DLLCPP CommonFG {
36  public:
37  // Creates a new group at this location which can be a file
38  // or another group.
39  Group createGroup(const char* name, size_t size_hint = 0) const;
40  Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
41 
42  // Opens an existing group in a location which can be a file
43  // or another group.
44  Group openGroup(const char* name) const;
45  Group openGroup(const H5std_string& name) const;
46 
47  // Creates a new dataset at this location.
48  DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
49  DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
50 
51  // Opens an existing dataset at this location.
52  DataSet openDataSet(const char* name) const;
53  DataSet openDataSet(const H5std_string& name) const;
54 
55  // Returns the value of a symbolic link.
56  H5std_string getLinkval(const char* link_name, size_t size=0) const;
57  H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
58 
59  // Returns the number of objects in this group.
60  hsize_t getNumObjs() const;
61 
62  // Retrieves the name of an object in this group, given the
63  // object's index.
64  H5std_string getObjnameByIdx(hsize_t idx) const;
65  ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
66  ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
67 
68  // Retrieves the type of an object in this file or group, given the
69  // object's name
70  H5O_type_t childObjType(const H5std_string& objname) const;
71  H5O_type_t childObjType(const char* objname) const;
72  H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
73 
74  // Returns the object header version of an object in this file or group,
75  // given the object's name.
76  unsigned childObjVersion(const char* objname) const;
77  unsigned childObjVersion(const H5std_string& objname) const;
78 
79 #ifndef H5_NO_DEPRECATED_SYMBOLS
80  // Returns the type of an object in this group, given the
81  // object's index.
82  H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
83  H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
84  H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
85 
86  // Returns information about an HDF5 object, given by its name,
87  // at this location.
88  void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
89  void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
90  void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
91  void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
92 
93  // Iterates over the elements of this group - not implemented in
94  // C++ style yet.
95  int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
96  int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
97 #endif /* H5_NO_DEPRECATED_SYMBOLS */
98 
99  // Creates a link of the specified type from new_name to current_name;
100  // both names are interpreted relative to the specified location id.
101  void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
102  void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
103 
104  // Removes the specified name at this location.
105  void unlink(const char* name) const;
106  void unlink(const H5std_string& name) const;
107 
108  // Mounts the file 'child' onto this location.
109  void mount(const char* name, const H5File& child, const PropList& plist) const;
110  void mount(const char* name, H5File& child, PropList& plist) const; // backward compatibility
111  void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
112  void mount(const H5std_string& name, H5File& child, PropList& plist) const; // backward compatibility
113 
114  // Unmounts the file named 'name' from this parent location.
115  void unmount(const char* name) const;
116  void unmount(const H5std_string& name) const;
117 
118  // Renames an object at this location.
119  void move(const char* src, const char* dst) const;
120  void move(const H5std_string& src, const H5std_string& dst) const;
121 
122  // Opens a generic named datatype in this location.
123  DataType openDataType(const char* name) const;
124  DataType openDataType(const H5std_string& name) const;
125 
126  // Opens a named array datatype in this location.
127  ArrayType openArrayType(const char* name) const;
128  ArrayType openArrayType(const H5std_string& name) const;
129 
130  // Opens a named compound datatype in this location.
131  CompType openCompType(const char* name) const;
132  CompType openCompType(const H5std_string& name) const;
133 
134  // Opens a named enumeration datatype in this location.
135  EnumType openEnumType(const char* name) const;
136  EnumType openEnumType(const H5std_string& name) const;
137 
138  // Opens a named integer datatype in this location.
139  IntType openIntType(const char* name) const;
140  IntType openIntType(const H5std_string& name) const;
141 
142  // Opens a named floating-point datatype in this location.
143  FloatType openFloatType(const char* name) const;
144  FloatType openFloatType(const H5std_string& name) const;
145 
146  // Opens a named string datatype in this location.
147  StrType openStrType(const char* name) const;
148  StrType openStrType(const H5std_string& name) const;
149 
150  // Opens a named variable length datatype in this location.
151  VarLenType openVarLenType(const char* name) const;
152  VarLenType openVarLenType(const H5std_string& name) const;
153 
154 #ifndef DOXYGEN_SHOULD_SKIP_THIS
155  virtual hid_t getLocId() const = 0;
158 
159 
161  virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
162 
163  // Default constructor.
164  CommonFG();
165 
166  // Noop destructor.
167  virtual ~CommonFG();
168 
169  protected:
170  virtual void p_setId(const hid_t new_id) = 0;
171 
172 #endif // DOXYGEN_SHOULD_SKIP_THIS
173 
174 }; // end of CommonFG declaration
175 
176 #ifndef H5_NO_NAMESPACE
177 }
178 #endif
179 #endif // __CommonFG_H
180 
Class Group represents an HDF5 group.
Definition: H5Group.h:29
Class EnumType operates on HDF5 enum datatypes.
Definition: H5EnumType.h:25
Class DataSpace operates on HDF5 dataspaces.
Definition: H5DataSpace.h:25
Class IntType operates on HDF5 integer datatype.
Definition: H5IntType.h:25
Class DSetCreatPropList represents the dataset creation property list.
Definition: H5DcreatProp.h:31
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:34
VarLenType operates on the HDF5 C's Variable-length Datatypes.
Definition: H5VarLenType.h:25
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:31
Class ArrayType inherits from DataType and provides wrappers for the HDF5's Array Datatypes...
Definition: H5ArrayType.h:28
Class PropList provides operations for generic property lists.
Definition: H5PropList.h:25
Class FloatType operates on HDF5 floating point datatype.
Definition: H5FloatType.h:25
static const DSetCreatPropList & DEFAULT
Default dataset creation property list.
Definition: H5DcreatProp.h:34
Class H5File represents an HDF5 file.
Definition: H5File.h:29
Class StrType operates on HDF5 string datatypes.
Definition: H5StrType.h:25
CompType is a derivative of a DataType and operates on HDF5 compound datatypes.
Definition: H5CompType.h:28
CommonFG is an abstract base class of H5File and H5Group.
Definition: H5CommonFG.h:35


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