summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DcreatProp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5DcreatProp.cpp')
-rw-r--r--c++/src/H5DcreatProp.cpp64
1 files changed, 59 insertions, 5 deletions
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 2b124ee..60cf0fc 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -19,6 +19,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5OcreatProp.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
@@ -28,17 +29,70 @@
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_);
+}
+
+//--------------------------------------------------------------------------
+// Function: DSetCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_
+// points to.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void DSetCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
//--------------------------------------------------------------------------
-///\brief Constant for dataset creation default property
+// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
-const DSetCreatPropList DSetCreatPropList::DEFAULT;
+const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DSetCreatPropList default constructor
///\brief Default constructor: creates a stub dataset creation property list
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList() : PropList( H5P_DATASET_CREATE) {}
+DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList copy constructor
@@ -46,7 +100,7 @@ DSetCreatPropList::DSetCreatPropList() : PropList( H5P_DATASET_CREATE) {}
/// DSetCreatPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList( orig ) {}
+DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : ObjCreatPropList(orig) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList overloaded constructor
@@ -54,7 +108,7 @@ DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList
/// existing dataset creation property list.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setChunk