diff options
Diffstat (limited to 'c++/src/H5Library.cpp')
-rw-r--r-- | c++/src/H5Library.cpp | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index e7e9fb6..40c766a 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -38,11 +38,14 @@ namespace H5 { #endif #ifndef DOXYGEN_SHOULD_SKIP_THIS -H5Library* H5Library::instance = 0; + +// This static variable is unused, will be removed in future releases. +bool H5Library::need_cleanup = false; + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Library::open +// Function: H5Library::open (static) ///\brief Initializes the HDF5 library. /// ///\exception H5::LibraryIException @@ -58,7 +61,7 @@ void H5Library::open() } //-------------------------------------------------------------------------- -// Function: H5Library::close +// Function: H5Library::close (static) ///\brief Flushes all data to disk, closes files, and cleans up memory. /// ///\exception H5::LibraryIException @@ -74,7 +77,7 @@ void H5Library::close() } //-------------------------------------------------------------------------- -// Function: H5Library::dontAtExit +// Function: H5Library::dontAtExit (static) ///\brief Instructs library not to install the C \c atexit cleanup routine /// ///\exception H5::LibraryIException @@ -89,7 +92,7 @@ void H5Library::dontAtExit() } //-------------------------------------------------------------------------- -// Function: H5Library::getLibVersion +// Function: H5Library::getLibVersion (static) ///\brief Returns the HDF library release number. ///\param majnum - OUT: Major version of the library ///\param minnum - OUT: Minor version of the library @@ -107,7 +110,7 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel } //-------------------------------------------------------------------------- -// Function: H5Library::checkVersion +// Function: H5Library::checkVersion (static) ///\brief Verifies that the arguments match the version numbers /// compiled into the library ///\param majnum - IN: Major version of the library @@ -130,7 +133,7 @@ void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) } //-------------------------------------------------------------------------- -// Function: H5Library::garbageCollect +// Function: H5Library::garbageCollect (static) ///\brief Walks through all the garbage collection routines for the /// library, which are supposed to free any unused memory they /// have allocated. @@ -159,7 +162,7 @@ void H5Library::garbageCollect() } //-------------------------------------------------------------------------- -// Function: H5Library::initH5cpp +// Function: H5Library::initH5cpp (static) ///\brief Initializes C++ library and registers terminating functions at /// exit. Only for the library functions, not for user-defined /// functions. @@ -167,52 +170,56 @@ void H5Library::garbageCollect() // initH5cpp registers the following functions with std::atexit(): // termH5cpp() - calls H5close() after all cleanup in // the C++ library is done -// <classname>::deleteConstants - deletes all references for -// <classname> global constants +// <classname>::deleteConstants - deletes all references +// for <classname> global constants ///\exception H5::LibraryIException // // Programmer Binh-Minh Ribler - September, 2015 //-------------------------------------------------------------------------- void H5Library::initH5cpp() { - // Register terminating functions with atexit(); they will be invoked in the - // reversed order + // Register terminating functions with atexit(); they will be invoked in + // the reversed order int ret_value = 0; ret_value = std::atexit(termH5cpp); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of termH5cpp failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating termH5cpp failed"); ret_value = std::atexit(PredType::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of PredType::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating PredType::deleteConstants failed"); ret_value = std::atexit(PropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of PropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed"); ret_value = std::atexit(FileAccPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of FileAccPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed"); ret_value = std::atexit(FileCreatPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of FileCreatPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating FileCreatPropList::deleteConstants failed"); ret_value = std::atexit(DSetMemXferPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DSetMemXferPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DSetMemXferPropList::deleteConstants failed"); ret_value = std::atexit(DSetCreatPropList::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DSetCreatPropList::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DSetCreatPropList::deleteConstants failed"); + + ret_value = std::atexit(ObjCreatPropList::deleteConstants); + if (ret_value != 0) + throw LibraryIException("H5Library::initH5cpp", "Registrating ObjCreatPropList::deleteConstants failed"); ret_value = std::atexit(DataSpace::deleteConstants); if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registration of DataSpace::deleteConstants failed"); + throw LibraryIException("H5Library::initH5cpp", "Registrating DataSpace::deleteConstants failed"); } //-------------------------------------------------------------------------- -// Function: H5Library::termH5cpp +// Function: H5Library::termH5cpp (static) ///\brief Sends request for the C layer to terminate. ///\par Description /// If the C library fails to terminate, exit with a failure. @@ -227,24 +234,7 @@ void H5Library::termH5cpp() } //-------------------------------------------------------------------------- -// Function: H5Library::getInstance -///\brief Provides a way to instantiate the class. -///\par Description -/// getInstance ensures that only one instance of the H5Library -/// is created. -// Programmer Binh-Minh Ribler - September, 2015 -//-------------------------------------------------------------------------- -H5Library* H5Library::getInstance() -{ - if (H5Library::instance == 0) - { - instance = new H5Library(); - } - return(instance); -} - -//-------------------------------------------------------------------------- -// Function: H5Library::setFreeListLimits +// Function: H5Library::setFreeListLimits (static) ///\brief Sets limits on the different kinds of free lists. ///\param reg_global_lim - IN: Limit on all "regular" free list memory used ///\param reg_list_lim - IN: Limit on memory used in each "regular" free list @@ -271,10 +261,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, } } -// Default constructor - no instance ever created by outsiders +// Default constructor - private H5Library::H5Library(){}; -// Destructor +// Destructor - private H5Library::~H5Library(){}; #ifndef H5_NO_NAMESPACE |