HDF5 C++ API Reference Manual |
00001 // C++ informative line for the emacs editor: -*- C++ -*- 00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00003 * Copyright by The HDF Group. * 00004 * Copyright by the Board of Trustees of the University of Illinois. * 00005 * All rights reserved. * 00006 * * 00007 * This file is part of HDF5. The full HDF5 copyright notice, including * 00008 * terms governing use, modification, and redistribution, is contained in * 00009 * the files COPYING and Copyright.html. COPYING can be found at the root * 00010 * of the source code distribution tree; Copyright.html can be found at the * 00011 * root level of an installed copy of the electronic HDF5 document set and * 00012 * is linked from the top-level documents page. It can also be found at * 00013 * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * 00014 * access to either file, you may request a copy from help@hdfgroup.org. * 00015 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00016 00017 // CommonFG is a protocol class. Its existence is simply to provide the 00018 // common services that are provided by H5File and Group. The file or 00019 // group in the context of this class is referred to as 'location'. 00020 00021 #ifndef _CommonFG_H 00022 #define _CommonFG_H 00023 00024 #ifndef H5_NO_NAMESPACE 00025 namespace H5 { 00026 #endif 00027 00028 class Group; 00029 class H5File; 00030 class ArrayType; 00031 class VarLenType; 00032 class H5_DLLCPP CommonFG { 00033 public: 00034 // Creates a new group at this location which can be a file 00035 // or another group. 00036 Group createGroup(const char* name, size_t size_hint = 0) const; 00037 Group createGroup(const H5std_string& name, size_t size_hint = 0) const; 00038 00039 // Opens an existing group in a location which can be a file 00040 // or another group. 00041 Group openGroup(const char* name) const; 00042 Group openGroup(const H5std_string& name) const; 00043 00044 // Creates a new dataset at this location. 00045 DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; 00046 DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; 00047 00048 // Opens an existing dataset at this location. 00049 DataSet openDataSet(const char* name) const; 00050 DataSet openDataSet(const H5std_string& name) const; 00051 00052 // Retrieves comment for the HDF5 object specified by its name. 00053 H5std_string getComment(const H5std_string& name) const; 00054 H5std_string getComment(const char* name, size_t bufsize) const; 00055 H5std_string getComment(const H5std_string& name, size_t bufsize) const; 00056 00057 // Removes the comment for the HDF5 object specified by its name. 00058 void removeComment(const char* name) const; 00059 void removeComment(const H5std_string& name) const; 00060 00061 // Sets the comment for an HDF5 object specified by its name. 00062 void setComment(const char* name, const char* comment) const; 00063 void setComment(const H5std_string& name, const H5std_string& comment) const; 00064 00065 // Returns the name of the HDF5 object that the symbolic link points to. 00066 H5std_string getLinkval(const char* name, size_t size=0) const; 00067 H5std_string getLinkval(const H5std_string& name, size_t size=0) const; 00068 00069 // Returns the number of objects in this group. 00070 hsize_t getNumObjs() const; 00071 00072 // Retrieves the name of an object in this group, given the 00073 // object's index. 00074 ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const; 00075 H5std_string getObjnameByIdx(hsize_t idx) const; 00076 00077 // Returns the type of an object in this group, given the 00078 // object's index. 00079 H5G_obj_t getObjTypeByIdx(hsize_t idx) const; 00080 H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const; 00081 00082 // Returns information about an HDF5 object, given by its name, 00083 // at this location. 00084 void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const; 00085 void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const; 00086 void getObjinfo(const char* name, H5G_stat_t& statbuf) const; 00087 void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const; 00088 00089 // Iterates over the elements of this group - not implemented in 00090 // C++ style yet. 00091 int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); 00092 int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data); 00093 00094 // Creates a link of the specified type from new_name to current_name; 00095 // both names are interpreted relative to the specified location id. 00096 void link(H5G_link_t link_type, const char* curr_name, const char* new_name) const; 00097 void link(H5G_link_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const; 00098 00099 // Removes the specified name at this location. 00100 void unlink(const char* name) const; 00101 void unlink(const H5std_string& name) const; 00102 00103 // Mounts the file 'child' onto this location. 00104 void mount(const char* name, H5File& child, PropList& plist) const; 00105 void mount(const H5std_string& name, H5File& child, PropList& plist) const; 00106 00107 // Unmounts the file named 'name' from this parent location. 00108 void unmount(const char* name) const; 00109 void unmount(const H5std_string& name) const; 00110 00111 // Renames an object at this location. 00112 void move(const char* src, const char* dst) const; 00113 void move(const H5std_string& src, const H5std_string& dst) const; 00114 00115 // Opens a generic named datatype in this location. 00116 DataType openDataType(const char* name) const; 00117 DataType openDataType(const H5std_string& name) const; 00118 00119 // Opens a named array datatype in this location. 00120 ArrayType openArrayType(const char* name) const; 00121 ArrayType openArrayType(const H5std_string& name) const; 00122 00123 // Opens a named compound datatype in this location. 00124 CompType openCompType(const char* name) const; 00125 CompType openCompType(const H5std_string& name) const; 00126 00127 // Opens a named enumeration datatype in this location. 00128 EnumType openEnumType(const char* name) const; 00129 EnumType openEnumType(const H5std_string& name) const; 00130 00131 // Opens a named integer datatype in this location. 00132 IntType openIntType(const char* name) const; 00133 IntType openIntType(const H5std_string& name) const; 00134 00135 // Opens a named floating-point datatype in this location. 00136 FloatType openFloatType(const char* name) const; 00137 FloatType openFloatType(const H5std_string& name) const; 00138 00139 // Opens a named string datatype in this location. 00140 StrType openStrType(const char* name) const; 00141 StrType openStrType(const H5std_string& name) const; 00142 00143 // Opens a named variable length datatype in this location. 00144 VarLenType openVarLenType(const char* name) const; 00145 VarLenType openVarLenType(const H5std_string& name) const; 00146 00147 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00150 virtual hid_t getLocId() const = 0; 00151 00152 #endif // DOXYGEN_SHOULD_SKIP_THIS 00153 00155 virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0; 00156 00157 // Default constructor. 00158 CommonFG(); 00159 00160 // Noop destructor. 00161 virtual ~CommonFG(); 00162 00163 }; // end of CommonFG declaration 00164 00165 #ifndef H5_NO_NAMESPACE 00166 } 00167 #endif 00168 #endif 00169