From 23de8877a3025bb2f8751b312dfe5751b8b91074 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 26 May 2004 18:33:55 -0500 Subject: [svn-r8587] Purpose: Add C++ wrappers - incrementally check-in Description Added wrapper for these C APIs: H5Dget_offset H5Dget_space_status Platforms: SunOS 5.7 (arabica) Linux 2.4 (eirene) Misc. update: --- c++/src/H5DataSet.cpp | 35 +++++++++++++++++++++++++++++++++++ c++/src/H5DataSet.h | 6 ++++++ 2 files changed, 41 insertions(+) diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 950f28c..c8171b9 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -136,6 +136,41 @@ hsize_t DataSet::getStorageSize() const } //-------------------------------------------------------------------------- +// Function: DataSet::getOffset +///\brief Returns the address of this dataset in the file. +///\return Address of dataset +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +haddr_t DataSet::getOffset() const +{ + haddr_t ds_addr; // for address of dataset + + ds_addr = H5Dget_offset(id); + if( ds_addr == HADDR_UNDEF ) + { + throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF"); + } + return(ds_addr); +} + +//-------------------------------------------------------------------------- +// Function: DataSet::getSpaceStatus +///\brief Determines whether space has been allocated for a dataset. +///\param status - OUT: Space allocation status +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DataSet::getSpaceStatus(H5D_space_status_t& status) const +{ + herr_t ret_value = H5Dget_space_status(id, &status); + if( ret_value < 0 ) + { + throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed"); + } +} + +//-------------------------------------------------------------------------- // Function: DataSet::getVlenBufSize ///\brief Returns the number of bytes required to store VL data. ///\return Amount of storage diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 9f01eb4..e97a963 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -33,6 +33,12 @@ class H5_DLLCPP DataSet : public AbstractDs { // Gets the storage size of this dataset. hsize_t getStorageSize() const; + // Returns the address of this dataset in the file. + haddr_t getOffset() const; + + // Determines whether space has been allocated for a dataset. + void getSpaceStatus(H5D_space_status_t& status) const; + // not yet implemented?? hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const; void vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const; -- cgit v0.12