diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-10-04 07:33:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-10-04 07:33:40 (GMT) |
commit | 914643490ab581c4b0bb78ca30a8e1fa520b4d6d (patch) | |
tree | 53436d1611395e02c652c7ac5c075898fc2ae261 /c++/src/H5DcreatProp.cpp | |
parent | 0ee053bb95a620b6f8109d22a372f6acc1cee300 (diff) | |
parent | 888a002cddaa4e1d9a165ea01dfe62f399df9eb9 (diff) | |
download | hdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.zip hdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.tar.gz hdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.tar.bz2 |
[svn-r27946] Brought VDS branch in sync with trunk (up to r27945).
Tested on Ubuntu 15.04 (Linux 3.19 x86_64), gcc 4.9.2, MPICH 3.1.4
and CMake 3.3.2.
- Autotools serial w/ Fortran, C++
- Autotools parallel w/ Fortran
- CMake serial w/ Fortran, C++
Diffstat (limited to 'c++/src/H5DcreatProp.cpp')
-rw-r--r-- | c++/src/H5DcreatProp.cpp | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 2b124ee..5ee212a 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -28,10 +28,63 @@ namespace H5 { #endif +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control +// the order of creation and deletion of the global constants. See Design Notes +// in "H5PredType.cpp" for information. + +// Initialize a pointer for the constant +DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0; + +//-------------------------------------------------------------------------- +// Function: DSetCreatPropList::getConstant +// Purpose: Creates a DSetCreatPropList object representing the HDF5 +// constant H5P_DATASET_CREATE, pointed to by +// DSetCreatPropList::DEFAULT_ +// exception H5::PropListIException +// Description +// If DSetCreatPropList::DEFAULT_ already points to an allocated +// object, throw a PropListIException. This scenario should +// not happen. +// Programmer Binh-Minh Ribler - 2015 +//-------------------------------------------------------------------------- +DSetCreatPropList* DSetCreatPropList::getConstant() +{ + // Tell the C library not to clean up, H5Library::termH5cpp will call + // H5close - more dependency if use H5Library::dontAtExit() + if (!IdComponent::H5dontAtexit_called) + { + (void) H5dont_atexit(); + IdComponent::H5dontAtexit_called = true; + } + + // If the constant pointer is not allocated, allocate it. Otherwise, + // throw because it shouldn't be. + if (DEFAULT_ == 0) + DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE); + else + throw PropListIException("DSetCreatPropList::getConstant", "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_"); + return(DEFAULT_); +} + //-------------------------------------------------------------------------- -///\brief Constant for dataset creation default property +// Function: DSetCreatPropList::deleteConstants +// Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_ +// points to. +// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- -const DSetCreatPropList DSetCreatPropList::DEFAULT; +void DSetCreatPropList::deleteConstants() +{ + if (DEFAULT_ != 0) + delete DEFAULT_; +} + +//-------------------------------------------------------------------------- +// Purpose Constant for dataset creation default property +//-------------------------------------------------------------------------- +const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DSetCreatPropList default constructor |