HDF5 C++ API Reference Manual

 

 

Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Examples

H5File.h

Go to the documentation of this file.
00001 // C++ informative line for the emacs editor: -*- C++ -*-
00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have     *
00013  * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 #ifndef _H5File_H
00017 #define _H5File_H
00018 
00019 #ifndef H5_NO_NAMESPACE
00020 namespace H5 {
00021 #endif
00022 
00023 class H5_DLLCPP H5File : public IdComponent, public CommonFG {
00024    public:
00025         // Creates or opens an HDF5 file.
00026         H5File( const char* name, unsigned int flags,
00027            const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
00028            const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
00029         H5File( const H5std_string& name, unsigned int flags,
00030            const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
00031            const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
00032 
00033         // Open the file
00034         void openFile(const H5std_string& name, unsigned int flags,
00035             const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
00036         void openFile(const char* name, unsigned int flags,
00037             const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
00038 
00039         // Close this file.
00040         virtual void close();
00041 
00042         // Flushes all buffers associated with this file to disk
00043         void flush(H5F_scope_t scope) const;
00044 
00045         // Gets the access property list of this file.
00046         FileAccPropList getAccessPlist() const;
00047 
00048         // Gets the creation property list of this file.
00049         FileCreatPropList getCreatePlist() const;
00050 
00051         // Gets the name of this file.
00052         H5std_string getFileName() const;
00053 
00054         // Retrieves the file size of an opened file.
00055         hsize_t getFileSize() const;
00056 
00057         // Returns the amount of free space in the file.
00058         hssize_t getFreeSpace() const;
00059 
00060         // Returns the number of opened object IDs (files, datasets, groups
00061         // and datatypes) in the same file.
00062         int getObjCount(unsigned types) const;
00063         int getObjCount() const;
00064 
00065         // Retrieves a list of opened object IDs (files, datasets, groups
00066         // and datatypes) in the same file.
00067         void getObjIDs(unsigned types, int max_objs, hid_t *oid_list) const;
00068 
00069         // Retrieves the type of object that an object reference points to.
00070         H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const;
00071 
00072         // Retrieves a dataspace with the region pointed to selected.
00073         DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
00074 
00075         // Returns the pointer to the file handle of the low-level file driver.
00076         void getVFDHandle(FileAccPropList& fapl, void **file_handle) const;
00077         void getVFDHandle(void **file_handle) const;
00078 
00079         // Determines if a file, specified by its name, is in HDF5 format
00080         static bool isHdf5(const char* name );
00081         static bool isHdf5(const H5std_string& name );
00082 
00083         // Reopens this file.
00084         void reOpen();  // added for better name
00085         void reopen();
00086 
00087         // Creates a reference to a named Hdf5 object or to a dataset region
00088         // in this object.
00089         void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const;
00090 
00091         // Creates a reference to a named Hdf5 object in this object.
00092         void* Reference(const char* name) const;
00093         void* Reference(const H5std_string& name) const;
00094 
00095         // Returns this class name
00096         virtual H5std_string fromClass () const { return("H5File"); }
00097 
00098         // Throw file exception.
00099         virtual void throwException(const H5std_string func_name, const H5std_string msg) const;
00100 
00101         // Gets the file id
00102         virtual hid_t getLocId() const;
00103 
00104         // Default constructor
00105         H5File();
00106 
00107         // Copy constructor: makes a copy of the original H5File object.
00108         H5File(const H5File& original);
00109 
00110         // H5File destructor.
00111         virtual ~H5File();
00112 
00113    private:
00114         // This function is private and contains common code between the
00115         // constructors taking a string or a char*
00116         void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist );
00117 
00118 };
00119 #ifndef H5_NO_NAMESPACE
00120 }
00121 #endif
00122 #endif

Generated on Thu Apr 20 15:16:40 2006 by doxygen 1.3.2