From e5fff45c0909d91912ee6455c0522ca5112b28a3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 1 Jan 2007 21:11:25 -0500 Subject: [svn-r13092] Purpose: Maintenance Description: Added overloaded method DataSet::vlenReclaim, that has better prototype. Fixed some typos. Platforms tested AIX 5.1 (copper) SunOS 5.8 64-bit (sol) Linux 2.6 (kagiso) --- c++/src/H5DataSet.cpp | 30 +++++++++++++++++++++++++++++- c++/src/H5DataSet.h | 9 ++++++--- c++/src/H5StrType.cpp | 4 ++-- c++/src/H5StrType.h | 2 +- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index ae60e49..f275973 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -220,7 +220,7 @@ hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const ///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSet::vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const +void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf ) { // Obtain identifiers for C API hid_t type_id = type.getId(); @@ -235,6 +235,34 @@ void DataSet::vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList } //-------------------------------------------------------------------------- +// Function: DataSet::vlenReclaim +///\brief Reclaims VL datatype memory buffers. +///\param type - IN: Datatype, which is the datatype stored in the buffer +///\param space - IN: Selection for the memory buffer to free the +/// VL datatypes within +///\param xfer_plist - IN: Property list used to create the buffer +///\param buf - IN: Pointer to the buffer to be reclaimed +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 +//\parDescription +// This function has better prototype for the users than the +// other, which might be removed at some point. BMR - 2006/12/20 +//-------------------------------------------------------------------------- +void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist) +{ + // Obtain identifiers for C API + hid_t type_id = type.getId(); + hid_t space_id = space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); + + herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf); + if (ret_value < 0) + { + throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed"); + } +} + +//-------------------------------------------------------------------------- // Function: DataSet::read ///\brief Reads raw data from the specified dataset. ///\param buf - IN: Buffer for read data diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 1d2f1d7..f12b0ae 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -50,9 +50,12 @@ class H5_DLLCPP DataSet : public AbstractDs { // Returns the amount of storage size required for this dataset. hsize_t getStorageSize() const; - // not yet implemented?? + // Returns the number of bytes required to store VL data. hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const; - void vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const; + + // Reclaims VL datatype memory buffers. + static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf ); + static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT); // Reads the data of this dataset and stores it in the provided buffer. // The memory and file dataspaces and the transferring property list @@ -77,7 +80,7 @@ class H5_DLLCPP DataSet : public AbstractDs { // Creates a reference to a named Hdf5 object or to a dataset region // in this object. - void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; // will be obsolete + void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; // Creates a reference to a named Hdf5 object in this object. void* Reference(const char* name) const; // will be obsolete diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index bbf2bf5..a47327d 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -74,7 +74,7 @@ StrType::StrType( const PredType& pred_type ) : AtomType() /// its overloaded below as StrType(0, size). // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType( const PredType& pred_type, const size_t size ) : AtomType() +StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType() { // use DataType::copy to make a copy of the string predefined type // then set its length @@ -179,7 +179,7 @@ void StrType::setCset( H5T_cset_t cset ) const } //-------------------------------------------------------------------------- -// Function: StrType::getCset +// Function: StrType::getStrpad ///\brief Retrieves the storage mechanism for of this string datatype. ///\return String storage mechanism, which can be: /// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does) diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index e9efa0b..481176e 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -26,7 +26,7 @@ class H5_DLLCPP StrType : public AtomType { StrType(const PredType& pred_type); // Creates a string type with specified length - may be obsolete - StrType(const PredType& pred_type, const size_t size); + StrType(const PredType& pred_type, const size_t& size); // Creates a string type with specified length StrType(const int dummy, const size_t& size); -- cgit v0.12