diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-04-27 19:16:35 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-04-27 19:16:35 (GMT) |
commit | 85b599e9332c1d7d6f454425b66ad43e78954814 (patch) | |
tree | 569f6dc4c55759da189280c4c49966052ed81b1a /c++ | |
parent | 4fa0c3f5bc09d0948e1dde9c3ed3ebc700109936 (diff) | |
download | hdf5-85b599e9332c1d7d6f454425b66ad43e78954814.zip hdf5-85b599e9332c1d7d6f454425b66ad43e78954814.tar.gz hdf5-85b599e9332c1d7d6f454425b66ad43e78954814.tar.bz2 |
[svn-r8423] Purpose: New feature
Description: A new exception handler for datatype conversion(set through
H5Pset_type_conv_cb) to replace the old overflow callback function(set
through H5Tset_overflow). This new handler can deal with overflow, precision
loss and fraction truncate during datatype conversion.
Platforms tested: h5committest
Misc. update: release_docs
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5DataType.cpp | 18 | ||||
-rw-r--r-- | c++/src/H5DataType.h | 6 | ||||
-rw-r--r-- | c++/src/H5DxferProp.cpp | 24 | ||||
-rw-r--r-- | c++/src/H5DxferProp.h | 6 |
4 files changed, 30 insertions, 24 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 290ebb7..b6249fe 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -185,24 +185,6 @@ void DataType::convert( const DataType& dest, hsize_t nelmts, void *buf, void *b } } -// Sets the overflow handler to a specified function. -void DataType::setOverflow( H5T_overflow_t func ) const -{ - // Call C routine H5Tset_overflow to set the overflow handler - herr_t ret_value = H5Tset_overflow( func ); - if( ret_value < 0 ) - { - throw DataTypeIException("DataType::setOverflow", "H5Tset_overflow failed"); - } -} - -// Returns a pointer to the current global overflow function. -H5T_overflow_t DataType::getOverflow(void) const -{ - return( H5Tget_overflow()); // C routine - // NULL can be returned as well -} - // Locks a datatype. void DataType::lock() const { diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index c0aa56d..0fe462f 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -50,12 +50,6 @@ class H5_DLLCPP DataType : public H5Object { // Converts data from between specified datatypes. void convert( const DataType& dest, hsize_t nelmts, void *buf, void *background, PropList& plist ) const; - // Sets the overflow handler to a specified function. - void setOverflow(H5T_overflow_t func) const; - - // Returns a pointer to the current global overflow function. - H5T_overflow_t getOverflow(void) const; - // Assignment operator DataType& operator=( const DataType& rhs ); diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 8a7b06c..0c0b0db 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -104,6 +104,30 @@ void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& } } +// Sets an exception handling callback for datatype conversion +// for a dataset transfer property list +void DSetMemXferPropList::setTypeConvCB( H5T_conv_except_func_t *op, void *user_data) const +{ + herr_t ret_value = H5Pset_type_conv_cb( id, op, user_data); + if( ret_value < 0 ) + { + throw PropListIException("DSetMemXferPropList::setTypeConvCB", + "H5Pset_type_conv_cb failed"); + } +} + +// Sets an exception handling callback for datatype conversion +// for a dataset transfer property list +void DSetMemXferPropList::getTypeConvCB( H5T_conv_except_func_t **op, void **user_data) const +{ + herr_t ret_value = H5Pget_type_conv_cb( id, op, user_data); + if( ret_value < 0 ) + { + throw PropListIException("DSetMemXferPropList::getTypeConvCB", + "H5Pget_type_conv_cb failed"); + } +} + // Sets the memory manager for variable-length datatype allocation void DSetMemXferPropList::setVlenMemManager( H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info ) const { diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 036bbb1..5bdb557 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -48,6 +48,12 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Gets B-tree split ratios for a dataset transfer property list void getBtreeRatios( double& left, double& middle, double& right ) const; + // Sets an exception handling callback for datatype conversion + void setTypeConvCB( H5T_conv_except_func_t *op, void *user_data) const; + + // Gets the exception handling callback for datatype conversion + void getTypeConvCB( H5T_conv_except_func_t **op, void **user_data) const; + // Sets the memory manager for variable-length datatype // allocation in H5Dread and H5Dvlen_reclaim void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info, |