HDF5 C++ API Reference Manual

 

 

 

H5File.h

Go to the documentation of this file.
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 #ifndef _H5File_H
00018 #define _H5File_H
00019 
00020 #ifndef H5_NO_NAMESPACE
00021 namespace H5 {
00022 #endif
00023 
00024 class H5_DLLCPP H5File : public IdComponent, public CommonFG {
00025    public:
00026         // Creates or opens an HDF5 file.
00027         H5File( const char* name, unsigned int flags,
00028            const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
00029            const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
00030         H5File( const H5std_string& name, unsigned int flags,
00031            const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
00032            const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
00033 
00034         // Open the file
00035         void openFile(const H5std_string& name, unsigned int flags,
00036             const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
00037         void openFile(const char* name, unsigned int flags,
00038             const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
00039 
00040         // Close this file.
00041         virtual void close();
00042 
00043         // Flushes all buffers associated with this file to disk
00044         void flush(H5F_scope_t scope) const;
00045 
00046         // Gets the access property list of this file.
00047         FileAccPropList getAccessPlist() const;
00048 
00049         // Gets the creation property list of this file.
00050         FileCreatPropList getCreatePlist() const;
00051 
00052         // Gets the name of this file.
00053         H5std_string getFileName() const;
00054 
00055         // Retrieves the file size of an opened file.
00056         hsize_t getFileSize() const;
00057 
00058         // Returns the amount of free space in the file.
00059         hssize_t getFreeSpace() const;
00060 
00061         // Returns the number of opened object IDs (files, datasets, groups
00062         // and datatypes) in the same file.
00063         ssize_t getObjCount(unsigned types) const;
00064         ssize_t getObjCount() const;
00065 
00066         // Retrieves a list of opened object IDs (files, datasets, groups
00067         // and datatypes) in the same file.
00068         void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
00069 
00070         // Retrieves the type of object that an object reference points to.
00071         H5G_obj_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
00072 
00073         // Deprecated in favor of getRefObjType
00074         H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
00075 
00076         // Retrieves a dataspace with the region pointed to selected.
00077         DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
00078 
00079         // Returns the pointer to the file handle of the low-level file driver.
00080         void getVFDHandle(FileAccPropList& fapl, void **file_handle) const;
00081         void getVFDHandle(void **file_handle) const;
00082 
00083         // Determines if a file, specified by its name, is in HDF5 format
00084         static bool isHdf5(const char* name );
00085         static bool isHdf5(const H5std_string& name );
00086 
00087         // Reopens this file.
00088         void reOpen();  // added for better name
00089         void reopen();
00090 
00091         // Creates a reference to a named HDF5 object or to a dataset region
00092         // in this object.
00093         void reference(void* ref, const char* name, const DataSpace& dataspace,
00094                         H5R_type_t ref_type = H5R_DATASET_REGION) const;
00095         void reference(void* ref, const char* name) const;
00096         void reference(void* ref, const H5std_string& name) const;
00097 
00098         // Returns this class name
00099         virtual H5std_string fromClass () const { return("H5File"); }
00100 
00101         // Throw file exception.
00102         virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
00103 
00104         // Gets the file id
00105         virtual hid_t getLocId() const;
00106 
00107         // Default constructor
00108         H5File();
00109 
00110         // Copy constructor: makes a copy of the original H5File object.
00111         H5File(const H5File& original);
00112 
00113         // Gets the HDF5 file id.
00114         virtual hid_t getId() const;
00115 
00116         // H5File destructor.
00117         virtual ~H5File();
00118 
00119    protected:
00120         // Sets the HDF5 file id.
00121         virtual void p_setId(const hid_t new_id);
00122 
00123    private:
00124         hid_t id;       // HDF5 file id
00125 
00126 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00127 
00128         // This function is private and contains common code between the
00129         // constructors taking a string or a char*
00130         void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist );
00131 
00132         // Creates a reference to an HDF5 object or a dataset region.
00133         void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
00134 
00135 #ifndef H5_NO_DEPRECATED_SYMBOLS
00136         // Retrieves the type of object that an object reference points to.
00137         H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
00138 #endif /* H5_NO_DEPRECATED_SYMBOLS */
00139 
00140         // Retrieves a dataspace with the region pointed to selected.
00141         hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
00142 
00143 #endif // DOXYGEN_SHOULD_SKIP_THIS
00144 
00145 };
00146 #ifndef H5_NO_NAMESPACE
00147 }
00148 #endif
00149 #endif

Generated on Wed Nov 4 14:13:07 2009 by  doxygen 1.4.7