diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-03-25 15:25:22 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-03-25 15:25:22 (GMT) |
commit | dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4 (patch) | |
tree | 963a5b4952cbb88253df8850d1cc19d70b6f614c /c++ | |
parent | ebb80dbae183e75ccf90f899f3ee1491946f93ec (diff) | |
parent | 6e1122dda4e446f6e9ad9ce4a9c2da8d40e441e3 (diff) | |
download | hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.zip hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.tar.gz hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.tar.bz2 |
[svn-r23443] merged from trunk
Diffstat (limited to 'c++')
-rw-r--r-- | c++/Makefile.in | 2 | ||||
-rw-r--r-- | c++/examples/Makefile.in | 2 | ||||
-rw-r--r-- | c++/src/H5CommonFG.cpp | 49 | ||||
-rw-r--r-- | c++/src/H5DxferProp.cpp | 37 | ||||
-rw-r--r-- | c++/src/H5File.cpp | 24 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 33 | ||||
-rw-r--r-- | c++/src/H5Location.h | 10 | ||||
-rw-r--r-- | c++/src/Makefile.in | 4 | ||||
-rw-r--r-- | c++/src/h5c++.in | 47 | ||||
-rw-r--r-- | c++/test/Makefile.in | 2 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 6 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 78 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 1 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 12 | ||||
-rw-r--r-- | c++/test/tfilter.cpp | 4 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 1 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 3 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 2 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 4 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 5 |
20 files changed, 194 insertions, 132 deletions
diff --git a/c++/Makefile.in b/c++/Makefile.in index fe9ce2b..75865f1 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -222,6 +222,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -273,7 +274,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 021edca..e55ee2c 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -189,6 +189,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -240,7 +241,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index dcc331f..b3889a0 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -130,9 +130,7 @@ Group CommonFG::openGroup( const char* name ) const // If the opening of the group failed, throw an exception if( group_id < 0 ) - { throwException("openGroup", "H5Gopen2 failed"); - } // No failure, create and return the Group object Group group( group_id ); @@ -174,9 +172,7 @@ DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, co // If the creation of the dataset failed, throw an exception if( dataset_id < 0 ) - { throwException("createDataSet", "H5Dcreate2 failed"); - } // No failure, create and return the DataSet object DataSet dataset( dataset_id ); @@ -270,9 +266,8 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne break; } /* end switch */ - if( ret_value < 0 ) { + if( ret_value < 0 ) throwException("link", "creating link failed"); - } } //-------------------------------------------------------------------------- @@ -300,9 +295,7 @@ void CommonFG::unlink( const char* name ) const { herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("unlink", "H5Ldelete failed"); - } } //-------------------------------------------------------------------------- @@ -336,9 +329,7 @@ void CommonFG::move( const char* src, const char* dst ) const { herr_t ret_value = H5Lmove( getLocId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("move", "H5Lmove failed"); - } } //-------------------------------------------------------------------------- @@ -371,9 +362,7 @@ void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& st { herr_t ret_value = H5Gget_objinfo( getLocId(), name, follow_link, &statbuf ); if( ret_value < 0 ) - { throwException("getObjinfo", "H5Gget_objinfo failed"); - } } //-------------------------------------------------------------------------- @@ -400,9 +389,7 @@ void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const { herr_t ret_value = H5Gget_objinfo( getLocId(), name, 0, &statbuf ); if( ret_value < 0 ) - { throwException("getObjinfo", "H5Gget_objinfo failed"); - } } //-------------------------------------------------------------------------- @@ -440,9 +427,8 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const { ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("getLinkval", "H5Lget_info to find buffer size failed"); - } + val_size = linkinfo.u.val_size; } @@ -453,9 +439,8 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("getLinkval", "H5Lget_val failed"); - } + value = H5std_string(value_C); delete []value_C; } @@ -498,9 +483,7 @@ void CommonFG::setComment( const char* name, const char* comment ) const { herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("setComment", "H5Oset_comment_by_name failed"); - } } //-------------------------------------------------------------------------- @@ -530,9 +513,7 @@ void CommonFG::removeComment(const char* name) const { herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("removeComment", "H5Oset_comment_by_name failed"); - } } //-------------------------------------------------------------------------- @@ -588,9 +569,8 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // if H5Oget_comment_by_name returns SUCCEED, return the string comment, // otherwise, throw an exception if( ret_value < 0 ) - { throwException("getComment", "H5Oget_comment_by_name failed"); - } + H5std_string comment = H5std_string(comment_C); delete []comment_C; return (comment); @@ -628,9 +608,7 @@ void CommonFG::mount( const char* name, H5File& child, PropList& plist ) const // Raise exception if H5Fmount returns negative value if( ret_value < 0 ) - { throwException("mount", "H5Fmount failed"); - } } //-------------------------------------------------------------------------- @@ -659,9 +637,7 @@ void CommonFG::unmount( const char* name ) const // Raise exception if H5Funmount returns negative value if( ret_value < 0 ) - { throwException("unmount", "H5Funmount failed"); - } } //-------------------------------------------------------------------------- @@ -1006,9 +982,7 @@ hsize_t CommonFG::getNumObjs() const herr_t ret_value = H5Gget_info(getLocId(), &ginfo); if(ret_value < 0) - { throwException("getNumObjs", "H5Gget_info failed"); - } return (ginfo.nlinks); } @@ -1032,9 +1006,7 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const // call H5Lget_name_by_idx with name as NULL to get its length ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } // now, allocate C buffer to get the name char* name_C = new char[name_len+1]; @@ -1067,9 +1039,8 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const { ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } + return (name_len); } @@ -1085,9 +1056,8 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) char* name_C = new char[size]; ssize_t name_len = getObjnameByIdx(idx, name_C, size); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } + name = H5std_string(name_C); delete []name_C; return (name_len); @@ -1107,9 +1077,8 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const { H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); if (obj_type == H5G_UNKNOWN) - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } + return (obj_type); } @@ -1135,9 +1104,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const case H5G_TYPE: HDstrcpy(type_name, "datatype"); break; case H5G_UNKNOWN: default: - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } } return (obj_type); } @@ -1163,9 +1130,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const case H5G_TYPE: type_name = H5std_string("datatype"); break; case H5G_UNKNOWN: default: - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } } return (obj_type); } diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 0785735..bc3e0af 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -266,43 +266,6 @@ void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void** } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setMulti -///\brief Sets the data transfer property list for the multi-file driver. -///\param memb_dxpl - OUT: Array of data access property lists -///\exception H5::PropListIException -///\par Description -/// This function can only be used after the member map has -/// been set with FileAccPropList::setMulti (not done - BMR.) -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void DSetMemXferPropList::setMulti(const hid_t *memb_dxpl) -{ - herr_t ret_value = H5Pset_dxpl_multi(id, memb_dxpl); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::setMulti", - "H5Pset_dxpl_multi failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getMulti -///\brief Returns multi-file data transfer property list information. -///\param memb_dxpl - OUT: Array of data access property lists -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void DSetMemXferPropList::getMulti(hid_t *memb_dxpl) -{ - herr_t ret_value = H5Pget_dxpl_multi(id, memb_dxpl); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::getMulti", - "H5Pget_dxpl_multi failed"); - } -} - -//-------------------------------------------------------------------------- // Function: DSetMemXferPropList::setSmallDataBlockSize ///\brief Sets the size of a contiguous block reserved for small data. ///\param size - IN: Maximum size, in bytes, of the small data block. diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 44186e2..5ff5a2e 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -61,7 +61,7 @@ H5File::H5File() : H5Location(), id(0) {} /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT ///\param access_plist - IN: File access property list. Default to -/// FileCreatPropList::DEFAULT +/// FileAccPropList::DEFAULT ///\par Description /// Valid values of \a flags include: /// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists, @@ -77,11 +77,18 @@ H5File::H5File() : H5Location(), id(0) {} /// please refer to the \b Special \b case section in the C layer /// Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create +// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { - p_get_file(name, flags, create_plist, access_plist); + try { + p_get_file(name, flags, create_plist, access_plist); + } catch (FileIException open_file) { + throw open_file; + } } //-------------------------------------------------------------------------- @@ -94,12 +101,19 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT ///\param access_plist - IN: File access property list. Default to -/// FileCreatPropList::DEFAULT +/// FileAccPropList::DEFAULT +// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { - p_get_file(name.c_str(), flags, create_plist, access_plist); + try { + p_get_file(name.c_str(), flags, create_plist, access_plist); + } catch (FileIException open_file) { + throw open_file; + } } //-------------------------------------------------------------------------- @@ -192,7 +206,7 @@ bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& acces ///\param name - IN: Name of the file ///\param flags - IN: File access flags ///\param access_plist - IN: File access property list. Default to -/// FileCreatPropList::DEFAULT +/// FileAccPropList::DEFAULT ///\par Description /// Valid values of \a flags include: /// H5F_ACC_RDWR: Open with read/write access. If the file is diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b93cd86..be59f51 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -250,6 +250,39 @@ int H5Location::getNumAttrs() const } //-------------------------------------------------------------------------- +// Function: H5Location::attrExists +///\brief Checks whether the named attribute exists at this location. +///\param name - IN: Name of the attribute to be queried +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2013 +//-------------------------------------------------------------------------- +bool H5Location::attrExists(const char* name) const +{ + // Call C routine H5Aexists to determine whether an attribute exists + // at this location, which could be specified by a file, group, dataset, + // or named datatype. + herr_t ret_value = H5Aexists(getId(), name); + if( ret_value > 0 ) + return true; + else if(ret_value == 0) + return false; + else // Raise exception when H5Aexists returns a negative value + throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::attrExists +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +bool H5Location::attrExists(const H5std_string& name) const +{ + attrExists(name.c_str()); +} + +//-------------------------------------------------------------------------- // Function: H5Location::removeAttr ///\brief Removes the named attribute from this object. ///\param name - IN: Name of the attribute to be removed diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index d1dd892..8eae454 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -79,11 +79,15 @@ class H5_DLLCPP H5Location : public IdComponent { // misleading, so getRefObjType is used in the new function instead. // Iterate user's function over the attributes at this location. - int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); + int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL); + + // Checks whether the named attribute exists at this location. + bool attrExists(const char* name) const; + bool attrExists(const H5std_string& name) const; // Removes the named attribute from this location. - void removeAttr( const char* name ) const; - void removeAttr( const H5std_string& name ) const; + void removeAttr(const char* name) const; + void removeAttr(const H5std_string& name) const; // Renames the named attribute to a new name. void renameAttr(const char* oldname, const char* newname) const; diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 5e75ab1..18a46ba 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -261,6 +261,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -312,7 +313,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -459,7 +459,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 132 +LT_VERS_REVISION = 139 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index 20435eb..0f17cf1 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -83,11 +83,12 @@ CXXLINKERBASE="@CXX@" # CXXFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. # FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. -# User's CPPFLAGS and CXXFLAGS come after their H5BLD counterparts to override -# them. User's LDFLAGS come just before clibpath, user's LIBS come after -# $link_objs and before the hdf5 libraries in $link_args, followed by any -# external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS -# or LIBS carried in from the hdf5 build. +# User's CPPFLAGS and CXXFLAGS come after their H5BLD counterparts. User's +# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and +# before the hdf5 libraries in $link_args, followed by any external library +# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in +# from the hdf5 build. The order of the flags is intended to give precedence +# to the user's flags. H5BLD_CXXFLAGS="@AM_CXXFLAGS@ @CXXFLAGS@" H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" @@ -100,7 +101,16 @@ CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" LIBS="${HDF5_LIBS:-$LIBSBASE}" -USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +# If a static library is available, the default will be to use it. If the only +# available library is shared, it will be used by default. The user can +# override either default, although choosing an unavailable library will result +# in link errors. +STATIC_AVAILABLE="@enable_static@" +if test "${STATIC_AVAILABLE}" = "yes"; then + USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +else + USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" +fi usage() { # A wonderfully informative "usage" message. @@ -324,6 +334,20 @@ if test "x$do_link" = "xyes"; then if test -n "$flag"; then shared_link="${flag}${libdir}" + # Any libraries in LDFLAGS or H5BLD_LDFLAGS also should have rpaths embedded + # in the executables created by h5cc (reduces need for LD_LIBRARY_PATH). + if test -n "$LDFLAGS"; then + for entry in $LDFLAGS; do + extdir=`echo $entry | sed '/^-L/ s/^-L//'` + shared_link="${shared_link} ${flag}${extdir}" + done + fi + if test -n "$H5BLD_LDFLAGS"; then + for entry in $H5BLD_LDFLAGS; do + extdir=`echo $entry | sed '/^-L/ s/^-L//'` + shared_link="${shared_link} ${flag}${extdir}" + done + fi fi if test "x$USE_SHARED_LIB" != "xyes"; then @@ -365,11 +389,12 @@ if test "x$do_link" = "xyes"; then # module. It's okay if they're included twice in the compile line. link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - # User's CPPFLAGS and CXXFLAGS come after their H5BLD counterparts to override - # them. User's LDFLAGS come just before clibpath, user's LIBS come after - # $link_objs and before the hdf5 libraries in $link_args, followed by any - # external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS - # or LIBS carried in from the hdf5 build. + # User's CPPFLAGS and CXXFLAGS come after their H5BLD counterparts. User's + # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and + # before the hdf5 libraries in $link_args, followed by any external library + # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in + # from the hdf5 build. The order of the flags is intended to give precedence + # to the user's flags. $SHOW $CXXLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 5d2da53..dd9cf13 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -222,6 +222,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -273,7 +274,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index e822b36..643762b 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -285,13 +285,7 @@ test_simple_io( H5File& file) static herr_t test_datasize() { - SUBTEST("DataSet::getInMemDataSize()"); - - int points[100][200]; - int check[100][200]; - int i, j, n; - try { // Open FILE1. diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 100e725..7e77e85 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -252,14 +252,19 @@ static void test_attr_rename() int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute int i; - // Output message about test being performed - SUBTEST("Rename Attribute Function"); + // Output message about test being performed + SUBTEST("Checking for Existence and Renaming Attribute"); try { // Open file H5File fid1(FILE_BASIC, H5F_ACC_RDWR); - // Check rename of attribute belonging to a file + // Check and rename attribute belonging to a file + + // Check for existence of attribute + bool attr_exists = fid1.attrExists(FATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME); @@ -280,7 +285,12 @@ static void test_attr_rename() // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); - // Check rename of attribute belonging to a dataset + // Check and rename attribute belonging to a dataset + + // Check for existence of attribute + attr_exists = dataset.attrExists(ATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME); @@ -303,6 +313,11 @@ static void test_attr_rename() // Close attribute attr1.close(); + // Check for existence of second attribute + attr_exists = dataset.attrExists(ATTR2_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); + // Open the second attribute Attribute attr2(dataset.openAttribute(ATTR2_NAME)); @@ -324,6 +339,11 @@ static void test_attr_rename() // Change first attribute back to the original name dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME); + // Check for existence of attribute after renaming + attr_exists = dataset.attrExists(ATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); + PASSED(); } // end try block @@ -964,7 +984,6 @@ static void test_attr_mult_read() static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names - int ii; // Output message about test being performed SUBTEST("Removing Attribute Function"); @@ -1355,6 +1374,53 @@ static void test_string_attr() /**************************************************************** ** +** test_attr_exists(): Test checking for attribute existence. +** (additional attrExists tests are in test_attr_rename()) +** +****************************************************************/ +static void test_attr_exists() +{ + // Output message about test being performed + SUBTEST("Check Attribute Existence"); + + try { + // Open file. + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Open the root group. + Group root = fid1.openGroup("/"); + + // Check for existence of attribute + bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not"); + + // Check for existence of attribute + attr_exists = fid1.attrExists(FATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not"); + + // Open a group. + Group group = fid1.openGroup(GROUP1_NAME); + + // Check for existence of attribute + attr_exists = group.attrExists(ATTR2_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); + + PASSED(); + } // end try block + + catch (InvalidActionException E) { + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + } + catch (Exception E) { + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + } +} // test_attr_exists() + +/**************************************************************** +** ** test_attr(): Main attribute testing routine. ** ****************************************************************/ @@ -1364,7 +1430,6 @@ extern "C" void test_attr() { // Output message about test being performed - //MESSAGE("Testing Attributes\n"); MESSAGE(5, ("Testing Attributes\n")); test_attr_basic_write(); // Test basic H5A writing code @@ -1384,6 +1449,7 @@ void test_attr() test_attr_dtype_shared(); // Test using shared datatypes in attributes test_string_attr(); // Test read/write string attribute + test_attr_exists(); // Test H5Location::attrExists } // test_attr() diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index fbb1219..28d8a1e 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -749,7 +749,6 @@ extern "C" void test_compound() { // Output message about test being performed - //MESSAGE("Testing Compound Data Type operations\n"); MESSAGE(5, ("Testing Compound Data Type operations\n")); test_compound_1(); // various things about compound data types diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index ba38d7a..65b8e57 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -117,16 +117,16 @@ static void test_file_create() "terminate called without an active exception Command terminated by signal 6" Commenting it out until it's fixed LK 20120626. -#ifndef H5_HAVE_FILE_VERSIONS +*/ try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E + // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "Attempted to create an existing file."); } catch( FileIException E ) // catch truncating existing file {} // do nothing, FAIL expected -#endif // Close file1 delete file1; file1 = NULL; @@ -144,7 +144,6 @@ static void test_file_create() // Test create with H5F_ACC_TRUNC. This will truncate the existing file. file1 = new H5File (FILE1, H5F_ACC_TRUNC); -#ifndef H5_HAVE_FILE_VERSIONS // Try to truncate first file again. This should fail because file1 // is the same file and is currently open. try { @@ -155,19 +154,17 @@ static void test_file_create() } catch( FileIException E ) // catching truncating opened file {} // do nothing, FAIL expected -#endif + // Try with H5F_ACC_EXCL. This should fail too because the file already // exists. try { -// H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E + H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); } catch( FileIException E ) // catching H5F_ACC_EXCL on existing file {} // do nothing, FAIL expected -*/ - std::cerr << "SKIPPED for HDFFV-8067" << std::endl; // Get the file-creation template FileCreatPropList tmpl1 = file1->getCreatePlist(); @@ -627,7 +624,6 @@ void test_file() { // Output message about test being performed MESSAGE(5, ("Testing File I/O operations\n")); - //MESSAGE("Testing File I/O operations\n"); test_file_create(); // Test file creation (also creation templates) test_file_open(); // Test file opening diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 0dbdf00..9e60655 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -47,12 +47,14 @@ #define FILTER_CHUNK_DIM2 25 // will do this function later or use it as guideline - BMR - 2007/01/26 +#if 0 static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted, hsize_t *dset_size) { cerr << "do nothing right now" << endl; return(0); } +#endif /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS 305 @@ -254,13 +256,11 @@ extern "C" void test_filters() { // Output message about test being performed - //MESSAGE("Testing Various Filters\n"); MESSAGE(5, ("Testing Various Filters\n")); hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template - int nerrors=0; // keep track of number of failures occurr try { // Use the file access template id to create a file access prop. list diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 32c40d5..7947a9b 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -569,7 +569,6 @@ extern "C" void test_h5s() { // Output message about test being performed - //MESSAGE("Testing Dataspaces\n"); MESSAGE(5, ("Testing Dataspaces\n")); test_h5s_basic(); // Test basic H5S code diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index e4e691a..fca5918 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -226,6 +226,7 @@ typedef struct { hbool_t *visited; /* Pointer to array of "visited link" flags */ } link_iter_info_t; +#if 0 /* Link visit structs */ typedef struct { const char *path; /* Path to link */ @@ -374,6 +375,7 @@ typedef struct { unsigned idx; /* Index in object visit structure */ const obj_visit_t *info; /* Pointer to the object visit structure to use */ } ovisit_ud_t; +#endif static const char *FILENAME[] = { "link0", @@ -529,7 +531,6 @@ void test_links() fapl_id = h5_fileaccess(); // Output message about test being performed - //MESSAGE("Testing Various Links\n"); MESSAGE(5, ("Testing Various Links\n")); try { diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 4eb5b21..ce18e58 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -235,7 +235,6 @@ static void test_reference_obj(void) verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__); // Test getObjnameByIdx(hsize_t idx, char* name, size_t size) - char name_C[DSET1_LEN+1]; group.getObjnameByIdx(0, name, name_size+1); verify_val(name, DSET1_NAME, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__); verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__); @@ -345,7 +344,6 @@ extern "C" void test_reference(void) { // Output message about test being performed - //MESSAGE("Testing References\n"); MESSAGE(5, ("Testing References\n")); test_reference_obj(); // Test basic object reference functionality diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index b1baa29..c10cf6d 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -52,6 +52,7 @@ * normally require alignment. When set, all native datatypes must be aligned * on a byte boundary equal to the data size. */ +#if 0 #define TEST_ALIGNMENT /* Alignment test stuff */ @@ -61,6 +62,9 @@ #endif #define SET_ALIGNMENT(TYPE,VAL) \ H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL) +#endif + /* #include "H5Tpkg.h" + */ const char *FILENAME[] = { "dtypes1.h5", diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 73e54e0..89f24f2 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -129,7 +129,7 @@ void test_vlstr_free_custom(void *_mem, void *info) *------------------------------------------------------------------------- */ // String for testing datasets -static char stastring_ds_write[1]={'A'}; +// static char stastring_ds_write[1]={'A'}; // Info for a string dataset const H5std_string DSET1_NAME("String_ds"); @@ -687,6 +687,7 @@ static void test_vlstring_attribute() } } // test_vlstring_attribute() +#if 0 /*------------------------------------------------------------------------- * Function: test_read_vl_string_attribute * @@ -746,6 +747,7 @@ static void test_read_vl_string_attribute() issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_read_vl_string_attribute +#endif // 2013: need to verify before adding to test /*------------------------------------------------------------------------- * Function: test_vlstring_array_attribute @@ -957,7 +959,6 @@ extern "C" void test_vlstrings() { // Output message about test being performed - //MESSAGE("Testing Variable-Length Strings"); MESSAGE(5, ("Testing Variable-Length Strings")); // These tests use the same file |