HDF5 C++ API Reference Manual

 

 

 

H5DataSet.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 // Class DataSet inherits from AbstractDs and provides accesses to a dataset.
00018 
00019 #ifndef _H5DataSet_H
00020 #define _H5DataSet_H
00021 
00022 #ifndef H5_NO_NAMESPACE
00023 namespace H5 {
00024 #endif
00025 
00026 class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
00027    public:
00028         // Close this dataset.
00029         virtual void close();
00030 
00031         // Extends the dataset with unlimited dimension.
00032         void extend( const hsize_t* size ) const;
00033 
00034         // Fills a selection in memory with a value
00035         void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space);
00036         // Fills a selection in memory with zero
00037         void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space);
00038 
00039         // Gets the creation property list of this dataset.
00040         DSetCreatPropList getCreatePlist() const;
00041 
00042         // Returns the address of this dataset in the file.
00043         haddr_t getOffset() const;
00044 
00045         // Gets the dataspace of this dataset.
00046         virtual DataSpace getSpace() const;
00047 
00048         // Determines whether space has been allocated for a dataset.
00049         void getSpaceStatus(H5D_space_status_t& status) const;
00050 
00051         // Returns the amount of storage size required for this dataset.
00052         virtual hsize_t getStorageSize() const;
00053 
00054         // Returns the in memory size of this attribute's data.
00055         virtual size_t getInMemDataSize() const;
00056 
00057         // Returns the number of bytes required to store VL data.
00058         hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const;
00059 
00060         // Reclaims VL datatype memory buffers.
00061         static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
00062         static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
00063 
00064         // Reads the data of this dataset and stores it in the provided buffer.
00065         // The memory and file dataspaces and the transferring property list
00066         // can be defaults.
00067         void read( void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
00068         void read( H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
00069 
00070         // Writes the buffered data to this dataset.
00071         // The memory and file dataspaces and the transferring property list
00072         // can be defaults.
00073         void write( const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
00074         void write( const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
00075 
00076         // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
00077         int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL );
00078 
00079         // Retrieves the type of object that an object reference points to.
00080         H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
00081 
00082         // Retrieves a dataspace with the region pointed to selected.
00083         DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
00084 
00085         // Returns this class name
00086         virtual H5std_string fromClass () const { return("DataSet"); }
00087 
00088         // Creates a dataset by way of dereference.
00089         DataSet(H5Object& obj, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00090         DataSet(H5File& h5file, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00091         DataSet(Attribute& attr, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00092 
00093         // Default constructor.
00094         DataSet();
00095 
00096         // Copy constructor.
00097         DataSet( const DataSet& original );
00098 
00099         // Creates a copy of an existing DataSet using its id.
00100         DataSet(const hid_t existing_id);
00101 
00102         // Gets the dataset id.
00103         virtual hid_t getId() const;
00104 
00105         // Destructor: properly terminates access to this dataset.
00106         virtual ~DataSet();
00107 
00108    protected:
00109         // Sets the dataset id.
00110         virtual void p_setId(const hid_t new_id);
00111 
00112    private:
00113         hid_t id;       // HDF5 dataset id
00114 
00115         // This function contains the common code that is used by
00116         // getTypeClass and various API functions getXxxType
00117         // defined in AbstractDs for generic datatype and specific
00118         // sub-types
00119         virtual hid_t p_get_type() const;
00120 
00121         // Reads variable or fixed len strings from this dataset.
00122         void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
00123         void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
00124 };
00125 #ifndef H5_NO_NAMESPACE
00126 }
00127 #endif
00128 #endif

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