From 88ce565d7d324569f2a360aa37bfeefffa021a8a Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 1 Apr 2012 22:14:19 -0500 Subject: [svn-r22235] Purpose: Fixed bugs HDFFV-2761 & HDFFV-7852 Description: - Replaced PredType::NotAtexit() with PredType::AtExit(H5CPP_EXITED); and used PredType::AtExit as a flag to detect when all predefined types have been destroyed. Then, H5close will be called to terminate the library after its being re-initiated when the PredType destructors were activated. This change removed the memory leaks shown by the user's sample program. - Added H5CPP_EXITED for PredType::AtExit to use as a flag - Updated some inaccurate comments - Removed stream functions from FileAccPropList - Replaced H5_VMS with appropriate macro in H5IdComponent.cpp - Corrected many URLs (hdfgroup vs. ncsa) in comments - Replaced std::string with H5std_string in comments Platforms tested: Linux/32 2.6 (jam) Linux/64 2.6 (amani) SunOS 5.10 (linew) --- c++/src/H5AtomType.cpp | 8 +++--- c++/src/H5Attribute.cpp | 7 +++-- c++/src/H5CommonFG.cpp | 58 ++++++++++++++++++++--------------------- c++/src/H5DataSet.cpp | 24 ++++++++--------- c++/src/H5DataSpace.cpp | 8 +++--- c++/src/H5DataType.cpp | 44 ++++++++++++++++++++----------- c++/src/H5DcreatProp.cpp | 8 +++--- c++/src/H5DxferProp.cpp | 4 +-- c++/src/H5FaccProp.cpp | 66 ++++++++++------------------------------------- c++/src/H5FcreatProp.cpp | 10 +++---- c++/src/H5File.cpp | 26 +++++++++---------- c++/src/H5Group.cpp | 30 ++++++++++----------- c++/src/H5IdComponent.cpp | 10 ++++--- c++/src/H5Library.cpp | 4 +-- c++/src/H5Object.cpp | 24 +++++++++-------- c++/src/H5PredType.cpp | 8 ++++-- c++/src/H5PredType.h | 17 +++++++++--- c++/src/H5PropList.cpp | 2 +- c++/src/H5StrType.cpp | 4 +-- 19 files changed, 177 insertions(+), 185 deletions(-) diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 773fc5d..975cad6 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -98,7 +98,7 @@ H5T_order_t AtomType::getOrder() const //-------------------------------------------------------------------------- // Function: AtomType::getOrder ///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c std::string for the buffer that +/// It takes a reference to a \c H5std_string for the buffer that /// provide the text description of the returned byte order. /// The text description can be either of the following: /// "Little endian byte ordering (0)"; @@ -178,7 +178,7 @@ size_t AtomType::getPrecision() const ///\exception H5::DataTypeIException ///\par Description /// For information, please see C layer Reference Manuat at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetPrecision +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setPrecision( size_t precision ) const @@ -198,7 +198,7 @@ void AtomType::setPrecision( size_t precision ) const ///\exception H5::DataTypeIException ///\par Description /// For information, please see C layer Reference Manuat at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-GetOffset +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset // Programmer Binh-Minh Ribler - 2000 // Modification // 12/05/00: due to C API change @@ -225,7 +225,7 @@ int AtomType::getOffset() const ///\exception H5::DataTypeIException ///\par Description /// For information, please see C layer Reference Manuat at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetOffset +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setOffset( size_t offset ) const diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 84826c4..226ae5c 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -223,11 +223,11 @@ size_t Attribute::getInMemDataSize() const // Close the native type and the datatype of this attribute. if (H5Tclose(native_type) < 0) { - throw DataSetIException(func, "H5Tclose(native_type) failed"); + throw DataSetIException(func, "H5Tclose(native_type) failed"); } if (H5Tclose(mem_type_id) < 0) { - throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); + throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); } // Get number of elements of the attribute by first getting its dataspace @@ -246,7 +246,7 @@ size_t Attribute::getInMemDataSize() const // Close the dataspace if (H5Sclose(space_id) < 0) { - throw DataSetIException(func, "H5Sclose failed"); + throw DataSetIException(func, "H5Sclose failed"); } // Calculate and return the size of the data @@ -469,7 +469,6 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c //-------------------------------------------------------------------------- void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const { - // Prepare and call C API to read attribute. char *strg_C; diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 5b93bd5..6a8609f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -31,7 +31,7 @@ #include "H5DataSet.h" #include "H5File.h" #include "H5Alltypes.h" -#include "H5private.h" // for HDstrcpy +#include "H5private.h" // for HDstrcpy // There are a few comments that are common to most of the functions // defined in this file so they are listed here. @@ -101,7 +101,7 @@ Group CommonFG::createGroup( const char* name, size_t size_hint ) const // Function: CommonFG::createGroup ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group CommonFG::createGroup( const H5std_string& name, size_t size_hint ) const @@ -139,7 +139,7 @@ Group CommonFG::openGroup( const char* name ) const // Function: CommonFG::openGroup ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group CommonFG::openGroup( const H5std_string& name ) const @@ -183,7 +183,7 @@ DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, co // Function: CommonFG::createDataSet ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet CommonFG::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const @@ -218,7 +218,7 @@ DataSet CommonFG::openDataSet( const char* name ) const // Function: CommonFG::openDataSet ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet CommonFG::openDataSet( const H5std_string& name ) const @@ -275,7 +275,7 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne // Function: CommonFG::link ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a curr_name and \a new_name. +/// \c H5std_string for \a curr_name and \a new_name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const @@ -305,7 +305,7 @@ void CommonFG::unlink( const char* name ) const // Function: CommonFG::unlink ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::unlink( const H5std_string& name ) const @@ -322,8 +322,8 @@ void CommonFG::unlink( const H5std_string& name ) const ///\note /// Exercise care in moving groups as it is possible to render /// data in a file inaccessible with Group::move. Please refer -/// to the Group Interface in the HDF5 User's Guide at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/Groups.html +/// to the Group Interface in the HDF5 User's Guide for details at: +/// http://www.hdfgroup.org/HDF5/doc/UG/UG_frame09Groups.html // Programmer Binh-Minh Ribler - 2000 // Modification // 2007: QAK modified to use H5L APIs - BMR @@ -341,7 +341,7 @@ void CommonFG::move( const char* src, const char* dst ) const // Function: CommonFG::move ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a src and \a dst. +/// \c H5std_string for \a src and \a dst. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::move( const H5std_string& src, const H5std_string& dst ) const @@ -360,7 +360,7 @@ void CommonFG::move( const H5std_string& src, const H5std_string& dst ) const ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5G.html#Group-GetObjinfo +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const @@ -376,7 +376,7 @@ void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& st // Function: CommonFG::getObjinfo ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const @@ -405,7 +405,7 @@ void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const // Function: CommonFG::getObjinfo ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - Nov, 2005 //-------------------------------------------------------------------------- void CommonFG::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const @@ -462,7 +462,7 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const // Function: CommonFG::getLinkval ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const @@ -503,7 +503,7 @@ void CommonFG::setComment( const char* name, const char* comment ) const // Function: CommonFG::setComment ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name and \a comment. +/// \c H5std_string for \a name and \a comment. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const @@ -535,7 +535,7 @@ void CommonFG::removeComment(const char* name) const // Function: CommonFG::removeComment ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - May 2005 //-------------------------------------------------------------------------- void CommonFG::removeComment(const H5std_string& name) const @@ -596,7 +596,7 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // Function: CommonFG::getComment ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const @@ -633,7 +633,7 @@ void CommonFG::mount( const char* name, H5File& child, PropList& plist ) const // Function: CommonFG::mount ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::mount( const H5std_string& name, H5File& child, PropList& plist ) const @@ -664,7 +664,7 @@ void CommonFG::unmount( const char* name ) const // Function: CommonFG::unmount ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::unmount( const H5std_string& name ) const @@ -699,7 +699,7 @@ DataType CommonFG::openDataType( const char* name ) const // Function: CommonFG::openDataType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType CommonFG::openDataType( const H5std_string& name ) const @@ -734,7 +734,7 @@ ArrayType CommonFG::openArrayType( const char* name ) const // Function: CommonFG::openArrayType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType CommonFG::openArrayType( const H5std_string& name ) const @@ -769,7 +769,7 @@ CompType CommonFG::openCompType( const char* name ) const // Function: CommonFG::openCompType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType CommonFG::openCompType( const H5std_string& name ) const @@ -804,7 +804,7 @@ EnumType CommonFG::openEnumType( const char* name ) const // Function: CommonFG::openEnumType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType CommonFG::openEnumType( const H5std_string& name ) const @@ -839,7 +839,7 @@ IntType CommonFG::openIntType( const char* name ) const // Function: CommonFG::openIntType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType CommonFG::openIntType( const H5std_string& name ) const @@ -874,7 +874,7 @@ FloatType CommonFG::openFloatType( const char* name ) const // Function: CommonFG::openFloatType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType CommonFG::openFloatType( const H5std_string& name ) const @@ -909,7 +909,7 @@ StrType CommonFG::openStrType( const char* name ) const // Function: CommonFG::openStrType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType CommonFG::openStrType( const H5std_string& name ) const @@ -944,7 +944,7 @@ VarLenType CommonFG::openVarLenType( const char* name ) const // Function: CommonFG::openVarLenType ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType CommonFG::openVarLenType( const H5std_string& name ) const @@ -980,7 +980,7 @@ int CommonFG::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* // Function: CommonFG::iterateElems ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int CommonFG::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data ) @@ -1073,7 +1073,7 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const // Function: CommonFG::getObjnameByIdx ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an -/// \c std::string for \a name. +/// \c H5std_string for \a name. // Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index f73be0f..f7aaa72 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -429,7 +429,7 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp //-------------------------------------------------------------------------- // Function: DataSet::read ///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c std::string for the buffer. +/// It takes a reference to a \c H5std_string for the buffer. ///\param buf - IN: Buffer for read data ///\param mem_type - IN: Memory datatype ///\param mem_space - IN: Memory dataspace @@ -505,7 +505,7 @@ void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& //-------------------------------------------------------------------------- // Function: DataSet::write ///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c std::string for the buffer. +/// It takes a reference to a \c H5std_string for the buffer. // Programmer Binh-Minh Ribler - 2000 // Modification // Jul 2009 @@ -589,7 +589,7 @@ int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& spa /// For more information, please see the Description section in /// C layer Reference Manual at: ///\par -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5D.html#Dataset-Extend +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Extend // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::extend( const hsize_t* size ) const @@ -649,14 +649,14 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) // Function: DataSet::getObjType ///\brief Retrieves the type of object that an object reference points to. ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. ///\param ref - IN: Reference to query ///\return An object type, which can be one of the following: -/// \li \c H5G_LINK (0) \tObject is a symbolic link. -/// \li \c H5G_GROUP (1) \tObject is a group. -/// \li \c H5G_DATASET (2) \tObject is a dataset. -/// \li \c H5G_TYPE Object (3) \tis a named datatype +/// \li \c H5G_LINK (0) - Object is a symbolic link. +/// \li \c H5G_GROUP (1) - Object is a group. +/// \li \c H5G_DATASET (2) - Object is a dataset. +/// \li \c H5G_TYPE (3) - Object is a named datatype ///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- @@ -674,9 +674,9 @@ H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- // Function: DataSet::getRegion ///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of ///\param ref_type - IN: Type of reference to get region of - default /// to H5R_DATASET_REGION -///\param ref - IN: Reference to get region of ///\return DataSpace instance ///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - May, 2004 @@ -694,7 +694,7 @@ DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- // Function: DataSet::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this dataset. // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDs and Attribute are moved out of H5Object. In @@ -776,7 +776,7 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space //-------------------------------------------------------------------------- // Function: DataSet::p_setId (private) -///\brief Sets the identifier of this object to a new value. +///\brief Sets the identifier of this dataset to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 /// object fails diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 2c6fd37..755ca5b 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -408,7 +408,7 @@ hssize_t DataSpace::getSelectElemNpoints () const ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElemPointList +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const @@ -432,7 +432,7 @@ void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectBounds +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const @@ -458,7 +458,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElements +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const @@ -540,7 +540,7 @@ bool DataSpace::selectValid () const ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectHyperslab +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index e13b330..3edb163 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -52,16 +52,14 @@ namespace H5 { // Function: DataType overloaded constructor ///\brief Creates a datatype using an existing datatype's id ///\param existing_id - IN: Id of the existing datatype -///\param predefined - IN: Indicates whether or not this datatype is -/// a predefined datatype; default to \c false // Description // Constructor creates a copy of an existing DataType using -// its id. The argument "predefined" is default to false; -// when a default datatype is created, this argument is set -// to true so H5Tclose will not be called on it later. - need -// a reassessment after changing to the new ref counting mech. -// - BMR 5/2004 +// its id. // Programmer Binh-Minh Ribler - 2000 +// Modification +// Dec, 2005 +// Removed second argument, "predefined", after changing to the +// new ref counting mechanism that relies on C's ref counting. //-------------------------------------------------------------------------- DataType::DataType(const hid_t existing_id) : H5Object() { @@ -210,7 +208,7 @@ void DataType::copy( const DataType& like_type ) ///\param dset - IN: Dataset ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Jan, 2007 -///\parDescription +///\par Description /// The resulted dataset will be transient and modifiable. //-------------------------------------------------------------------------- void DataType::copy(const DataSet& dset) @@ -517,7 +515,7 @@ DataType DataType::getSuper() const ///\exception H5::DataTypeIException ///\par Description /// For more information, please see: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-Register +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::registerFunc( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const @@ -794,17 +792,33 @@ void DataType::close() // Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 +// library ID reference counting mechanism - BMR, Jun 1, 2004 // - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// handle the reference counting - BMR, Jun 1, 2006 +// - Added the use of H5CPP_EXITED to terminate the HDF5 library +// and elimiate previous memory leaks. See comments in the +// header file "H5PredType.h" for details. - BMR, Mar 30, 2012 //-------------------------------------------------------------------------- DataType::~DataType() { - try { - close(); - } catch (Exception close_error) { - cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl; + try + { + /* If this is the object AtExit, terminate the HDF5 library. This is + to eliminate memory leaks due to the library being re-initiated + (after the program has ended) and not re-terminated. */ + if (id == H5CPP_EXITED) + { + herr_t ret_value = H5close(); + if (ret_value == FAIL) + throw DataTypeIException(inMemFunc("~DataType - "), "H5close failed"); } + // Close the HDF5 datatype + else + close(); + } + catch (Exception close_error) { + cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl; + } } #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 981085d..ece435c 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -106,8 +106,8 @@ int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const ///\param layout - IN: Type of storage layout for raw data ///\exception H5::PropListIException ///\par Description -/// For information on setting layout type, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetLayout +/// For information on valid layout types, please refer to +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setLayout(H5D_layout_t layout) const @@ -211,7 +211,7 @@ void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_p ///\par /// For information on setting fill value, please refer to the /// C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFillValue +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const @@ -459,7 +459,7 @@ bool DSetCreatPropList::allFiltersAvail() ///\par Description /// Please refer to the Reference Manual of \c H5Pset_shuffle for /// details. -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetShuffle +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setShuffle() const diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 0f7faa2..0785735 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -309,7 +309,7 @@ void DSetMemXferPropList::getMulti(hid_t *memb_dxpl) ///\exception H5::PropListIException ///\par Description /// For detail, please refer to the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSmallData +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) @@ -349,7 +349,7 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize() ///\par Description /// For information, please refer to the C layer Reference /// Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetHyperVectorSize +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index f2ab0f3..4fb3836 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -76,7 +76,7 @@ void FileAccPropList::setStdio() const /// driver was set for the property list. The driver ID is /// only valid as long as the file driver remains registered. /// Valid driver identifiers can be found at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver ///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- @@ -99,7 +99,7 @@ hid_t FileAccPropList::getDriver() const ///\par Description /// For a list of valid driver identifiers, please see the C /// layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const @@ -157,7 +157,7 @@ hsize_t FileAccPropList::getFamilyOffset() const ///\par Description /// For more details on the use of \c H5FD_CORE driver, please /// refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplCore +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const @@ -261,7 +261,7 @@ FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const ///\exception H5::PropListIException ///\par Description /// Temporary - For information, please refer to: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplSplit +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const @@ -292,47 +292,9 @@ void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& ra setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() ); } -#ifdef H5_HAVE_STREAM // for Stream Virtual File Driver -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getStream -///\brief Retrieves the streaming I/O driver settings -///\return The streaming I/O file access property list structure -/// For detail on this structure, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5FD_stream_fapl_t FileAccPropList::getStream() const -{ - H5FD_stream_fapl_t fapl; - herr_t ret_value = H5Pget_fapl_stream(id, &fapl); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getStream", "H5Pget_fapl_stream failed"); - } - return(fapl); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setStream -///\brief Modifies this file access property list to use the Stream -/// driver. -///\param fapl - IN: The streaming I/O file access property list -///\exception H5::PropListIException -///\par Description -/// For detail on \a fapl, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void FileAccPropList::setStream(H5FD_stream_fapl_t &fapl) const -{ - herr_t ret_value = H5Pset_fapl_stream (id, &fapl); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setStream", "H5Pset_fapl_stream failed"); - } -} -#endif // Stream Virtual File Driver +// Stream Virtual File Driver had been removed from the main library. +// FileAccPropList::[s,g]etStream are now removed from the C++ API. +// -BMR, March, 2012 //-------------------------------------------------------------------------- // Function: FileAccPropList::getSieveBufSize @@ -360,7 +322,7 @@ size_t FileAccPropList::getSieveBufSize() const ///\exception H5::PropListIException ///\par Description /// For detail on data sieving, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSieveBufSize +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSieveBufSize(size_t bufsize) const @@ -380,7 +342,7 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const ///\exception H5::PropListIException ///\par Description /// For more detail, please see the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMetaBlockSize +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const @@ -420,7 +382,7 @@ hsize_t FileAccPropList::getMetaBlockSize() const ///\exception H5::PropListIException ///\par Description /// For detail on \a flags, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const @@ -477,7 +439,7 @@ void FileAccPropList::setSec2() const /// The parameter \a alignment must have a positive value. /// /// For detail on \a setting alignment, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetAlignment +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment // Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const @@ -514,7 +476,7 @@ void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) con ///\exception H5::PropListIException ///\par Description /// More details and valid values for \a dtype can be found at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMultiType +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMultiType(H5FD_mem_t dtype) const @@ -533,7 +495,7 @@ void FileAccPropList::setMultiType(H5FD_mem_t dtype) const ///\exception H5::PropListIException ///\par Description /// More details and possible returned values can be found at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetMultiType +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5FD_mem_t FileAccPropList::getMultiType() const @@ -634,7 +596,7 @@ H5F_close_degree_t FileAccPropList::getFcloseDegree() ///\exception H5::PropListIException ///\par Description /// For detail on \a fapl, please refer to -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences // Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setGcReferences( unsigned gc_ref ) const diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index 53d18f6..8d9965e 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -128,7 +128,7 @@ hsize_t FileCreatPropList::getUserblock() const ///\par Description /// For information on setting sizes, please refer to the /// C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSizes +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSizes // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setSizes( size_t sizeof_addr, size_t sizeof_size ) const @@ -168,7 +168,7 @@ void FileCreatPropList::getSizes( size_t& sizeof_addr, size_t& sizeof_size ) con ///\exception H5::PropListIException ///\par Description /// For information, please see the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSymK +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSymK // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const @@ -189,7 +189,7 @@ void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const ///\exception H5::PropListIException ///\par Description /// For information, please see -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSymK +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSymK // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const @@ -210,7 +210,7 @@ void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const ///\exception H5::PropListIException ///\par Description /// For information, please see the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetIstoreK +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetIstoreK // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setIstorek( unsigned ik ) const @@ -230,7 +230,7 @@ void FileCreatPropList::setIstorek( unsigned ik ) const ///\exception H5::PropListIException ///\par Description /// For information, please see -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetIstoreK +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetIstoreK // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- unsigned FileCreatPropList::getIstorek() const diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index a773489..da0241f 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -76,7 +76,7 @@ H5File::H5File() : IdComponent(), id(0) {} /// For info on file creation in the case of an already-open file, /// please refer to the \b Special \b case section in the C layer /// Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5F.html#File-Create +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) @@ -88,7 +88,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c // Function: H5File overloaded constructor ///\brief This is another overloaded constructor. It differs from the /// above constructor only in the type of the \a name argument. -///\param name - IN: Name of the file - \c std::string +///\param name - IN: Name of the file - \c H5std_string ///\param flags - IN: File access flags ///\param create_plist - IN: File creation property list, used when /// modifying default file meta-data. Default to @@ -191,8 +191,8 @@ bool H5File::isHdf5(const char* name) //-------------------------------------------------------------------------- // Function: H5File::isHdf5 ///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c std::string for \a name. -///\param name - IN: Name of the file - \c std::string +/// It takes an \c H5std_string for \a name. +///\param name - IN: Name of the file - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool H5File::isHdf5(const H5std_string& name ) @@ -231,8 +231,8 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis //-------------------------------------------------------------------------- // Function: H5File::openFile ///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c std::string for \a name. -///\param name - IN: Name of the file - \c std::string +/// It takes an \c H5std_string for \a name. +///\param name - IN: Name of the file - \c H5std_string ///\param flags - IN: File access flags ///\param access_plist - IN: File access property list. Default to /// FileAccPropList::DEFAULT @@ -512,8 +512,8 @@ H5std_string H5File::getFileName() const ///\brief Retrieves the type of object that an object reference points to. ///\param ref - IN: Reference to query ///\param ref_type - IN: Type of reference, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +/// \li \c H5R_OBJECT - Reference is an object reference +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference ///\return Object type, which can be one of the following: /// \li \c H5G_LINK - Object is a symbolic link. /// \li \c H5G_GROUP - Object is a group. @@ -600,9 +600,9 @@ void H5File::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ///\param name - IN: Name of the object to be referenced ///\param dataspace - IN: Dataspace with selection ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region -/// reference. - this is the default +/// \li \c H5R_OBJECT - Reference is an object reference +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference - this is the default ///\exception H5::IdComponentException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- @@ -643,9 +643,9 @@ void H5File::reference(void* ref, const char* name) const // Function: H5File::reference ///\brief This is an overloaded function, provided for your convenience. /// It differs from the above function in that it takes an -/// \c std::string for the object's name. +/// \c H5std_string for the object's name. ///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c std::string +///\param name - IN: Name of the object to be referenced - \c H5std_string // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5File::reference(void* ref, const H5std_string& name) const diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index afcc7eb..6ec2dbb 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -79,7 +79,7 @@ hid_t Group::getLocId() const //-------------------------------------------------------------------------- // Function: Group overloaded constructor ///\brief Creates a Group object using the id of an existing group. -///\param group_id - IN: Id of an existing group +///\param existing_id - IN: Id of an existing group // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group(const hid_t existing_id) : H5Object() @@ -153,13 +153,13 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() ///\brief Retrieves the type of object that an object reference points to. ///\param ref - IN: Reference to query ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. ///\return An object type, which can be one of the following: -/// H5G_LINK Object is a symbolic link. -/// H5G_GROUP Object is a group. -/// H5G_DATASET Object is a dataset. -/// H5G_TYPE Object is a named datatype +/// \li \c H5G_LINK (0) - Object is a symbolic link. +/// \li \c H5G_GROUP (1) - Object is a group. +/// \li \c H5G_DATASET (2) - Object is a dataset. +/// \li \c H5G_TYPE (3) - Object is a named datatype ///\exception H5::GroupIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- @@ -199,10 +199,10 @@ DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const // Purpose: Get the id of this attribute // Modification: // May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. +// Class hierarchy is revised to address bugzilla 1068. Class +// AbstractDS and Attribute are moved out of H5Object. In +// addition, member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. // Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t Group::getId() const @@ -215,11 +215,11 @@ hid_t Group::getId() const ///\brief Sets the identifier of this object to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails +/// object fails // Description: -// The underlaying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. +// The underlaying reference counting in the C library ensures +// that the current valid id of this object is properly closed. +// Then the object's id is reset to the new id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Group::p_setId(const hid_t new_id) diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 1cac0c1..9f96277 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -13,11 +13,13 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef H5_VMS +#ifdef OLD_HEADER_FILENAME +#include +#else #include -#endif /*H5_VMS*/ - +#endif #include + #include "H5Include.h" #include "H5Exception.h" #include "H5Library.h" @@ -129,7 +131,7 @@ int IdComponent::getCounter() const //-------------------------------------------------------------------------- // Function: hdfObjectType ///\brief Given an id, returns the type of the object. -///return a valid HDF object type, which may be one of the following: +///\return a valid HDF object type, which may be one of the following: /// \li \c H5I_FILE /// \li \c H5I_GROUP /// \li \c H5I_DATATYPE diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index e7557b3..ecc5141 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -106,7 +106,7 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel ///\par Description /// For information about library version, please refer to /// the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5.html#Library-VersCheck +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-VersCheck // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) @@ -161,7 +161,7 @@ void H5Library::garbageCollect() /// Setting a value of -1 for a limit means no limit of that type. /// For more information on free list limits, please refer to C /// layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5.html#Library-SetFreeListLimits +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-SetFreeListLimits // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index e25c255..3c85502 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -124,7 +124,7 @@ Attribute H5Object::createAttribute( const char* name, const DataType& data_type // Function: H5Object::createAttribute ///\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 std::string for \a name. +/// a reference to an \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const @@ -158,7 +158,7 @@ Attribute H5Object::openAttribute( const char* name ) const // Function: H5Object::openAttribute ///\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 std::string for \a name. +/// a reference to an \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::openAttribute( const H5std_string& name ) const @@ -194,15 +194,17 @@ Attribute H5Object::openAttribute( const unsigned int idx ) const ///\brief Iterates a user's function over all the attributes of an H5 /// object, which may be a group, dataset or named datatype. ///\param user_op - IN: User's function to operate on each attribute -///\param idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices +///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices ///\param op_data - IN: User's data to pass to user's operator function ///\return Returned value of the last operator if it was non-zero, or /// zero if all attributes were processed ///\exception H5::AttributeIException ///\par Description +/// The signature of user_op is +/// void (*)(H5::H5Object&, H5std_string, void*). /// For information, please refer to the C layer Reference Manual /// at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5A.html#Annot-Iterate +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) @@ -267,7 +269,7 @@ void H5Object::removeAttr( const char* name ) const // Function: H5Object::removeAttr ///\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 std::string for \a name. +/// a reference to an \c H5std_string for \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Object::removeAttr( const H5std_string& name ) const @@ -294,7 +296,7 @@ void H5Object::renameAttr(const char* oldname, const char* newname) const // Function: H5Object::renameAttr ///\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 std::string for the names. +/// a reference to an \c H5std_string for the names. // Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const @@ -366,9 +368,9 @@ void H5Object::p_reference(void* ref, const char* name, hid_t space_id, H5R_type ///\param name - IN: Name of the object to be referenced ///\param dataspace - IN: Dataspace with selection ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region -/// reference. - this is the default +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default ///\exception H5::IdComponentException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- @@ -410,9 +412,9 @@ void H5Object::reference(void* ref, const char* name) const // Function: H5Object::reference ///\brief This is an overloaded function, provided for your convenience. /// It differs from the above function in that it takes an -/// \c std::string for the object's name. +/// \c H5std_string for the object's name. ///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c std::string +///\param name - IN: Name of the object to be referenced - \c H5std_string // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Object::reference(void* ref, const H5std_string& name) const diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 347f02f..9dfc760 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -44,7 +44,10 @@ namespace H5 { //-------------------------------------------------------------------------- PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id ) { - id = H5Tcopy(predtype_id); + if (predtype_id == H5CPP_EXITED) + id = predtype_id; + else + id = H5Tcopy(predtype_id); } //-------------------------------------------------------------------------- @@ -62,7 +65,8 @@ PredType::PredType() : AtomType() {} //-------------------------------------------------------------------------- PredType::PredType( const PredType& original ) : AtomType( original ) {} -const PredType PredType::NotAtexit; // only for atexit/global dest. problem +// Flag to terminate HDF5 library in DataType::~DataType +const PredType PredType::AtExit(H5CPP_EXITED); // Definition of pre-defined types const PredType PredType::C_S1( H5T_C_S1 ); diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 69abfcb..9cb1c65 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -26,9 +26,17 @@ namespace H5 { #endif +/* This constant is defined for a workaround to eliminate memory leaks due to + the library being re-initiated when PredType destructors are invoked. A + PredType instant with H5CPP_EXITED as the value of its "id" is constructed + before the other PredType objects are created. At exit, when this special + PredType object is to be destructed, no HDF5 library function will be called + and the library will be terminated. -BMR, Mar 30, 2012 */ +#define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere + class H5_DLLCPP PredType : public AtomType { public: - // Returns this class name + ///\brief Returns this class name virtual H5std_string fromClass () const { return("PredType"); } // Makes a copy of the predefined type and stores the new @@ -229,9 +237,10 @@ class H5_DLLCPP PredType : public AtomType { #endif // DOXYGEN_SHOULD_SKIP_THIS private: - // added this to work around the atexit/global destructor problem - // temporarily - it'll prevent the use of atexit to clean up - static const PredType NotAtexit; // not working yet + // Added this to work around the atexit/global destructor problem. + // It'll help to terminate the library after other PredType instances + // are closed. -BMR, Mar 30, 2012 + static const PredType AtExit; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 550c90d..ceea15f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -570,7 +570,7 @@ void PropList::setProperty(const H5std_string& name, void* value) const /// It differs from the above function only in what arguments it /// accepts. ///\param name - IN: Name of property to set - \c H5std_string -///\param strg - IN: Value for the property is a \c std::string +///\param strg - IN: Value for the property is a \c H5std_string // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const H5std_string& name, H5std_string& strg) const diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index e632c4d..a906b72 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -87,7 +87,7 @@ StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType() // Function: StrType overloaded constructor ///\brief Creates a string datatype with a specified length ///\param dummy - IN: To simplify calling the previous constructor -// and avoid prototype clash with another constructor +/// and avoid prototype clash with another constructor ///\param size - IN: Length of the new string type ///\exception H5::DataTypeIException ///\par Description @@ -209,7 +209,7 @@ H5T_str_t StrType::getStrpad() const ///\exception H5::DataTypeIException ///\par Description /// For detail, please refer to the C layer Reference Manual at: -/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetStrpad +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void StrType::setStrpad( H5T_str_t strpad ) const -- cgit v0.12