H5CommonFG.h

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 char* name, size_t bufsize=256) const;
00054         H5std_string getComment(const H5std_string& name, size_t bufsize=256) const;
00055 
00056         // Removes the comment for the HDF5 object specified by its name.
00057         void removeComment(const char* name) const;
00058         void removeComment(const H5std_string& name) const;
00059 
00060         // Sets the comment for an HDF5 object specified by its name.
00061         void setComment(const char* name, const char* comment) const;
00062         void setComment(const H5std_string& name, const H5std_string& comment) const;
00063 
00064         // Returns the value of a symbolic link.
00065         H5std_string getLinkval(const char* link_name, size_t size=0) const;
00066         H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
00067 
00068         // Returns the number of objects in this group.
00069         hsize_t getNumObjs() const;
00070 
00071         // Retrieves the name of an object in this group, given the
00072         // object's index.
00073         ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
00074         H5std_string getObjnameByIdx(hsize_t idx) const;
00075 
00076 #ifndef H5_NO_DEPRECATED_SYMBOLS
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 #endif /* H5_NO_DEPRECATED_SYMBOLS */
00094 
00095         // Creates a link of the specified type from new_name to current_name;
00096         // both names are interpreted relative to the specified location id.
00097         void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
00098         void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
00099 
00100         // Removes the specified name at this location.
00101         void unlink(const char* name) const;
00102         void unlink(const H5std_string& name) const;
00103 
00104         // Mounts the file 'child' onto this location.
00105         void mount(const char* name, H5File& child, PropList& plist) const;
00106         void mount(const H5std_string& name, H5File& child, PropList& plist) const;
00107 
00108         // Unmounts the file named 'name' from this parent location.
00109         void unmount(const char* name) const;
00110         void unmount(const H5std_string& name) const;
00111 
00112         // Renames an object at this location.
00113         void move(const char* src, const char* dst) const;
00114         void move(const H5std_string& src, const H5std_string& dst) const;
00115 
00116         // Opens a generic named datatype in this location.
00117         DataType openDataType(const char* name) const;
00118         DataType openDataType(const H5std_string& name) const;
00119 
00120         // Opens a named array datatype in this location.
00121         ArrayType openArrayType(const char* name) const;
00122         ArrayType openArrayType(const H5std_string& name) const;
00123 
00124         // Opens a named compound datatype in this location.
00125         CompType openCompType(const char* name) const;
00126         CompType openCompType(const H5std_string& name) const;
00127 
00128         // Opens a named enumeration datatype in this location.
00129         EnumType openEnumType(const char* name) const;
00130         EnumType openEnumType(const H5std_string& name) const;
00131 
00132         // Opens a named integer datatype in this location.
00133         IntType openIntType(const char* name) const;
00134         IntType openIntType(const H5std_string& name) const;
00135 
00136         // Opens a named floating-point datatype in this location.
00137         FloatType openFloatType(const char* name) const;
00138         FloatType openFloatType(const H5std_string& name) const;
00139 
00140         // Opens a named string datatype in this location.
00141         StrType openStrType(const char* name) const;
00142         StrType openStrType(const H5std_string& name) const;
00143 
00144         // Opens a named variable length datatype in this location.
00145         VarLenType openVarLenType(const char* name) const;
00146         VarLenType openVarLenType(const H5std_string& name) const;
00147 
00148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00149 
00150 
00151         virtual hid_t getLocId() const = 0;
00152 
00153 #endif // DOXYGEN_SHOULD_SKIP_THIS
00154 
00156         virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
00157 
00158         // Default constructor.
00159         CommonFG();
00160 
00161         // Noop destructor.
00162         virtual ~CommonFG();
00163 
00164 }; // end of CommonFG declaration
00165 
00166 #ifndef H5_NO_NAMESPACE
00167 }
00168 #endif
00169 #endif
00170