diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-08-08 15:42:39 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-08-08 15:42:39 (GMT) |
commit | f74bef15ced59291d51e0d3428e2dd595ed37260 (patch) | |
tree | 7af4e30ad90920545c29911e4b34e8da6d290bf1 /c++/src | |
parent | ea15f348a1254b5a4ed3e8039f191a0430e4c3f2 (diff) | |
download | hdf5-f74bef15ced59291d51e0d3428e2dd595ed37260.zip hdf5-f74bef15ced59291d51e0d3428e2dd595ed37260.tar.gz hdf5-f74bef15ced59291d51e0d3428e2dd595ed37260.tar.bz2 |
[svn-r11210] Purpose: Code improvement
Description:
Made use of IdComponent::inMemFunc in more classes.
Platforms tested:
Linux 2.4 (heping)
SunOS 5.8 64-bit (sol)
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5AtomType.cpp | 18 | ||||
-rw-r--r-- | c++/src/H5DataSpace.h | 3 | ||||
-rw-r--r-- | c++/src/H5DcreatProp.h | 3 | ||||
-rw-r--r-- | c++/src/H5DxferProp.h | 3 | ||||
-rw-r--r-- | c++/src/H5FaccProp.h | 3 | ||||
-rw-r--r-- | c++/src/H5FcreatProp.h | 3 | ||||
-rw-r--r-- | c++/src/H5IdComponent.cpp | 8 | ||||
-rw-r--r-- | c++/src/H5Object.cpp | 18 | ||||
-rw-r--r-- | c++/src/H5PredType.h | 4 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 38 | ||||
-rw-r--r-- | c++/src/H5PropList.h | 3 |
11 files changed, 63 insertions, 41 deletions
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index c8c38e9..56bb6eb 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -66,7 +66,7 @@ void AtomType::setSize( size_t size ) const herr_t ret_value = H5Tset_size( id, size ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::setSize", "H5Tset_size failed"); + throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed"); } } @@ -88,7 +88,7 @@ H5T_order_t AtomType::getOrder() const // return a byte order constant if successful if( type_order == H5T_ORDER_ERROR ) { - throw DataTypeIException("AtomType::getOrder", + throw DataTypeIException(inMemFunc("getOrder"), "H5Tget_order returns H5T_ORDER_ERROR"); } return( type_order ); @@ -142,7 +142,7 @@ void AtomType::setOrder( H5T_order_t order ) const herr_t ret_value = H5Tset_order( id, order ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::setOrder", "H5Tset_order failed"); + throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed"); } } @@ -164,7 +164,7 @@ size_t AtomType::getPrecision() const // returns number of significant bits if successful if( num_signi_bits == 0 ) { - throw DataTypeIException("AtomType::getPrecision", + throw DataTypeIException(inMemFunc("getPrecision"), "H5Tget_precision returns invalid number of significant bits"); } return( num_signi_bits ); @@ -186,7 +186,7 @@ void AtomType::setPrecision( size_t precision ) const herr_t ret_value = H5Tset_precision( id, precision ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::setPrecision", "H5Tset_precision failed"); + throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed"); } } @@ -211,7 +211,7 @@ int AtomType::getOffset() const // returns a non-negative offset value if successful if( offset == -1 ) { - throw DataTypeIException("AtomType::getOffset", + throw DataTypeIException(inMemFunc("getOffset"), "H5Tget_offset returns a negative offset value"); } return( offset ); @@ -233,7 +233,7 @@ void AtomType::setOffset( size_t offset ) const herr_t ret_value = H5Tset_offset( id, offset ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::setOffset", "H5Tset_offset failed"); + throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed"); } } @@ -257,7 +257,7 @@ void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const herr_t ret_value = H5Tget_pad( id, &lsb, &msb ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::getPad", "H5Tget_pad failed"); + throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed"); } } @@ -280,7 +280,7 @@ void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const herr_t ret_value = H5Tset_pad( id, lsb, msb ); if( ret_value < 0 ) { - throw DataTypeIException("AtomType::setPad", "H5Tset_pad failed"); + throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed"); } } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index ee568e4..46c620e 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -102,6 +102,9 @@ class H5_DLLCPP DataSpace : public IdComponent { // Sets or resets the size of this dataspace. void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; + // Returns this class name + virtual string fromClass () const { return ("DataSpace"); } + // Creates a DataSpace object using an existing dataspace id. DataSpace(const hid_t space_id); diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index d1b5fb5..fabadc6 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -100,6 +100,9 @@ class H5_DLLCPP DSetCreatPropList : public PropList { // Sets method of the shuffle filter. void setShuffle(); + // Returns this class name + virtual string fromClass () const { return ("DSetCreatPropList"); } + // Default constructor: creates a stub dataset creation property list. DSetCreatPropList(); diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 439bc3d..2d00a5b 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -94,6 +94,9 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Determines whether error-detection is enabled for dataset reads. H5Z_EDC_t getEDCCheck(); + // Returns this class name + virtual string fromClass () const { return ("DSetMemXferPropList"); } + // Creates a copy of an existing dataset memory and transfer // property list using the property list id. DSetMemXferPropList (const hid_t plist_id); diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 6a447b0..d77fa49 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -119,6 +119,9 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; + // Returns this class name + virtual string fromClass () const { return ("FileAccPropList"); } + // Creates a file access property list. FileAccPropList(); diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index aa955d5..6b7bfcc 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -56,6 +56,9 @@ class H5_DLLCPP FileCreatPropList : public PropList { // indexing chunked datasets. void setIstorek( unsigned ik ) const; + // Returns this class name + virtual string fromClass () const { return ("FileCreatPropList"); } + // Creates a file create property list. FileCreatPropList(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 15a4898..51bdc02 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -53,7 +53,7 @@ void IdComponent::incRefCount(const hid_t obj_id) const { if (p_valid_id(obj_id)) if (H5Iinc_ref(obj_id) < 0) - throw IdComponentException("IdComponent::incRefCount", "incrementing object ref count failed"); + throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed"); } //-------------------------------------------------------------------------- @@ -79,10 +79,10 @@ void IdComponent::decRefCount(const hid_t obj_id) const if (p_valid_id(obj_id)) if (H5Idec_ref(obj_id) < 0) if (H5Iget_ref(obj_id) <= 0) - throw IdComponentException("IdComponent::decRefCount", + throw IdComponentException(inMemFunc("decRefCount"), "object ref count is 0 or negative"); else - throw IdComponentException("IdComponent::decRefCount", + throw IdComponentException(inMemFunc("decRefCount"), "decrementing object ref count failed"); } @@ -109,7 +109,7 @@ int IdComponent::getCounter(const hid_t obj_id) const { counter = H5Iget_ref(obj_id); if (counter < 0) - throw IdComponentException("IdComponent::incRefCount", "incrementing object ref count failed"); + throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed"); } return (counter); } diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 2ca26c9..27c62ad 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -111,7 +111,7 @@ Attribute H5Object::createAttribute( const char* name, const DataType& data_type } else { - throw AttributeIException("H5Object::createAttribute", "H5Acreate failed"); + throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate failed"); } } @@ -145,7 +145,7 @@ Attribute H5Object::openAttribute( const char* name ) const } else { - throw AttributeIException("H5Object::openAttribute", "H5Aopen_name failed"); + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_name failed"); } } @@ -179,7 +179,7 @@ Attribute H5Object::openAttribute( const unsigned int idx ) const } else { - throw AttributeIException("H5Object::openAttribute", "H5Aopen_idx failed"); + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_idx failed"); } } @@ -217,7 +217,7 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned * idx, void *op_da return( ret_value ); else // raise exception when H5Aiterate returns a negative value { - throw AttributeIException("H5Object::iterateAttrs", "H5Aiterate failed"); + throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate failed"); } } @@ -233,7 +233,7 @@ int H5Object::getNumAttrs() const int num_attrs = H5Aget_num_attrs( id ); if( num_attrs < 0 ) { - throw AttributeIException("H5Object::getNumAttrs", + throw AttributeIException(inMemFunc("getNumAttrs"), "H5Aget_num_attrs failed - returned negative number of attributes"); } else @@ -252,7 +252,7 @@ void H5Object::removeAttr( const char* name ) const herr_t ret_value = H5Adelete( id, name ); if( ret_value < 0 ) { - throw AttributeIException("H5Object::removeAttr", "H5Adelete failed"); + throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); } } @@ -281,7 +281,7 @@ void H5Object::renameAttr(const char* oldname, const char* newname) const herr_t ret_value = H5Arename(id, oldname, newname); if (ret_value < 0) { - throw AttributeIException("H5Object::renameAttr", "H5Arename failed"); + throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); } } @@ -314,7 +314,7 @@ void H5Object::flush(H5F_scope_t scope ) const herr_t ret_value = H5Fflush( id, scope ); if( ret_value < 0 ) { - throw FileIException("H5Object::flush", "H5Fflush failed"); + throw FileIException(inMemFunc("flush"), "H5Fflush failed"); } } @@ -331,7 +331,7 @@ string H5Object::getFileName() const return(p_get_file_name()); } catch (IdComponentException E) { - throw FileIException("H5Object::getFileName", E.getDetailMsg()); + throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); } } diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 7742c90..d444b52 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -179,6 +179,10 @@ class H5_DLLCPP PredType : public AtomType { static const PredType NATIVE_UINT_FAST64; #ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Returns this class name + virtual string fromClass () const { return ("PredType"); } + // These dummy functions do not inherit from DataType - they'll // throw a DataTypeIException if invoked. void commit( H5Object& loc, const string& name ); diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index b448830..dc9cfc3 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -98,14 +98,14 @@ void PropList::copy( const PropList& like_plist ) decRefCount(); } catch (Exception close_error) { - throw PropListIException("PropList::copy", close_error.getDetailMsg()); + throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg()); } // call C routine to copy the property list id = H5Pcopy( like_plist.getId() ); if( id < 0 ) - throw PropListIException("PropList::copy", "H5Pcopy failed"); + throw PropListIException(inMemFunc("copy"), "H5Pcopy failed"); } //-------------------------------------------------------------------------- @@ -139,7 +139,7 @@ void PropList::copyProp(PropList& dest, const char *name) const herr_t ret_value = H5Pcopy_prop(dst_id, id, name); if( ret_value < 0 ) { - throw PropListIException("PropList::copyProp", "H5Pcopy_prop failed"); + throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); } } @@ -174,7 +174,7 @@ void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name); if( ret_value < 0 ) { - throw PropListIException("PropList::copyProp", "H5Pcopy_prop failed"); + throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); } } @@ -208,13 +208,13 @@ void PropList::close() herr_t ret_value = H5Pclose( id ); if( ret_value < 0 ) { - throw PropListIException("PropList::close", "H5Pclose failed"); + throw PropListIException(inMemFunc("close"), "H5Pclose failed"); } // reset the id because the property list that it represents is now closed id = 0; } else - throw PropListIException("PropList::close", "Cannot close a constant"); + throw PropListIException(inMemFunc("close"), "Cannot close a constant"); } //-------------------------------------------------------------------------- @@ -229,7 +229,7 @@ hid_t PropList::getClass() const hid_t plist_class = H5Pget_class( id ); if( plist_class == H5P_NO_CLASS ) { - throw PropListIException("PropList::getClass", + throw PropListIException(inMemFunc("getClass"), "H5Pget_class failed - returned H5P_NO_CLASS"); } return( plist_class ); @@ -259,7 +259,7 @@ bool PropList::propExist(const char* name ) const return false; else // Raise exception when H5Pexist returns a negative value { - throw PropListIException("PropList::propExist", "H5Pexist failed"); + throw PropListIException(inMemFunc("propExist"), "H5Pexist failed"); } } //-------------------------------------------------------------------------- @@ -290,7 +290,7 @@ void PropList::closeClass() const herr_t ret_value = H5Pclose_class(id); if( ret_value < 0 ) { - throw PropListIException("PropList::closeClass", "H5Pclose_class failed"); + throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed"); } } @@ -311,7 +311,7 @@ void PropList::getProperty(const char* name, void* value) const herr_t ret_value = H5Pget(id, name, value); if (ret_value < 0) { - throw PropListIException("PropList::getProperty", "H5Pget failed"); + throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); } } //-------------------------------------------------------------------------- @@ -333,7 +333,7 @@ string PropList::getProperty(const char* name) const // Throw exception if H5Pget returns failure if (ret_value < 0) { - throw PropListIException("PropList::getProperty", "H5Pget failed"); + throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); } // Return propety value as a string after deleting temp C-string @@ -387,7 +387,7 @@ size_t PropList::getPropSize(const char *name) const herr_t ret_value = H5Pget_size(id, name, &prop_size); if (ret_value < 0) { - throw PropListIException("PropList::getPropSize", "H5Pget_size failed"); + throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed"); } return(prop_size); } @@ -439,7 +439,7 @@ size_t PropList::getNumProps() const herr_t ret_value = H5Pget_nprops (id, &nprops); if (ret_value < 0) { - throw PropListIException("PropList::getNumProps", "H5Pget_nprops failed"); + throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed"); } return (nprops); } @@ -457,7 +457,7 @@ void PropList::setProperty(const char* name, void* value) const herr_t ret_value = H5Pset(id, name, value); if (ret_value < 0) { - throw PropListIException("PropList::setProperty", "H5Pset failed"); + throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); } } //-------------------------------------------------------------------------- @@ -474,7 +474,7 @@ void PropList::setProperty(const char* name, const char* charptr) const herr_t ret_value = H5Pset(id, name, (void*) charptr); if (ret_value < 0) { - throw PropListIException("PropList::setProperty", "H5Pset failed"); + throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); } } //-------------------------------------------------------------------------- @@ -537,7 +537,7 @@ bool PropList::isAClass(const PropList& prop_class) const return false; else // Raise exception when H5Pisa_class returns a negative value { - throw PropListIException("PropList::isAClass", "H5Pisa_class failed"); + throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed"); } } @@ -554,7 +554,7 @@ void PropList::removeProp(const char *name) const herr_t ret_value = H5Premove(id, name); if (ret_value < 0) { - throw PropListIException("PropList::removeProp", "H5Premove failed"); + throw PropListIException(inMemFunc("removeProp"), "H5Premove failed"); } } @@ -589,7 +589,7 @@ bool PropList::operator==(const PropList& rhs) const return false; else // Raise exception when H5Pequal returns a negative value { - throw PropListIException("PropList::operator==", "H5Pequal failed"); + throw PropListIException(inMemFunc("operator=="), "H5Pequal failed"); } } @@ -605,7 +605,7 @@ PropList PropList::getClassParent() const hid_t class_id = H5Pget_class_parent(id); if (class_id <= 0) { - throw PropListIException("PropList::getClassParent", "H5Pget_class_parent failed"); + throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed"); } PropList pclass(class_id); return(pclass); diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 1d4816f..84883ad 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -93,6 +93,9 @@ class H5_DLLCPP PropList : public IdComponent { void removeProp(const char *name) const; void removeProp(const string& name) const; + // Returns this class name + virtual string fromClass () const { return ("PropList"); } + // Default constructor: creates a stub PropList object. PropList(); |