diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-03-14 19:32:26 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-03-14 19:32:26 (GMT) |
commit | 49fa4563ef21009a05c11da5e05d0e71d2c24366 (patch) | |
tree | 73f57a583375fef27b3616e0febaa786394c7ae5 /c++/src/H5DataSet.cpp | |
parent | 7e6577fdea9f78e4b140f2b1c7684c9cec7d9a7e (diff) | |
download | hdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.zip hdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.tar.gz hdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.tar.bz2 |
[svn-r10212] Purpose: Added more wrappers
Description:
Added the following to the C++ library
+ overloaded functions:
string CommonFG::getObjnameByIdx(hsize_t idx)
H5T_order_t AtomType::getOrder()
+ wrappers for H5*close
+ wrappers for H5Arename, H5Aget_storage_size, and H5Dget_storage_size
Platforms tested:
Linux 2.4 (heping)
AIX 5.1 (copper)
SunOS 5.8 64-bit (sol)
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r-- | c++/src/H5DataSet.cpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 635c9fa..1e8af3c 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -118,20 +118,16 @@ DSetCreatPropList DataSet::getCreatePlist() const //-------------------------------------------------------------------------- // Function: DataSet::getStorageSize ///\brief Returns the amount of storage required for a dataset. -///\return Amount of storage +///\return Size of the storage or 0, for no data ///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Note: H5Dget_storage_size returns 0 when there is no data. This +// function should have no failure. (from SLU) +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- hsize_t DataSet::getStorageSize() const { - hsize_t storage_size = H5Dget_storage_size( id ); - - if( storage_size > 0 ) // checking with Quincey for failure value - BMR - return( storage_size ); - else - { - throw DataSetIException("DataSet::getStorageSize", "H5Dget_storage_size failed"); - } + hsize_t storage_size = H5Dget_storage_size(id); + return(storage_size); } //-------------------------------------------------------------------------- @@ -187,13 +183,13 @@ hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size ); if( ret_value < 0 ) { - throw DataSetIException("DataSet::getStorageSize", "H5Dget_storage_size failed"); + throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed"); } return( size ); } //-------------------------------------------------------------------------- -// Function: DataSet::getVlenBufSize +// 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 @@ -479,6 +475,23 @@ DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const } //-------------------------------------------------------------------------- +// Function: DataSet::close +///\brief Closes this dataset. +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 +//-------------------------------------------------------------------------- +void DataSet::close() +{ + herr_t ret_value = H5Dclose( id ); + if( ret_value < 0 ) + { + throw DataSetIException("DataSet::close", "H5Dclose failed"); + } + // reset the id because the group that it represents is now closed + id = 0; +} + +//-------------------------------------------------------------------------- // Function: DataSet destructor ///\brief Properly terminates access to this dataset. // Programmer Binh-Minh Ribler - 2000 |