diff options
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5DxferProp.cpp | 37 | ||||
-rw-r--r-- | c++/src/H5DxferProp.h | 7 | ||||
-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 | 2 | ||||
-rw-r--r-- | c++/src/h5c++.in | 38 |
7 files changed, 86 insertions, 65 deletions
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/H5DxferProp.h b/c++/src/H5DxferProp.h index 66216d8..bf481c3 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -66,12 +66,6 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info, H5MM_free_t& free, void** free_info ) const; - // Sets the data transfer property list for the multi-file driver. - void setMulti(const hid_t *memb_dxpl); - - // Returns multi-file data transfer property list information. - void getMulti(hid_t *memb_dxpl); - // Sets the size of a contiguous block reserved for small data. void setSmallDataBlockSize(hsize_t size); @@ -109,3 +103,4 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { } #endif #endif + diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 92c4d32..ede7469 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; + } } //-------------------------------------------------------------------------- @@ -187,7 +201,7 @@ bool H5File::isHdf5(const H5std_string& name ) ///\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..98878d7 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 +{ + return(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 b025f0b..37e5d1b 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -467,7 +467,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 = 138 +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..4c86c6a 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. @@ -112,8 +122,9 @@ usage() { echo " subdirectories [default: $prefix]" echo " -show Show the commands without executing them" echo " -showconfig Show the HDF5 library configuration summary" - echo " -shlib Compile with shared HDF5 libraries" - echo " -noshlib Compile with static HDF5 libraries [default]" + echo " -shlib Compile with shared HDF5 libraries [default when built with" + echo " disable-static]" + echo " -noshlib Compile with static HDF5 libraries [default when static available]" echo " " echo " <compile line> - the normal compile line options for your compiler." echo " $prog_name uses the same compiler you used to compile" @@ -365,11 +376,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 |