From 85b599e9332c1d7d6f454425b66ad43e78954814 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Tue, 27 Apr 2004 14:16:35 -0500 Subject: [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 --- c++/src/H5DataType.cpp | 18 ------------------ c++/src/H5DataType.h | 6 ------ c++/src/H5DxferProp.cpp | 24 ++++++++++++++++++++++++ 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, -- cgit v0.12