summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/CMakeLists.txt2
-rw-r--r--c++/src/H5AbstractDs.cpp1
-rw-r--r--c++/src/H5ArrayType.cpp1
-rw-r--r--c++/src/H5AtomType.cpp1
-rw-r--r--c++/src/H5Attribute.cpp2
-rw-r--r--c++/src/H5CommonFG.cpp6
-rw-r--r--c++/src/H5CompType.cpp1
-rw-r--r--c++/src/H5Cpp.h1
-rw-r--r--c++/src/H5DataSet.cpp1
-rw-r--r--c++/src/H5DataSpace.cpp54
-rw-r--r--c++/src/H5DataSpace.h20
-rw-r--r--c++/src/H5DataType.cpp19
-rw-r--r--c++/src/H5DcreatProp.cpp64
-rw-r--r--c++/src/H5DcreatProp.h19
-rw-r--r--c++/src/H5DxferProp.cpp65
-rw-r--r--c++/src/H5DxferProp.h16
-rw-r--r--c++/src/H5EnumType.cpp1
-rw-r--r--c++/src/H5FaccProp.cpp57
-rw-r--r--c++/src/H5FaccProp.h17
-rw-r--r--c++/src/H5FcreatProp.cpp55
-rw-r--r--c++/src/H5FcreatProp.h18
-rw-r--r--c++/src/H5File.cpp1
-rw-r--r--c++/src/H5FloatType.cpp1
-rw-r--r--c++/src/H5Group.cpp1
-rw-r--r--c++/src/H5IdComponent.cpp33
-rw-r--r--c++/src/H5IdComponent.h6
-rw-r--r--c++/src/H5IntType.cpp1
-rw-r--r--c++/src/H5Library.cpp119
-rw-r--r--c++/src/H5Library.h35
-rw-r--r--c++/src/H5Location.cpp8
-rw-r--r--c++/src/H5Object.cpp1
-rw-r--r--c++/src/H5OcreatProp.cpp222
-rw-r--r--c++/src/H5OcreatProp.h76
-rw-r--r--c++/src/H5PredType.cpp1159
-rw-r--r--c++/src/H5PredType.h505
-rw-r--r--c++/src/H5PropList.cpp54
-rw-r--r--c++/src/H5PropList.h17
-rw-r--r--c++/src/H5StrType.cpp1
-rw-r--r--c++/src/H5VarLenType.cpp1
-rw-r--r--c++/src/Makefile.am18
-rw-r--r--c++/src/cpp_doc_config2
41 files changed, 2234 insertions, 448 deletions
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 1ae5647..473605a 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -35,6 +35,7 @@ set (CPP_SRCS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5OcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.cpp
@@ -70,6 +71,7 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5OcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.h
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index d59c1eb..5929444 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -22,6 +22,7 @@
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5Alltypes.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 8807dca..85340f8 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 09f762f..90c2ae3 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 0bfdff8..ea8c5bb 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -28,6 +28,7 @@
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
@@ -45,6 +46,7 @@ namespace H5 {
#endif
class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
+
//--------------------------------------------------------------------------
// Function: Attribute default constructor
///\brief Default constructor: Creates a stub attribute
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index dbe26b4..c88f6c1 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -14,7 +14,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
-#include <iostream>
#include "H5Include.h"
#include "H5Exception.h"
@@ -23,6 +22,7 @@
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
@@ -1268,7 +1268,7 @@ CommonFG::~CommonFG() {}
//--------------------------------------------------------------------------
void f_DataType_setId(DataType* dtype, hid_t new_id)
{
- dtype->id = new_id;
+ dtype->p_setId(new_id);
}
//--------------------------------------------------------------------------
@@ -1283,7 +1283,7 @@ void f_DataType_setId(DataType* dtype, hid_t new_id)
//--------------------------------------------------------------------------
void f_DataSet_setId(DataSet* dset, hid_t new_id)
{
- dset->id = new_id;
+ dset->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 393aafc..6d31a68 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5Alltypes.h"
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 044108b..4e82ee3 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -26,6 +26,7 @@
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5Attribute.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 717ef88..0fc9105 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -26,6 +26,7 @@
#include "H5PropList.h"
#include "H5Object.h"
#include "H5PropList.h"
+#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
#include "H5FaccProp.h"
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index d9c262d..311180f 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -33,10 +33,60 @@ namespace H5 {
#endif // H5_NO_STD
#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
+DataSpace* DataSpace::ALL_ = 0;
+
//--------------------------------------------------------------------------
-///\brief Constant for default dataspace.
+// Function: DataSpace::getConstant
+// Creates a DataSpace object representing the HDF5 constant
+// H5S_ALL, pointed to by DataSpace::ALL_
+// Exception H5::DataSpaceIException
+// Description
+// If DataSpace::ALL_ already points to an allocated object, throw
+// a DataSpaceIException. This scenario should not happen.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const DataSpace DataSpace::ALL( H5S_ALL );
+DataSpace* DataSpace::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 (ALL_ == 0)
+ ALL_ = new DataSpace(H5S_ALL);
+ else
+ throw DataSpaceIException("DataSpace::getConstant", "DataSpace::getConstant is being invoked on an allocated ALL_");
+ return(ALL_);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSpace::deleteConstants
+// Purpose: Deletes the constant object that DataSpace::ALL_ points to
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void DataSpace::deleteConstants()
+{
+ if (ALL_ != 0)
+ delete ALL_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose Constant for default dataspace.
+//--------------------------------------------------------------------------
+const DataSpace& DataSpace::ALL = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataSpace constructor
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index a43cecd..4cbe62c 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -24,8 +24,8 @@ namespace H5 {
//! Class DataSpace operates on HDF5 dataspaces.
class H5_DLLCPP DataSpace : public IdComponent {
public:
- // Default DataSpace objects
- static const DataSpace ALL;
+ ///\brief Default DataSpace objects
+ static const DataSpace& ALL;
// Creates a dataspace object given the space type
DataSpace(H5S_class_t type = H5S_SCALAR);
@@ -118,20 +118,34 @@ class H5_DLLCPP DataSpace : public IdComponent {
// Gets the dataspace id.
virtual hid_t getId() const;
+ // Deletes the global constant
+ static void deleteConstants();
+
// Destructor: properly terminates access to this dataspace.
virtual ~DataSpace();
- protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ protected:
// Sets the dataspace id.
virtual void p_setId(const hid_t new_id);
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
hid_t id; // HDF5 dataspace id
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ static DataSpace* ALL_;
+
+ // Creates the global constant
+ static DataSpace* getConstant();
+
// Friend function to set DataSpace id. For library use only.
friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index cdcd1e6..88dff89 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -28,6 +28,7 @@
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5CommonFG.h"
@@ -760,23 +761,17 @@ void DataType::close()
// - 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
+// - Major re-implementation of the global constants was done
+// to avoid relying on the order of the creation and deletion
+// of the global constants. Hence, H5CPP_EXITED was removed.
+// See Design Notes in "H5PredType.cpp" for details.
+// - BMR, Sep 30, 2015
//--------------------------------------------------------------------------
DataType::~DataType()
{
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();
+ close();
}
catch (Exception close_error) {
cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
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
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 7434b9b..ebdadc4 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -25,10 +25,10 @@ namespace H5 {
\brief Class DSetCreatPropList represents the dataset creation property
list.
*/
-class H5_DLLCPP DSetCreatPropList : public PropList {
+class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
public:
- // Default dataset creation property list.
- static const DSetCreatPropList DEFAULT;
+ ///\brief Default dataset creation property list.
+ static const DSetCreatPropList& DEFAULT;
// Creates a dataset creation property list.
DSetCreatPropList();
@@ -123,6 +123,19 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
// Noop destructor.
virtual ~DSetCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static DSetCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static DSetCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 1f4a638..49bbfe6 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -22,24 +22,67 @@
#include "H5DxferProp.h"
#include "H5private.h" // for HDmemset
-#include <iostream>
-
#ifndef H5_NO_NAMESPACE
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+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.
-#ifndef H5_NO_NAMESPACE
-namespace H5 {
-#endif
+// Initialize a pointer for the constant
+DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
-///\brief Constant for default dataset memory and transfer property list.
+// Function: DSetMemXferPropList::getConstant
+// Creates a DSetMemXferPropList object representing the HDF5
+// constant H5P_DATASET_XFER, pointed to by
+// DSetMemXferPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If DSetMemXferPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const DSetMemXferPropList DSetMemXferPropList::DEFAULT;
+DSetMemXferPropList* DSetMemXferPropList::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 DSetMemXferPropList(H5P_DATASET_XFER);
+ else
+ throw PropListIException("DSetMemXferPropList::getConstant", "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: DSetMemXferPropList::deleteConstants
+// Purpose: Deletes the constant object that DSetMemXferPropList::DEFAULT_
+// points to.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void DSetMemXferPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose Constant for default dataset memory and transfer property list.
+//--------------------------------------------------------------------------
+const DSetMemXferPropList& DSetMemXferPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function DSetMemXferPropList default constructor
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index f93676e..85d2ec2 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -27,7 +27,8 @@ namespace H5 {
*/
class H5_DLLCPP DSetMemXferPropList : public PropList {
public:
- static const DSetMemXferPropList DEFAULT;
+ ///\brief Default dataset memory and transfer property list.
+ static const DSetMemXferPropList& DEFAULT;
// Creates a dataset memory and transfer property list.
DSetMemXferPropList();
@@ -113,6 +114,19 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
// Noop destructor
virtual ~DSetMemXferPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static DSetMemXferPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static DSetMemXferPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index a91c053..b096a36 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -23,6 +23,7 @@
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 5ce9d8e..d3d7811 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -25,10 +25,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
+FileAccPropList* FileAccPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: FileAccPropList::getConstant
+// Creates a FileAccPropList object representing the HDF5 constant
+// H5P_FILE_ACCESS, pointed to by FileAccPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If FileAccPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+FileAccPropList* FileAccPropList::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 FileAccPropList(H5P_FILE_ACCESS);
+ else
+ throw PropListIException("FileAccPropList::getConstant", "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
//--------------------------------------------------------------------------
-///\brief Constant for default property
+// Function: FileAccPropList::deleteConstants
+// Purpose: Deletes the constant object that FileAccPropList::DEFAULT_
+// points to.
+// exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const FileAccPropList FileAccPropList::DEFAULT;
+void FileAccPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default property
+//--------------------------------------------------------------------------
+const FileAccPropList& FileAccPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: Default Constructor
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index fddc446..7d6529e 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -24,7 +24,8 @@ namespace H5 {
//! Class FileAccPropList represents the HDF5 file access property list.
class H5_DLLCPP FileAccPropList : public PropList {
public:
- static const FileAccPropList DEFAULT;
+ ///\brief Default file access property list.
+ static const FileAccPropList& DEFAULT;
// Creates a file access property list.
FileAccPropList();
@@ -145,6 +146,20 @@ class H5_DLLCPP FileAccPropList : public PropList {
// Noop destructor
virtual ~FileAccPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static FileAccPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static FileAccPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index 8d9965e..af51677 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -25,10 +25,61 @@
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
+FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: FileCreatPropList::getConstant
+// Purpose: Creates a FileCreatPropList object representing the HDF5
+// constant H5P_FILE_ACCESS, pointed to by FileCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If FileCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not happen.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+FileCreatPropList* FileCreatPropList::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 FileCreatPropList(H5P_FILE_CREATE);
+ else
+ throw PropListIException("FileCreatPropList::getConstant", "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
//--------------------------------------------------------------------------
-///\brief Constant for default property
+// Function: FileCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that FileCreatPropList::DEFAULT_
+// points to.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const FileCreatPropList FileCreatPropList::DEFAULT;
+void FileCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose Constant for default property
+//--------------------------------------------------------------------------
+const FileCreatPropList& FileCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: FileCreatPropList default constructor
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index 4fe51a9..5d81078 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -24,8 +24,8 @@ namespace H5 {
//! Class FileCreatPropList represents the HDF5 file create property list.
class H5_DLLCPP FileCreatPropList : public PropList {
public:
- // Default file creation property list.
- static const FileCreatPropList DEFAULT;
+ ///\brief Default file creation property list.
+ static const FileCreatPropList& DEFAULT;
// Creates a file create property list.
FileCreatPropList();
@@ -74,6 +74,20 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// Noop destructor
virtual ~FileCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static FileCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static FileCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 84e7827..44fc53c 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -27,6 +27,7 @@
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 784e419..cdf9872 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 4d1d61c..0823d0e 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -28,6 +28,7 @@
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index bcd69c4..93ee4fd 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -13,11 +13,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifdef OLD_HEADER_FILENAME
-#include <iostream.h>
-#else
-#include <iostream>
-#endif
#include <string>
#include "H5Include.h"
@@ -31,11 +26,16 @@
namespace H5 {
#endif
+// This flag controls whether H5Library::initH5cpp has been called to register
+// terminating functions with atexit()
+bool IdComponent::H5cppinit = false;
+bool IdComponent::H5dontAtexit_called = false;
+
//--------------------------------------------------------------------------
// Function: IdComponent overloaded constructor
-///\brief Creates an IdComponent object using the id of an existing object.
-///\param h5_id - IN: Id of an existing object
-///\exception H5::DataTypeIException
+// Purpose Creates an IdComponent object using the id of an existing object.
+// Param h5_id - IN: Id of an existing object
+// Exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//
// *** Deprecation warning ***
@@ -43,14 +43,10 @@ namespace H5 {
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
+// - Removed from documentation in 1.8.16 -BMR (October 2015)
//--------------------------------------------------------------------------
IdComponent::IdComponent(const hid_t h5_id) {}
-//void IdComponent::p_setId(const hid_t new_id)
-//{
- //p_setId(new_id);
-//}
-
//--------------------------------------------------------------------------
// Function: IdComponent copy constructor
// Purpose: This noop copy constructor is removed as a result of the data
@@ -296,7 +292,16 @@ H5std_string IdComponent::inMemFunc(const char* func_name) const
///\brief Default constructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IdComponent::IdComponent() {}
+IdComponent::IdComponent()
+{
+ // initH5cpp will register the terminating functions with atexit().
+ // We only do this once.
+ if (!H5cppinit)
+ {
+ H5Library::getInstance()->initH5cpp();
+ H5cppinit = true;
+ }
+}
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_file_name (protected)
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 068fb74..1c29f09 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -31,6 +31,12 @@ class DataSpace;
*/
class H5_DLLCPP IdComponent {
public:
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ static bool H5cppinit;
+ static bool H5dontAtexit_called;
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
// Increment reference counter.
void incRefCount(const hid_t obj_id) const;
void incRefCount() const;
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index a884829..5719eed 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index ecc5141..e7e9fb6 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -14,10 +14,23 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
+#include <cstdlib>
-#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
+#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
#include "H5Include.h"
#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5FaccProp.h"
+#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
+#include "H5DxferProp.h"
+#include "H5Object.h"
+#include "H5DataType.h"
+#include "H5DcreatProp.h"
+#include "H5AtomType.h"
+#include "H5PredType.h"
+#include "H5DataSpace.h"
#include "H5Library.h"
#ifndef H5_NO_NAMESPACE
@@ -25,8 +38,7 @@ namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// This static variable will be set to true when dontAtExit is called
-bool H5Library::need_cleanup = false;
+H5Library* H5Library::instance = 0;
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
@@ -63,18 +75,17 @@ void H5Library::close()
//--------------------------------------------------------------------------
// Function: H5Library::dontAtExit
-///\brief Instructs library not to install \c atexit cleanup routine
+///\brief Instructs library not to install the C \c atexit cleanup routine
///
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// Removed the check for failure returned from H5dont_atexit.
+// will be fixed to not fail (HDFFV-9540)
//--------------------------------------------------------------------------
void H5Library::dontAtExit()
{
herr_t ret_value = H5dont_atexit();
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::dontAtExit", "H5dont_atexit failed");
- }
}
//--------------------------------------------------------------------------
@@ -148,6 +159,91 @@ void H5Library::garbageCollect()
}
//--------------------------------------------------------------------------
+// Function: H5Library::initH5cpp
+///\brief Initializes C++ library and registers terminating functions at
+/// exit. Only for the library functions, not for user-defined
+/// functions.
+// Description
+// 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
+///\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
+ int ret_value = 0;
+ ret_value = std::atexit(termH5cpp);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of termH5cpp failed");
+
+ ret_value = std::atexit(PredType::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of PredType::deleteConstants failed");
+
+ ret_value = std::atexit(PropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of PropList::deleteConstants failed");
+
+ ret_value = std::atexit(FileAccPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of FileAccPropList::deleteConstants failed");
+
+ ret_value = std::atexit(FileCreatPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of FileCreatPropList::deleteConstants failed");
+
+ ret_value = std::atexit(DSetMemXferPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of DSetMemXferPropList::deleteConstants failed");
+
+ ret_value = std::atexit(DSetCreatPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of DSetCreatPropList::deleteConstants failed");
+
+ ret_value = std::atexit(DataSpace::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registration of DataSpace::deleteConstants failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Library::termH5cpp
+///\brief Sends request for the C layer to terminate.
+///\par Description
+/// If the C library fails to terminate, exit with a failure.
+// Programmer Binh-Minh Ribler - September, 2015
+//--------------------------------------------------------------------------
+void H5Library::termH5cpp()
+{
+ // Close the C library
+ herr_t ret_value = H5close();
+ if (ret_value == -1)
+ exit(-1);
+}
+
+//--------------------------------------------------------------------------
+// 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
///\brief Sets limits on the different kinds of free lists.
///\param reg_global_lim - IN: Limit on all "regular" free list memory used
@@ -174,6 +270,13 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
}
}
+
+// Default constructor - no instance ever created by outsiders
+H5Library::H5Library(){};
+
+// Destructor
+H5Library::~H5Library(){};
+
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index e5365f9..68ab039 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -21,14 +21,6 @@
namespace H5 {
#endif
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-#define NOTATEXIT (-10) // just in case the HDF5 library use more
- // negative constants. Note: the solution used for the atexit/global
- // destructors is not reliable, and desperately needs improvement
- // It is not even working, inifiteloop message still printed when
- // calling H5close
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
/*! \class H5Library
\brief Class H5Library operates the HDF5 library globably.
@@ -37,10 +29,6 @@ namespace H5 {
*/
class H5_DLLCPP H5Library {
public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- static bool need_cleanup; // indicates if H5close should be called
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
// Initializes the HDF5 library.
static void open();
@@ -65,9 +53,28 @@ class H5_DLLCPP H5Library {
static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
+ // Initializes C++ library and registers terminating functions at exit.
+ // Only for the library functions, not for user-defined functions.
+ static void initH5cpp(void);
+
+ // Sends request for terminating the HDF5 library.
+ static void termH5cpp(void);
+
+ static H5Library* getInstance();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
private:
- // Default constructor - no instance ever created
- H5Library() {};
+
+ // private instance to be created by H5Library only
+ static H5Library* instance;
+
+ // Default constructor - no instance ever created from outsiders
+ H5Library();
+
+ // Destructor
+ ~H5Library();
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 5100e12..b4c88ed 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -21,6 +21,7 @@
#include "H5PropList.h"
#include "H5Location.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
@@ -33,9 +34,6 @@
#include "H5DataSet.h"
#include "H5Attribute.h"
#include "H5private.h" // for HDmemset
-#include <iostream>
-using namespace std;
-
#ifndef H5_NO_NAMESPACE
namespace H5 {
@@ -951,7 +949,7 @@ H5Location::~H5Location() {}
//--------------------------------------------------------------------------
void f_Attribute_setId(Attribute* attr, hid_t new_id)
{
- attr->id = new_id;
+ attr->p_setId(new_id);
}
//--------------------------------------------------------------------------
@@ -966,7 +964,7 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id)
//--------------------------------------------------------------------------
void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
{
- dspace->id = new_id;
+ dspace->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index df3f565..35e34b5 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
new file mode 100644
index 0000000..635ffe9
--- /dev/null
+++ b/c++/src/H5OcreatProp.cpp
@@ -0,0 +1,222 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5FaccProp.h"
+#include "H5OcreatProp.h"
+
+#ifndef H5_NO_NAMESPACE
+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
+ObjCreatPropList* ObjCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::getConstant
+// Creates a ObjCreatPropList object representing the HDF5 constant
+// H5P_FILE_ACCESS, pointed to by ObjCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If ObjCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+ObjCreatPropList* ObjCreatPropList::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 ObjCreatPropList(H5P_OBJECT_CREATE);
+ else
+ throw PropListIException("ObjCreatPropList::getConstant", "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that ObjCreatPropList::DEFAULT_
+// points to.
+// exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void ObjCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default property
+//--------------------------------------------------------------------------
+const ObjCreatPropList& ObjCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: Default Constructor
+///\brief Creates a file access property list
+// Programmer: Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: ObjCreatPropList instance to copy
+// Programmer: Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList& original) : PropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// Programmer: Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::setAttrPhaseChange
+///\brief Sets attribute storage phase change thresholds.
+///\param max_compact - IN: Maximum number of attributes to be stored in
+/// compact storage. Default to 8
+///\param min_dense - IN: Minimum number of attributes to be stored in
+/// dense storage. Default to 6
+///\exception H5::PropListIException
+///\par Description
+/// If \c max_compact is set to 0, dense storage will be used.
+/// For more detail about on attribute storage, please refer to the
+/// C layer Reference Manual at:
+/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrPhaseChange
+// Programmer: Binh-Minh Ribler - September 2015
+//--------------------------------------------------------------------------
+void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
+{
+ herr_t ret_value = H5Pset_attr_phase_change(id, max_compact, min_dense);
+ if (ret_value < 0)
+ {
+ throw PropListIException("ObjCreatPropList::setAttrPhaseChange", "H5Pset_attr_phase_change failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::getAttrPhaseChange
+///\brief Gets attribute storage phase change thresholds.
+///\param max_compact - OUT: Maximum number of attributes to be stored in
+/// compact storage.
+///\param min_dense - OUT: Minimum number of attributes to be stored in
+/// dense storage.
+///\exception H5::PropListIException
+///\par Description
+/// If \c max_compact is set to 0, dense storage will be used.
+/// For more detail about on attribute storage, please refer to the
+/// C layer Reference Manual at:
+/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrPhaseChange
+// Programmer: Binh-Minh Ribler - September 2015
+//--------------------------------------------------------------------------
+void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const
+{
+ herr_t ret_value;
+ ret_value = H5Pget_attr_phase_change(id, &max_compact, &min_dense);
+ if (ret_value < 0)
+ {
+ throw PropListIException("ObjCreatPropList::getAttrPhaseChange", "H5Pget_attr_phase_change failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::setAttrCrtOrder
+///\brief Sets tracking and indexing of attribute creation order.
+///\param crt_order_flags - IN: Flags specifying whether to track and
+/// index attribute creation order. Default: No flag set
+///\exception H5::PropListIException
+///\par Description
+/// Valid flags are:
+/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked
+/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is
+/// indexed (requires H5P_CRT_ORDER_TRACKED).
+/// When no flag is set, attribute creation order is neither
+/// tracked not indexed. Note that HDF5 currently provides no
+/// mechanism to turn on attribute creation order tracking at object
+/// creation time and to build the index later.
+/// The C layer Reference Manual at can be found at:
+/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrCreationOrder
+// Programmer: Binh-Minh Ribler - September 2015
+//--------------------------------------------------------------------------
+void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
+{
+ herr_t ret_value = H5Pset_attr_creation_order(id, crt_order_flags);
+ if (ret_value < 0)
+ {
+ throw PropListIException("ObjCreatPropList::setAttrCrtOrder", "H5Pset_attr_creation_order failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList::getAttrCrtOrder
+///\brief Gets tracking and indexing settings for attribute
+/// creation order.
+///\param crt_order_flags - OUT: Flags specifying whether to track and
+/// index attribute creation order
+///\exception H5::PropListIException
+///\par Description
+/// When no flag is set, i.e. crt_order_flags = 0, attribute
+/// creation order is neither tracked not indexed.
+/// The C layer Reference Manual at can be found at:
+/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrCreationOrder
+// Programmer: Binh-Minh Ribler - September 2015
+//--------------------------------------------------------------------------
+unsigned ObjCreatPropList::getAttrCrtOrder() const
+{
+ herr_t ret_value;
+ unsigned crt_order_flags = 0;
+ ret_value = H5Pget_attr_creation_order(id, &crt_order_flags);
+ if (ret_value < 0)
+ {
+ throw PropListIException("ObjCreatPropList::getAttrCrtOrder", "H5Pget_attr_creation_order failed");
+ }
+ return(crt_order_flags);
+}
+
+//--------------------------------------------------------------------------
+// Function: ObjCreatPropList destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+ObjCreatPropList::~ObjCreatPropList() {}
+
+#ifndef H5_NO_NAMESPACE
+} // end namespace
+#endif
diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h
new file mode 100644
index 0000000..0fda34d
--- /dev/null
+++ b/c++/src/H5OcreatProp.h
@@ -0,0 +1,76 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef __H5ObjCreatPropList_H
+#define __H5ObjCreatPropList_H
+
+#ifndef H5_NO_NAMESPACE
+namespace H5 {
+#endif
+
+//! Class ObjCreatPropList represents the HDF5 object creation property list.
+class H5_DLLCPP ObjCreatPropList : public PropList {
+ public:
+ ///\brief Default object creation property list.
+ static const ObjCreatPropList& DEFAULT;
+
+ // Creates a object creation property list.
+ ObjCreatPropList();
+
+ // Sets attribute storage phase change thresholds.
+ void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
+
+ // Gets attribute storage phase change thresholds.
+ void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const;
+
+ // Sets tracking and indexing of attribute creation order.
+ void setAttrCrtOrder(unsigned crt_order_flags) const;
+
+ // Gets tracking and indexing settings for attribute creation order.
+ unsigned getAttrCrtOrder() const;
+
+
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("ObjCreatPropList"); }
+
+ // Copy constructor: creates a copy of a ObjCreatPropList object.
+ ObjCreatPropList( const ObjCreatPropList& original );
+
+ // Creates a copy of an existing object creation property list
+ // using the property list id.
+ ObjCreatPropList (const hid_t plist_id);
+
+ // Noop destructor
+ virtual ~ObjCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static ObjCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static ObjCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+};
+#ifndef H5_NO_NAMESPACE
+}
+#endif
+#endif // __H5ObjCreatPropList_H
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 6dbee98..fb29f1e 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -20,11 +20,8 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
-#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
-#include "H5Library.h"
#include "H5PredType.h"
#ifndef H5_NO_NAMESPACE
@@ -42,12 +39,9 @@ namespace H5 {
// the provided HDF5 predefined datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id )
+PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id)
{
- if (predtype_id == H5CPP_EXITED)
- id = predtype_id;
- else
- id = H5Tcopy(predtype_id);
+ id = H5Tcopy(predtype_id);
}
//--------------------------------------------------------------------------
@@ -64,238 +58,1039 @@ PredType::PredType() : AtomType() {}
///\param original - IN: PredType instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType( const PredType& original ) : AtomType( original ) {}
+PredType::PredType(const PredType& original) : AtomType(original) {}
+
+//--------------------------------------------------------------------------
+// Function: PredType::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the predefined datatype
+///\return Reference to PredType instance
+///\exception H5::DataTypeIException
+// Description
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+PredType& PredType::operator=( const PredType& rhs )
+{
+ if (this != &rhs)
+ copy(rhs);
+ return(*this);
+}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// 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 );
-const PredType PredType::FORTRAN_S1( H5T_FORTRAN_S1 );
-
-const PredType PredType::STD_I8BE( H5T_STD_I8BE );
-const PredType PredType::STD_I8LE( H5T_STD_I8LE );
-const PredType PredType::STD_I16BE( H5T_STD_I16BE );
-const PredType PredType::STD_I16LE( H5T_STD_I16LE );
-const PredType PredType::STD_I32BE( H5T_STD_I32BE );
-const PredType PredType::STD_I32LE( H5T_STD_I32LE );
-const PredType PredType::STD_I64BE( H5T_STD_I64BE );
-const PredType PredType::STD_I64LE( H5T_STD_I64LE );
-const PredType PredType::STD_U8BE( H5T_STD_U8BE );
-const PredType PredType::STD_U8LE( H5T_STD_U8LE );
-const PredType PredType::STD_U16BE( H5T_STD_U16BE );
-const PredType PredType::STD_U16LE( H5T_STD_U16LE );
-const PredType PredType::STD_U32BE( H5T_STD_U32BE );
-const PredType PredType::STD_U32LE( H5T_STD_U32LE );
-const PredType PredType::STD_U64BE( H5T_STD_U64BE );
-const PredType PredType::STD_U64LE( H5T_STD_U64LE );
-const PredType PredType::STD_B8BE( H5T_STD_B8BE );
-const PredType PredType::STD_B8LE( H5T_STD_B8LE );
-
-const PredType PredType::STD_B16BE( H5T_STD_B16BE );
-const PredType PredType::STD_B16LE( H5T_STD_B16LE );
-const PredType PredType::STD_B32BE( H5T_STD_B32BE );
-const PredType PredType::STD_B32LE( H5T_STD_B32LE );
-const PredType PredType::STD_B64BE( H5T_STD_B64BE );
-const PredType PredType::STD_B64LE( H5T_STD_B64LE );
-const PredType PredType::STD_REF_OBJ( H5T_STD_REF_OBJ );
-const PredType PredType::STD_REF_DSETREG( H5T_STD_REF_DSETREG );
-
-const PredType PredType::IEEE_F32BE( H5T_IEEE_F32BE );
-const PredType PredType::IEEE_F32LE( H5T_IEEE_F32LE );
-const PredType PredType::IEEE_F64BE( H5T_IEEE_F64BE );
-const PredType PredType::IEEE_F64LE( H5T_IEEE_F64LE );
-
-const PredType PredType::UNIX_D32BE( H5T_UNIX_D32BE );
-const PredType PredType::UNIX_D32LE( H5T_UNIX_D32LE );
-const PredType PredType::UNIX_D64BE( H5T_UNIX_D64BE );
-const PredType PredType::UNIX_D64LE( H5T_UNIX_D64LE );
-
-const PredType PredType::INTEL_I8( H5T_INTEL_I8 );
-const PredType PredType::INTEL_I16( H5T_INTEL_I16 );
-const PredType PredType::INTEL_I32( H5T_INTEL_I32 );
-const PredType PredType::INTEL_I64( H5T_INTEL_I64 );
-const PredType PredType::INTEL_U8( H5T_INTEL_U8 );
-const PredType PredType::INTEL_U16( H5T_INTEL_U16 );
-const PredType PredType::INTEL_U32( H5T_INTEL_U32 );
-const PredType PredType::INTEL_U64( H5T_INTEL_U64 );
-const PredType PredType::INTEL_B8( H5T_INTEL_B8 );
-const PredType PredType::INTEL_B16( H5T_INTEL_B16 );
-const PredType PredType::INTEL_B32( H5T_INTEL_B32 );
-const PredType PredType::INTEL_B64( H5T_INTEL_B64 );
-const PredType PredType::INTEL_F32( H5T_INTEL_F32 );
-const PredType PredType::INTEL_F64( H5T_INTEL_F64 );
-
-const PredType PredType::ALPHA_I8( H5T_ALPHA_I8 );
-const PredType PredType::ALPHA_I16( H5T_ALPHA_I16 );
-const PredType PredType::ALPHA_I32( H5T_ALPHA_I32 );
-const PredType PredType::ALPHA_I64( H5T_ALPHA_I64 );
-const PredType PredType::ALPHA_U8( H5T_ALPHA_U8 );
-const PredType PredType::ALPHA_U16( H5T_ALPHA_U16 );
-const PredType PredType::ALPHA_U32( H5T_ALPHA_U32 );
-const PredType PredType::ALPHA_U64( H5T_ALPHA_U64 );
-const PredType PredType::ALPHA_B8( H5T_ALPHA_B8 );
-const PredType PredType::ALPHA_B16( H5T_ALPHA_B16 );
-const PredType PredType::ALPHA_B32( H5T_ALPHA_B32 );
-const PredType PredType::ALPHA_B64( H5T_ALPHA_B64 );
-const PredType PredType::ALPHA_F32( H5T_ALPHA_F32 );
-const PredType PredType::ALPHA_F64( H5T_ALPHA_F64 );
-
-const PredType PredType::MIPS_I8( H5T_MIPS_I8 );
-const PredType PredType::MIPS_I16( H5T_MIPS_I16 );
-const PredType PredType::MIPS_I32( H5T_MIPS_I32 );
-const PredType PredType::MIPS_I64( H5T_MIPS_I64 );
-const PredType PredType::MIPS_U8( H5T_MIPS_U8 );
-const PredType PredType::MIPS_U16( H5T_MIPS_U16 );
-const PredType PredType::MIPS_U32( H5T_MIPS_U32 );
-const PredType PredType::MIPS_U64( H5T_MIPS_U64 );
-const PredType PredType::MIPS_B8( H5T_MIPS_B8 );
-const PredType PredType::MIPS_B16( H5T_MIPS_B16 );
-const PredType PredType::MIPS_B32( H5T_MIPS_B32 );
-const PredType PredType::MIPS_B64( H5T_MIPS_B64 );
-const PredType PredType::MIPS_F32( H5T_MIPS_F32 );
-const PredType PredType::MIPS_F64( H5T_MIPS_F64 );
-
-const PredType PredType::NATIVE_CHAR( H5T_NATIVE_CHAR );
-const PredType PredType::NATIVE_INT( H5T_NATIVE_INT );
-const PredType PredType::NATIVE_FLOAT( H5T_NATIVE_FLOAT );
-const PredType PredType::NATIVE_SCHAR( H5T_NATIVE_SCHAR );
-const PredType PredType::NATIVE_UCHAR( H5T_NATIVE_UCHAR );
-const PredType PredType::NATIVE_SHORT( H5T_NATIVE_SHORT );
-const PredType PredType::NATIVE_USHORT( H5T_NATIVE_USHORT );
-const PredType PredType::NATIVE_UINT( H5T_NATIVE_UINT );
-const PredType PredType::NATIVE_LONG( H5T_NATIVE_LONG );
-const PredType PredType::NATIVE_ULONG( H5T_NATIVE_ULONG );
-const PredType PredType::NATIVE_LLONG( H5T_NATIVE_LLONG );
-const PredType PredType::NATIVE_ULLONG( H5T_NATIVE_ULLONG );
-const PredType PredType::NATIVE_DOUBLE( H5T_NATIVE_DOUBLE );
-#if H5_SIZEOF_LONG_DOUBLE !=0
-const PredType PredType::NATIVE_LDOUBLE( H5T_NATIVE_LDOUBLE );
-#endif
-const PredType PredType::NATIVE_B8( H5T_NATIVE_B8 );
-const PredType PredType::NATIVE_B16( H5T_NATIVE_B16 );
-const PredType PredType::NATIVE_B32( H5T_NATIVE_B32 );
-const PredType PredType::NATIVE_B64( H5T_NATIVE_B64 );
-const PredType PredType::NATIVE_OPAQUE( H5T_NATIVE_OPAQUE );
-const PredType PredType::NATIVE_HSIZE( H5T_NATIVE_HSIZE );
-const PredType PredType::NATIVE_HSSIZE( H5T_NATIVE_HSSIZE );
-const PredType PredType::NATIVE_HERR( H5T_NATIVE_HERR );
-const PredType PredType::NATIVE_HBOOL( H5T_NATIVE_HBOOL );
-
-const PredType PredType::NATIVE_INT8( H5T_NATIVE_INT8 );
-const PredType PredType::NATIVE_UINT8( H5T_NATIVE_UINT8 );
-const PredType PredType::NATIVE_INT16( H5T_NATIVE_INT16 );
-const PredType PredType::NATIVE_UINT16( H5T_NATIVE_UINT16 );
-const PredType PredType::NATIVE_INT32( H5T_NATIVE_INT32 );
-const PredType PredType::NATIVE_UINT32( H5T_NATIVE_UINT32 );
-const PredType PredType::NATIVE_INT64( H5T_NATIVE_INT64 );
-const PredType PredType::NATIVE_UINT64( H5T_NATIVE_UINT64 );
+// These dummy functions do not inherit from DataType - they'll
+// throw an DataTypeIException if invoked.
+void PredType::commit(H5Location& loc, const char* name )
+{
+ throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" );
+}
+
+void PredType::commit(H5Location& loc, const H5std_string& name )
+{
+ commit( loc, name.c_str());
+}
+
+bool PredType::committed()
+{
+ throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." );
+}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+// Default destructor
+//--------------------------------------------------------------------------
+// Function: PredType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+PredType::~PredType() {}
+
+/*****************************************************************************
+ The following section is regarding the global constants PredType,
+ DataSpace, and PropList.
+
+ *****************************************************************************/
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// Definition pointers for the constants
+PredType* PredType::PREDTYPE_CONST_ = 0; //dummy
+PredType* PredType::STD_I8BE_;
+PredType* PredType::STD_I8LE_;
+PredType* PredType::STD_I16BE_;
+PredType* PredType::STD_I16LE_;
+PredType* PredType::STD_I32BE_;
+PredType* PredType::STD_I32LE_;
+PredType* PredType::STD_I64BE_;
+PredType* PredType::STD_I64LE_;
+PredType* PredType::STD_U8BE_;
+PredType* PredType::STD_U8LE_;
+PredType* PredType::STD_U16BE_;
+PredType* PredType::STD_U16LE_;
+PredType* PredType::STD_U32BE_;
+PredType* PredType::STD_U32LE_;
+PredType* PredType::STD_U64BE_;
+PredType* PredType::STD_U64LE_;
+PredType* PredType::STD_B8BE_;
+PredType* PredType::STD_B8LE_;
+PredType* PredType::STD_B16BE_;
+PredType* PredType::STD_B16LE_;
+PredType* PredType::STD_B32BE_;
+PredType* PredType::STD_B32LE_;
+PredType* PredType::STD_B64BE_;
+PredType* PredType::STD_B64LE_;
+PredType* PredType::STD_REF_OBJ_;
+PredType* PredType::STD_REF_DSETREG_;
+
+PredType* PredType::C_S1_;
+PredType* PredType::FORTRAN_S1_;
+
+PredType* PredType::IEEE_F32BE_;
+PredType* PredType::IEEE_F32LE_;
+PredType* PredType::IEEE_F64BE_;
+PredType* PredType::IEEE_F64LE_;
+
+PredType* PredType::UNIX_D32BE_;
+PredType* PredType::UNIX_D32LE_;
+PredType* PredType::UNIX_D64BE_;
+PredType* PredType::UNIX_D64LE_;
+
+PredType* PredType::INTEL_I8_;
+PredType* PredType::INTEL_I16_;
+PredType* PredType::INTEL_I32_;
+PredType* PredType::INTEL_I64_;
+PredType* PredType::INTEL_U8_;
+PredType* PredType::INTEL_U16_;
+PredType* PredType::INTEL_U32_;
+PredType* PredType::INTEL_U64_;
+PredType* PredType::INTEL_B8_;
+PredType* PredType::INTEL_B16_;
+PredType* PredType::INTEL_B32_;
+PredType* PredType::INTEL_B64_;
+PredType* PredType::INTEL_F32_;
+PredType* PredType::INTEL_F64_;
+
+PredType* PredType::ALPHA_I8_;
+PredType* PredType::ALPHA_I16_;
+PredType* PredType::ALPHA_I32_;
+PredType* PredType::ALPHA_I64_;
+PredType* PredType::ALPHA_U8_;
+PredType* PredType::ALPHA_U16_;
+PredType* PredType::ALPHA_U32_;
+PredType* PredType::ALPHA_U64_;
+PredType* PredType::ALPHA_B8_;
+PredType* PredType::ALPHA_B16_;
+PredType* PredType::ALPHA_B32_;
+PredType* PredType::ALPHA_B64_;
+PredType* PredType::ALPHA_F32_;
+PredType* PredType::ALPHA_F64_;
+
+PredType* PredType::MIPS_I8_;
+PredType* PredType::MIPS_I16_;
+PredType* PredType::MIPS_I32_;
+PredType* PredType::MIPS_I64_;
+PredType* PredType::MIPS_U8_;
+PredType* PredType::MIPS_U16_;
+PredType* PredType::MIPS_U32_;
+PredType* PredType::MIPS_U64_;
+PredType* PredType::MIPS_B8_;
+PredType* PredType::MIPS_B16_;
+PredType* PredType::MIPS_B32_;
+PredType* PredType::MIPS_B64_;
+PredType* PredType::MIPS_F32_;
+PredType* PredType::MIPS_F64_;
+
+PredType* PredType::NATIVE_CHAR_;
+PredType* PredType::NATIVE_SCHAR_;
+PredType* PredType::NATIVE_UCHAR_;
+PredType* PredType::NATIVE_SHORT_;
+PredType* PredType::NATIVE_USHORT_;
+PredType* PredType::NATIVE_INT_;
+PredType* PredType::NATIVE_UINT_;
+PredType* PredType::NATIVE_LONG_;
+PredType* PredType::NATIVE_ULONG_;
+PredType* PredType::NATIVE_LLONG_;
+PredType* PredType::NATIVE_ULLONG_;
+PredType* PredType::NATIVE_FLOAT_;
+PredType* PredType::NATIVE_DOUBLE_;
+PredType* PredType::NATIVE_LDOUBLE_;
+PredType* PredType::NATIVE_B8_;
+PredType* PredType::NATIVE_B16_;
+PredType* PredType::NATIVE_B32_;
+PredType* PredType::NATIVE_B64_;
+PredType* PredType::NATIVE_OPAQUE_;
+PredType* PredType::NATIVE_HSIZE_;
+PredType* PredType::NATIVE_HSSIZE_;
+PredType* PredType::NATIVE_HERR_;
+PredType* PredType::NATIVE_HBOOL_;
+
+PredType* PredType::NATIVE_INT8_;
+PredType* PredType::NATIVE_UINT8_;
+PredType* PredType::NATIVE_INT16_;
+PredType* PredType::NATIVE_UINT16_;
+PredType* PredType::NATIVE_INT32_;
+PredType* PredType::NATIVE_UINT32_;
+PredType* PredType::NATIVE_INT64_;
+PredType* PredType::NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
-const PredType PredType::NATIVE_INT_LEAST8( H5T_NATIVE_INT_LEAST8 );
+PredType* PredType::NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
-const PredType PredType::NATIVE_UINT_LEAST8( H5T_NATIVE_UINT_LEAST8 );
+PredType* PredType::NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
-const PredType PredType::NATIVE_INT_LEAST16( H5T_NATIVE_INT_LEAST16 );
+PredType* PredType::NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
-const PredType PredType::NATIVE_UINT_LEAST16( H5T_NATIVE_UINT_LEAST16 );
+PredType* PredType::NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
-const PredType PredType::NATIVE_INT_LEAST32( H5T_NATIVE_INT_LEAST32 );
+PredType* PredType::NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
-const PredType PredType::NATIVE_UINT_LEAST32( H5T_NATIVE_UINT_LEAST32 );
+PredType* PredType::NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
-const PredType PredType::NATIVE_INT_LEAST64( H5T_NATIVE_INT_LEAST64 );
+PredType* PredType::NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
-const PredType PredType::NATIVE_UINT_LEAST64( H5T_NATIVE_UINT_LEAST64 );
+PredType* PredType::NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
-const PredType PredType::NATIVE_INT_FAST8( H5T_NATIVE_INT_FAST8 );
+PredType* PredType::NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
-const PredType PredType::NATIVE_UINT_FAST8( H5T_NATIVE_UINT_FAST8 );
+PredType* PredType::NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
-const PredType PredType::NATIVE_INT_FAST16( H5T_NATIVE_INT_FAST16 );
+PredType* PredType::NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
-const PredType PredType::NATIVE_UINT_FAST16( H5T_NATIVE_UINT_FAST16 );
+PredType* PredType::NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
-const PredType PredType::NATIVE_INT_FAST32( H5T_NATIVE_INT_FAST32 );
+PredType* PredType::NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
-const PredType PredType::NATIVE_UINT_FAST32( H5T_NATIVE_UINT_FAST32 );
+PredType* PredType::NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
-const PredType PredType::NATIVE_INT_FAST64( H5T_NATIVE_INT_FAST64 );
+PredType* PredType::NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
-const PredType PredType::NATIVE_UINT_FAST64( H5T_NATIVE_UINT_FAST64 );
+PredType* PredType::NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
-#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: PredType::operator=
-///\brief Assignment operator.
-///\param rhs - IN: Reference to the predefined datatype
-///\return Reference to PredType instance
-///\exception H5::DataTypeIException
+// Function: PredType::getPredTypes
+// Purpose: Returns the dummy PredType constant object pointer
+// Return: PredType object pointer
// Description
-// Makes a copy of the type on the right hand side and stores
-// the new id in the left hand side object.
-// Programmer Binh-Minh Ribler - 2000
+// If the dummy constant PREDTYPE_CONST_ is not allocated yet,
+// call makePredTypes() to allocate all of the PredType constants.
+// Otherwise, just simply return the object pointer PREDTYPE_CONST_.
+//
+// Note that, there is a similar function to getPredTypes() in
+// other classes, that have global constants, is called getConstant().
+//
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-PredType& PredType::operator=( const PredType& rhs )
+PredType* PredType::getPredTypes()
{
- if (this != &rhs)
- copy(rhs);
- return(*this);
-}
+ // 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;
+ }
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// These dummy functions do not inherit from DataType - they'll
-// throw an DataTypeIException if invoked.
-void PredType::commit(H5Location& loc, const char* name )
-{
- throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" );
+ // If the dummy constant pointer is not allocated, allocate all PredType
+ // constant pointers. Otherwise, throw because it shouldn't be.
+ if (PREDTYPE_CONST_ == 0)
+ makePredTypes();
+ else
+ throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
+ return PREDTYPE_CONST_;
}
-void PredType::commit(H5Location& loc, const H5std_string& name )
+//--------------------------------------------------------------------------
+// Function: PredType::makePredTypes
+// Purpose: Allocate all PredType constants.
+// Programmer Binh-Minh Ribler - September 2015
+//--------------------------------------------------------------------------
+void PredType::makePredTypes()
{
- commit( loc, name.c_str());
-}
+ PREDTYPE_CONST_ = new PredType;
+ C_S1_ = new PredType(H5T_C_S1);
+ FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1);
+
+ STD_I8BE_ = new PredType(H5T_STD_I8BE);
+ STD_I8LE_ = new PredType(H5T_STD_I8LE);
+ STD_I16BE_ = new PredType(H5T_STD_I16BE);
+ STD_I16LE_ = new PredType(H5T_STD_I16LE);
+ STD_I32BE_ = new PredType(H5T_STD_I32BE);
+ STD_I32LE_ = new PredType(H5T_STD_I32LE);
+ STD_I64BE_ = new PredType(H5T_STD_I64BE);
+ STD_I64LE_ = new PredType(H5T_STD_I64LE);
+ STD_U8BE_ = new PredType(H5T_STD_U8BE);
+ STD_U8LE_ = new PredType(H5T_STD_U8LE);
+ STD_U16BE_ = new PredType(H5T_STD_U16BE);
+ STD_U16LE_ = new PredType(H5T_STD_U16LE);
+ STD_U32BE_ = new PredType(H5T_STD_U32BE);
+ STD_U32LE_ = new PredType(H5T_STD_U32LE);
+ STD_U64BE_ = new PredType(H5T_STD_U64BE);
+ STD_U64LE_ = new PredType(H5T_STD_U64LE);
+ STD_B8BE_ = new PredType(H5T_STD_B8BE);
+ STD_B8LE_ = new PredType(H5T_STD_B8LE);
+
+ STD_B16BE_ = new PredType(H5T_STD_B16BE);
+ STD_B16LE_ = new PredType(H5T_STD_B16LE);
+ STD_B32BE_ = new PredType(H5T_STD_B32BE);
+ STD_B32LE_ = new PredType(H5T_STD_B32LE);
+ STD_B64BE_ = new PredType(H5T_STD_B64BE);
+ STD_B64LE_ = new PredType(H5T_STD_B64LE);
+ STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ);
+ STD_REF_DSETREG_ = new PredType(H5T_STD_REF_DSETREG);
+
+ IEEE_F32BE_ = new PredType(H5T_IEEE_F32BE);
+ IEEE_F32LE_ = new PredType(H5T_IEEE_F32LE);
+ IEEE_F64BE_ = new PredType(H5T_IEEE_F64BE);
+ IEEE_F64LE_ = new PredType(H5T_IEEE_F64LE);
+
+ UNIX_D32BE_ = new PredType(H5T_UNIX_D32BE);
+ UNIX_D32LE_ = new PredType(H5T_UNIX_D32LE);
+ UNIX_D64BE_ = new PredType(H5T_UNIX_D64BE);
+ UNIX_D64LE_ = new PredType(H5T_UNIX_D64LE);
+
+ INTEL_I8_ = new PredType(H5T_INTEL_I8);
+ INTEL_I16_ = new PredType(H5T_INTEL_I16);
+ INTEL_I32_ = new PredType(H5T_INTEL_I32);
+ INTEL_I64_ = new PredType(H5T_INTEL_I64);
+ INTEL_U8_ = new PredType(H5T_INTEL_U8);
+ INTEL_U16_ = new PredType(H5T_INTEL_U16);
+ INTEL_U32_ = new PredType(H5T_INTEL_U32);
+ INTEL_U64_ = new PredType(H5T_INTEL_U64);
+ INTEL_B8_ = new PredType(H5T_INTEL_B8);
+ INTEL_B16_ = new PredType(H5T_INTEL_B16);
+ INTEL_B32_ = new PredType(H5T_INTEL_B32);
+ INTEL_B64_ = new PredType(H5T_INTEL_B64);
+ INTEL_F32_ = new PredType(H5T_INTEL_F32);
+ INTEL_F64_ = new PredType(H5T_INTEL_F64);
+
+ ALPHA_I8_ = new PredType(H5T_ALPHA_I8);
+ ALPHA_I16_ = new PredType(H5T_ALPHA_I16);
+ ALPHA_I32_ = new PredType(H5T_ALPHA_I32);
+ ALPHA_I64_ = new PredType(H5T_ALPHA_I64);
+ ALPHA_U8_ = new PredType(H5T_ALPHA_U8);
+ ALPHA_U16_ = new PredType(H5T_ALPHA_U16);
+ ALPHA_U32_ = new PredType(H5T_ALPHA_U32);
+ ALPHA_U64_ = new PredType(H5T_ALPHA_U64);
+ ALPHA_B8_ = new PredType(H5T_ALPHA_B8);
+ ALPHA_B16_ = new PredType(H5T_ALPHA_B16);
+ ALPHA_B32_ = new PredType(H5T_ALPHA_B32);
+ ALPHA_B64_ = new PredType(H5T_ALPHA_B64);
+ ALPHA_F32_ = new PredType(H5T_ALPHA_F32);
+ ALPHA_F64_ = new PredType(H5T_ALPHA_F64);
+
+ MIPS_I8_ = new PredType(H5T_MIPS_I8);
+ MIPS_I16_ = new PredType(H5T_MIPS_I16);
+ MIPS_I32_ = new PredType(H5T_MIPS_I32);
+ MIPS_I64_ = new PredType(H5T_MIPS_I64);
+ MIPS_U8_ = new PredType(H5T_MIPS_U8);
+ MIPS_U16_ = new PredType(H5T_MIPS_U16);
+ MIPS_U32_ = new PredType(H5T_MIPS_U32);
+ MIPS_U64_ = new PredType(H5T_MIPS_U64);
+ MIPS_B8_ = new PredType(H5T_MIPS_B8);
+ MIPS_B16_ = new PredType(H5T_MIPS_B16);
+ MIPS_B32_ = new PredType(H5T_MIPS_B32);
+ MIPS_B64_ = new PredType(H5T_MIPS_B64);
+ MIPS_F32_ = new PredType(H5T_MIPS_F32);
+ MIPS_F64_ = new PredType(H5T_MIPS_F64);
+
+ NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR);
+ NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
+ NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT);
+ NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR);
+ NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR);
+ NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT);
+ NATIVE_USHORT_ = new PredType(H5T_NATIVE_USHORT);
+ NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT);
+ NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG);
+ NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG);
+ NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG);
+ NATIVE_ULLONG_ = new PredType(H5T_NATIVE_ULLONG);
+ NATIVE_DOUBLE_ = new PredType(H5T_NATIVE_DOUBLE);
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ NATIVE_LDOUBLE_ = new PredType(H5T_NATIVE_LDOUBLE);
+#endif
+ NATIVE_B8_ = new PredType(H5T_NATIVE_B8);
+ NATIVE_B16_ = new PredType(H5T_NATIVE_B16);
+ NATIVE_B32_ = new PredType(H5T_NATIVE_B32);
+ NATIVE_B64_ = new PredType(H5T_NATIVE_B64);
+ NATIVE_OPAQUE_ = new PredType(H5T_NATIVE_OPAQUE);
+ NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE);
+ NATIVE_HSSIZE_ = new PredType(H5T_NATIVE_HSSIZE);
+ NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR);
+ NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL);
+
+ NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8);
+ NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8);
+ NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16);
+ NATIVE_UINT16_ = new PredType(H5T_NATIVE_UINT16);
+ NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32);
+ NATIVE_UINT32_ = new PredType(H5T_NATIVE_UINT32);
+ NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
+ NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64);
+
+// LEAST types
+#if H5_SIZEOF_INT_LEAST8_T != 0
+ NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8);
+#endif /* H5_SIZEOF_INT_LEAST8_T */
+#if H5_SIZEOF_UINT_LEAST8_T != 0
+ NATIVE_UINT_LEAST8_ = new PredType(H5T_NATIVE_UINT_LEAST8);
+#endif /* H5_SIZEOF_UINT_LEAST8_T */
+
+#if H5_SIZEOF_INT_LEAST16_T != 0
+ NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16);
+#endif /* H5_SIZEOF_INT_LEAST16_T */
+#if H5_SIZEOF_UINT_LEAST16_T != 0
+ NATIVE_UINT_LEAST16_ = new PredType(H5T_NATIVE_UINT_LEAST16);
+#endif /* H5_SIZEOF_UINT_LEAST16_T */
+
+#if H5_SIZEOF_INT_LEAST32_T != 0
+ NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32);
+#endif /* H5_SIZEOF_INT_LEAST32_T */
+#if H5_SIZEOF_UINT_LEAST32_T != 0
+ NATIVE_UINT_LEAST32_ = new PredType(H5T_NATIVE_UINT_LEAST32);
+#endif /* H5_SIZEOF_UINT_LEAST32_T */
+
+#if H5_SIZEOF_INT_LEAST64_T != 0
+ NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64);
+#endif /* H5_SIZEOF_INT_LEAST64_T */
+#if H5_SIZEOF_UINT_LEAST64_T != 0
+ NATIVE_UINT_LEAST64_ = new PredType(H5T_NATIVE_UINT_LEAST64);
+#endif /* H5_SIZEOF_UINT_LEAST64_T */
+
+// FAST types
+#if H5_SIZEOF_INT_FAST8_T != 0
+ NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8);
+#endif /* H5_SIZEOF_INT_FAST8_T */
+#if H5_SIZEOF_UINT_FAST8_T != 0
+ NATIVE_UINT_FAST8_ = new PredType(H5T_NATIVE_UINT_FAST8);
+#endif /* H5_SIZEOF_UINT_FAST8_T */
+
+#if H5_SIZEOF_INT_FAST16_T != 0
+ NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16);
+#endif /* H5_SIZEOF_INT_FAST16_T */
+#if H5_SIZEOF_UINT_FAST16_T != 0
+ NATIVE_UINT_FAST16_ = new PredType(H5T_NATIVE_UINT_FAST16);
+#endif /* H5_SIZEOF_UINT_FAST16_T */
+
+#if H5_SIZEOF_INT_FAST32_T != 0
+ NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32);
+#endif /* H5_SIZEOF_INT_FAST32_T */
+#if H5_SIZEOF_UINT_FAST32_T != 0
+ NATIVE_UINT_FAST32_ = new PredType(H5T_NATIVE_UINT_FAST32);
+#endif /* H5_SIZEOF_UINT_FAST32_T */
+
+#if H5_SIZEOF_INT_FAST64_T != 0
+ NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64);
+#endif /* H5_SIZEOF_INT_FAST64_T */
+#if H5_SIZEOF_UINT_FAST64_T != 0
+ NATIVE_UINT_FAST64_ = new PredType(H5T_NATIVE_UINT_FAST64);
+#endif /* H5_SIZEOF_UINT_FAST64_T */
+
+} // makePredTypes
-bool PredType::committed()
-{
- throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." );
-}
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-// Default destructor
//--------------------------------------------------------------------------
-// Function: PredType destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: PredType::deleteConstants
+// Purpose: Deletes all PredType constant pointers.
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-PredType::~PredType() {}
+void PredType::deleteConstants()
+{
+ delete STD_I8BE_;
+ delete STD_I8LE_;
+ delete STD_I16BE_;
+ delete STD_I16LE_;
+ delete STD_I32BE_;
+ delete STD_I32LE_;
+ delete STD_I64BE_;
+ delete STD_I64LE_;
+ delete STD_U8BE_;
+ delete STD_U8LE_;
+ delete STD_U16BE_;
+ delete STD_U16LE_;
+ delete STD_U32BE_;
+ delete STD_U32LE_;
+ delete STD_U64BE_;
+ delete STD_U64LE_;
+ delete STD_B8BE_;
+ delete STD_B8LE_;
+ delete STD_B16BE_;
+ delete STD_B16LE_;
+ delete STD_B32BE_;
+ delete STD_B32LE_;
+ delete STD_B64BE_;
+ delete STD_B64LE_;
+ delete STD_REF_OBJ_;
+ delete STD_REF_DSETREG_;
+
+ delete C_S1_;
+ delete FORTRAN_S1_;
+
+ delete IEEE_F32BE_;
+ delete IEEE_F32LE_;
+ delete IEEE_F64BE_;
+ delete IEEE_F64LE_;
+
+ delete UNIX_D32BE_;
+ delete UNIX_D32LE_;
+ delete UNIX_D64BE_;
+ delete UNIX_D64LE_;
+
+ delete INTEL_I8_;
+ delete INTEL_I16_;
+ delete INTEL_I32_;
+ delete INTEL_I64_;
+ delete INTEL_U8_;
+ delete INTEL_U16_;
+ delete INTEL_U32_;
+ delete INTEL_U64_;
+ delete INTEL_B8_;
+ delete INTEL_B16_;
+ delete INTEL_B32_;
+ delete INTEL_B64_;
+ delete INTEL_F32_;
+ delete INTEL_F64_;
+
+ delete ALPHA_I8_;
+ delete ALPHA_I16_;
+ delete ALPHA_I32_;
+ delete ALPHA_I64_;
+ delete ALPHA_U8_;
+ delete ALPHA_U16_;
+ delete ALPHA_U32_;
+ delete ALPHA_U64_;
+ delete ALPHA_B8_;
+ delete ALPHA_B16_;
+ delete ALPHA_B32_;
+ delete ALPHA_B64_;
+ delete ALPHA_F32_;
+ delete ALPHA_F64_;
+
+ delete MIPS_I8_;
+ delete MIPS_I16_;
+ delete MIPS_I32_;
+ delete MIPS_I64_;
+ delete MIPS_U8_;
+ delete MIPS_U16_;
+ delete MIPS_U32_;
+ delete MIPS_U64_;
+ delete MIPS_B8_;
+ delete MIPS_B16_;
+ delete MIPS_B32_;
+ delete MIPS_B64_;
+ delete MIPS_F32_;
+ delete MIPS_F64_;
+
+ delete NATIVE_CHAR_;
+ delete NATIVE_SCHAR_;
+ delete NATIVE_UCHAR_;
+ delete NATIVE_SHORT_;
+ delete NATIVE_USHORT_;
+ delete NATIVE_INT_;
+ delete NATIVE_UINT_;
+ delete NATIVE_LONG_;
+ delete NATIVE_ULONG_;
+ delete NATIVE_LLONG_;
+ delete NATIVE_ULLONG_;
+ delete NATIVE_FLOAT_;
+ delete NATIVE_DOUBLE_;
+ delete NATIVE_LDOUBLE_;
+ delete NATIVE_B8_;
+ delete NATIVE_B16_;
+ delete NATIVE_B32_;
+ delete NATIVE_B64_;
+ delete NATIVE_OPAQUE_;
+ delete NATIVE_HSIZE_;
+ delete NATIVE_HSSIZE_;
+ delete NATIVE_HERR_;
+ delete NATIVE_HBOOL_;
+
+ delete NATIVE_INT8_;
+ delete NATIVE_UINT8_;
+ delete NATIVE_INT16_;
+ delete NATIVE_UINT16_;
+ delete NATIVE_INT32_;
+ delete NATIVE_UINT32_;
+ delete NATIVE_INT64_;
+ delete NATIVE_UINT64_;
+
+// LEAST types
+#if H5_SIZEOF_INT_LEAST8_T != 0
+ delete NATIVE_INT_LEAST8_;
+#endif /* H5_SIZEOF_INT_LEAST8_T */
+#if H5_SIZEOF_UINT_LEAST8_T != 0
+ delete NATIVE_UINT_LEAST8_;
+#endif /* H5_SIZEOF_UINT_LEAST8_T */
+
+#if H5_SIZEOF_INT_LEAST16_T != 0
+ delete NATIVE_INT_LEAST16_;
+#endif /* H5_SIZEOF_INT_LEAST16_T */
+#if H5_SIZEOF_UINT_LEAST16_T != 0
+ delete NATIVE_UINT_LEAST16_;
+#endif /* H5_SIZEOF_UINT_LEAST16_T */
+
+#if H5_SIZEOF_INT_LEAST32_T != 0
+ delete NATIVE_INT_LEAST32_;
+#endif /* H5_SIZEOF_INT_LEAST32_T */
+#if H5_SIZEOF_UINT_LEAST32_T != 0
+ delete NATIVE_UINT_LEAST32_;
+#endif /* H5_SIZEOF_UINT_LEAST32_T */
+
+#if H5_SIZEOF_INT_LEAST64_T != 0
+ delete NATIVE_INT_LEAST64_;
+#endif /* H5_SIZEOF_INT_LEAST64_T */
+#if H5_SIZEOF_UINT_LEAST64_T != 0
+ delete NATIVE_UINT_LEAST64_;
+#endif /* H5_SIZEOF_UINT_LEAST64_T */
+
+// FAST types
+#if H5_SIZEOF_INT_FAST8_T != 0
+ delete NATIVE_INT_FAST8_;
+#endif /* H5_SIZEOF_INT_FAST8_T */
+#if H5_SIZEOF_UINT_FAST8_T != 0
+ delete NATIVE_UINT_FAST8_;
+#endif /* H5_SIZEOF_UINT_FAST8_T */
+
+#if H5_SIZEOF_INT_FAST16_T != 0
+ delete NATIVE_INT_FAST16_;
+#endif /* H5_SIZEOF_INT_FAST16_T */
+#if H5_SIZEOF_UINT_FAST16_T != 0
+ delete NATIVE_UINT_FAST16_;
+#endif /* H5_SIZEOF_UINT_FAST16_T */
+
+#if H5_SIZEOF_INT_FAST32_T != 0
+ delete NATIVE_INT_FAST32_;
+#endif /* H5_SIZEOF_INT_FAST32_T */
+#if H5_SIZEOF_UINT_FAST32_T != 0
+ delete NATIVE_UINT_FAST32_;
+#endif /* H5_SIZEOF_UINT_FAST32_T */
+
+#if H5_SIZEOF_INT_FAST64_T != 0
+ delete NATIVE_INT_FAST64_;
+#endif /* H5_SIZEOF_INT_FAST64_T */
+#if H5_SIZEOF_UINT_FAST64_T != 0
+ delete NATIVE_UINT_FAST64_;
+#endif /* H5_SIZEOF_UINT_FAST64_T */
+
+ delete PREDTYPE_CONST_;
+ PREDTYPE_CONST_ = 0;
+} // deleteConstants
+
+// Assigning the constant references to the dynamically allocated constants
+// after using PREDTYPE_CONST to activate the creation of those constants.
+
+// PREDTYPE_CONST will be the first static constant declared in the file.
+// getPredTypes() will call makePredTypes() to allocate memory for all the
+// PredType constants. Note that, there is a similar function to getPredTypes()
+// in other classes, that have global constants, is called getConstant().
+
+const PredType& PredType::PREDTYPE_CONST = *PredType::getPredTypes();
+const PredType& PredType::STD_I8BE = *STD_I8BE_;
+const PredType& PredType::STD_I8LE = *STD_I8LE_;
+const PredType& PredType::STD_I16BE = *STD_I16BE_;
+const PredType& PredType::STD_I16LE = *STD_I16LE_;
+const PredType& PredType::STD_I32BE = *STD_I32BE_;
+const PredType& PredType::STD_I32LE = *STD_I32LE_;
+const PredType& PredType::STD_I64BE = *STD_I64BE_;
+const PredType& PredType::STD_I64LE = *STD_I64LE_;
+const PredType& PredType::STD_U8BE = *STD_U8BE_;
+const PredType& PredType::STD_U8LE = *STD_U8LE_;
+const PredType& PredType::STD_U16BE = *STD_U16BE_;
+const PredType& PredType::STD_U16LE = *STD_U16LE_;
+const PredType& PredType::STD_U32BE = *STD_U32BE_;
+const PredType& PredType::STD_U32LE = *STD_U32LE_;
+const PredType& PredType::STD_U64BE = *STD_U64BE_;
+const PredType& PredType::STD_U64LE = *STD_U64LE_;
+const PredType& PredType::STD_B8BE = *STD_B8BE_;
+const PredType& PredType::STD_B8LE = *STD_B8LE_;
+const PredType& PredType::STD_B16BE = *STD_B16BE_;
+const PredType& PredType::STD_B16LE = *STD_B16LE_;
+const PredType& PredType::STD_B32BE = *STD_B32BE_;
+const PredType& PredType::STD_B32LE = *STD_B32LE_;
+const PredType& PredType::STD_B64BE = *STD_B64BE_;
+const PredType& PredType::STD_B64LE = *STD_B64LE_;
+const PredType& PredType::STD_REF_OBJ = *STD_REF_OBJ_;
+const PredType& PredType::STD_REF_DSETREG = *STD_REF_DSETREG_;
+
+const PredType& PredType::C_S1 = *C_S1_;
+const PredType& PredType::FORTRAN_S1 = *FORTRAN_S1_;
+
+const PredType& PredType::IEEE_F32BE = *IEEE_F32BE_;
+const PredType& PredType::IEEE_F32LE = *IEEE_F32LE_;
+const PredType& PredType::IEEE_F64BE = *IEEE_F64BE_;
+const PredType& PredType::IEEE_F64LE = *IEEE_F64LE_;
+
+const PredType& PredType::UNIX_D32BE = *UNIX_D32BE_;
+const PredType& PredType::UNIX_D32LE = *UNIX_D32LE_;
+const PredType& PredType::UNIX_D64BE = *UNIX_D64BE_;
+const PredType& PredType::UNIX_D64LE = *UNIX_D64LE_;
+
+const PredType& PredType::INTEL_I8 = *INTEL_I8_;
+const PredType& PredType::INTEL_I16 = *INTEL_I16_;
+const PredType& PredType::INTEL_I32 = *INTEL_I32_;
+const PredType& PredType::INTEL_I64 = *INTEL_I64_;
+const PredType& PredType::INTEL_U8 = *INTEL_U8_;
+const PredType& PredType::INTEL_U16 = *INTEL_U16_;
+const PredType& PredType::INTEL_U32 = *INTEL_U32_;
+const PredType& PredType::INTEL_U64 = *INTEL_U64_;
+const PredType& PredType::INTEL_B8 = *INTEL_B8_;
+const PredType& PredType::INTEL_B16 = *INTEL_B16_;
+const PredType& PredType::INTEL_B32 = *INTEL_B32_;
+const PredType& PredType::INTEL_B64 = *INTEL_B64_;
+const PredType& PredType::INTEL_F32 = *INTEL_F32_;
+const PredType& PredType::INTEL_F64 = *INTEL_F64_;
+
+const PredType& PredType::ALPHA_I8 = *ALPHA_I8_;
+const PredType& PredType::ALPHA_I16 = *ALPHA_I16_;
+const PredType& PredType::ALPHA_I32 = *ALPHA_I32_;
+const PredType& PredType::ALPHA_I64 = *ALPHA_I64_;
+const PredType& PredType::ALPHA_U8 = *ALPHA_U8_;
+const PredType& PredType::ALPHA_U16 = *ALPHA_U16_;
+const PredType& PredType::ALPHA_U32 = *ALPHA_U32_;
+const PredType& PredType::ALPHA_U64 = *ALPHA_U64_;
+const PredType& PredType::ALPHA_B8 = *ALPHA_B8_;
+const PredType& PredType::ALPHA_B16 = *ALPHA_B16_;
+const PredType& PredType::ALPHA_B32 = *ALPHA_B32_;
+const PredType& PredType::ALPHA_B64 = *ALPHA_B64_;
+const PredType& PredType::ALPHA_F32 = *ALPHA_F32_;
+const PredType& PredType::ALPHA_F64 = *ALPHA_F64_;
+
+const PredType& PredType::MIPS_I8 = *MIPS_I8_;
+const PredType& PredType::MIPS_I16 = *MIPS_I16_;
+const PredType& PredType::MIPS_I32 = *MIPS_I32_;
+const PredType& PredType::MIPS_I64 = *MIPS_I64_;
+const PredType& PredType::MIPS_U8 = *MIPS_U8_;
+const PredType& PredType::MIPS_U16 = *MIPS_U16_;
+const PredType& PredType::MIPS_U32 = *MIPS_U32_;
+const PredType& PredType::MIPS_U64 = *MIPS_U64_;
+const PredType& PredType::MIPS_B8 = *MIPS_B8_;
+const PredType& PredType::MIPS_B16 = *MIPS_B16_;
+const PredType& PredType::MIPS_B32 = *MIPS_B32_;
+const PredType& PredType::MIPS_B64 = *MIPS_B64_;
+const PredType& PredType::MIPS_F32 = *MIPS_F32_;
+const PredType& PredType::MIPS_F64 = *MIPS_F64_;
+
+const PredType& PredType::NATIVE_CHAR = *NATIVE_CHAR_;
+const PredType& PredType::NATIVE_SCHAR = *NATIVE_SCHAR_;
+const PredType& PredType::NATIVE_UCHAR = *NATIVE_UCHAR_;
+const PredType& PredType::NATIVE_SHORT = *NATIVE_SHORT_;
+const PredType& PredType::NATIVE_USHORT = *NATIVE_USHORT_;
+const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
+const PredType& PredType::NATIVE_UINT = *NATIVE_UINT_;
+const PredType& PredType::NATIVE_LONG = *NATIVE_LONG_;
+const PredType& PredType::NATIVE_ULONG = *NATIVE_ULONG_;
+const PredType& PredType::NATIVE_LLONG = *NATIVE_LLONG_;
+const PredType& PredType::NATIVE_ULLONG = *NATIVE_ULLONG_;
+const PredType& PredType::NATIVE_FLOAT = *NATIVE_FLOAT_;
+const PredType& PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_;
+const PredType& PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_;
+const PredType& PredType::NATIVE_B8 = *NATIVE_B8_;
+const PredType& PredType::NATIVE_B16 = *NATIVE_B16_;
+const PredType& PredType::NATIVE_B32 = *NATIVE_B32_;
+const PredType& PredType::NATIVE_B64 = *NATIVE_B64_;
+const PredType& PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_;
+const PredType& PredType::NATIVE_HSIZE = *NATIVE_HSIZE_;
+const PredType& PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_;
+const PredType& PredType::NATIVE_HERR = *NATIVE_HERR_;
+const PredType& PredType::NATIVE_HBOOL = *NATIVE_HBOOL_;
+
+const PredType& PredType::NATIVE_INT8 = *NATIVE_INT8_;
+const PredType& PredType::NATIVE_UINT8 = *NATIVE_UINT8_;
+const PredType& PredType::NATIVE_INT16 = *NATIVE_INT16_;
+const PredType& PredType::NATIVE_UINT16 = *NATIVE_UINT16_;
+const PredType& PredType::NATIVE_INT32 = *NATIVE_INT32_;
+const PredType& PredType::NATIVE_UINT32 = *NATIVE_UINT32_;
+const PredType& PredType::NATIVE_INT64 = *NATIVE_INT64_;
+const PredType& PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
+
+// LEAST types
+#if H5_SIZEOF_INT_LEAST8_T != 0
+const PredType& PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
+#endif /* H5_SIZEOF_INT_LEAST8_T */
+#if H5_SIZEOF_UINT_LEAST8_T != 0
+const PredType& PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
+#endif /* H5_SIZEOF_UINT_LEAST8_T */
+
+#if H5_SIZEOF_INT_LEAST16_T != 0
+const PredType& PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
+#endif /* H5_SIZEOF_INT_LEAST16_T */
+#if H5_SIZEOF_UINT_LEAST16_T != 0
+const PredType& PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
+#endif /* H5_SIZEOF_UINT_LEAST16_T */
+
+#if H5_SIZEOF_INT_LEAST32_T != 0
+const PredType& PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
+#endif /* H5_SIZEOF_INT_LEAST32_T */
+#if H5_SIZEOF_UINT_LEAST32_T != 0
+const PredType& PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
+#endif /* H5_SIZEOF_UINT_LEAST32_T */
+
+#if H5_SIZEOF_INT_LEAST64_T != 0
+const PredType& PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
+#endif /* H5_SIZEOF_INT_LEAST64_T */
+#if H5_SIZEOF_UINT_LEAST64_T != 0
+const PredType& PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
+#endif /* H5_SIZEOF_UINT_LEAST64_T */
+
+// FAST types
+#if H5_SIZEOF_INT_FAST8_T != 0
+const PredType& PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
+#endif /* H5_SIZEOF_INT_FAST8_T */
+#if H5_SIZEOF_UINT_FAST8_T != 0
+const PredType& PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
+#endif /* H5_SIZEOF_UINT_FAST8_T */
+
+#if H5_SIZEOF_INT_FAST16_T != 0
+const PredType& PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
+#endif /* H5_SIZEOF_INT_FAST16_T */
+#if H5_SIZEOF_UINT_FAST16_T != 0
+const PredType& PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
+#endif /* H5_SIZEOF_UINT_FAST16_T */
+
+#if H5_SIZEOF_INT_FAST32_T != 0
+const PredType& PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
+#endif /* H5_SIZEOF_INT_FAST32_T */
+#if H5_SIZEOF_UINT_FAST32_T != 0
+const PredType& PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
+#endif /* H5_SIZEOF_UINT_FAST32_T */
+
+#if H5_SIZEOF_INT_FAST64_T != 0
+const PredType& PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
+#endif /* H5_SIZEOF_INT_FAST64_T */
+#if H5_SIZEOF_UINT_FAST64_T != 0
+const PredType& PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
+#endif /* H5_SIZEOF_UINT_FAST64_T */
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif
+
+/***************************************************************************
+ Design Note
+ ===========
+
+September 2015:
+
+ The C++ library has several types of global constants from different
+ classes, such as PropList, PredType, DataSpace, etc... Previously,
+ these global constants were declared statically and the C++ library used
+ a constant, called PredType::AtExit, to detect when all the global
+ contants are destroyed then close the C library (H5close). This method
+ relied on the order of the constants being created and destroyed and
+ that PredType constants be the last to be destroyed. In September
+ 2015, it was recognized that the order in which the global constants were
+ created and destroyed was actually undefined, thus can be different
+ between different compilers. This resulted in failure when compilers
+ destroy PredType constants before others because when PredType::AtExit
+ was destroyed, the C library was closed, so when the constants of other
+ classes such as PropList or DataSpace were being deleted, the C library
+ would not be available.
+
+ These are the classes that have global constants:
+ + PredType
+ + DataSpace
+ + PropList (and its subclasses below)
+ + FileAccPropList
+ + FileCreatPropList
+ + DSetMemXferPropList
+ + DSetCreatPropList
+
+
+ The new method includes these main points:
+
+ - The C++ library uses dynamically allocated constants to have the
+ control in which order the global constants are created/destroyed.
+
+ - The previous static constants are changed to be the references to
+ the dynamically allocated constants to avoid impact on applications.
+
+ - The first time an IdComponent default constructor is invoked, it
+ will call the function H5Library::initH5cpp which registers the
+ terminating functions from each class that has the global constants
+ so that these functions can destroy those constants at the exit of the
+ application. IdComponent is a baseclass of any object class that has
+ an identifier, such as Group, DataSet, DataType,... The classes which
+ have the global constants are all derived from IdComponent.
+
+ - At the normal termination of the application, each registered function
+ for each constant type will delete all the allocated constants in
+ that type class, then a different terminating function, which was also
+ registered with atexit() by initH5cpp, will call H5close to close the
+ C library.
+
+ The following list presents the differences between the old and new
+ methods and the changes implemented for the new method.
+
+ 1. The following items are added to class H5Library:
+ // Private instance to be created by H5Library only
+ static H5Library* instance;
+
+ // Returns a singleton H5Library to initialize the global
+ // constants, invoked in IdComponent default constructor
+ static H5Library* getInstance(); // public
+
+ // Registers cleanup and terminating functions with atexit(),
+ // called in IdComponent default constructor
+ static void initH5cpp(void); // public
+
+ // Calls H5close to terminate the library, registered with
+ // atexit(), as the last thing to be done.
+ static void termH5cpp(void); // public
+
+ 2. The following shows the differences between the old and new methods
+ for allocating the PredType constants. There are more than 100
+ constants, but only one is shown here for examples.
+
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5PredType.h"
+ static const PredType NATIVE_INT;
+
+ // Definition of the constant - in "H5PredType.cpp"
+ const PredType PredType::NATIVE_INT(H5T_NATIVE_INT);
+
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5PredType.h"
+ static PredType* NATIVE_INT_; // "H5PredType.h"
+
+ // Change previous constant to reference - in "H5PredType.h"
+ static const PredType& NATIVE_INT;
+
+ // The assignment of the first static constant, named
+ // PREDTYPE_CONST, calls makePredTypes() which allocates the
+ // dynamic memory for every PredType constant.
+
+ // Creates a dynamic PredType object representing a C constant
+ // - in makePredTypes()
+ NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
+
+ // Assign the constant reference to the dynamic object
+ // - in "H5PredType.cpp"
+ const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
+
+ Functions added to class PredType:
+
+ // Creates the constants
+ static void makePredTypes(); // private
+
+ // Calls makePredTypes to create the constants and returns
+ // the dummy constant PREDTYPE_CONST;
+ static PredType* getPredTypes(); // private
+
+ // Deletes the constants
+ static void deleteConstants(); // public
+
+ 3. This section shows the differences between the old and new methods
+ for allocating the DataSpace constant, DataSpace::ALL.
+
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5DataSpace.h"
+ static const DataSpace ALL;
+
+ // Definition of the constant - in "H5DataSpace.cpp"
+ const DataSpace DataSpace::ALL(H5S_ALL);
+
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5DataSpace.h"
+ static DataSpace* ALL_; // "H5DataSpace.h"
+
+ // Change previous constant to reference - in "H5DataSpace.h"
+ static const DataSpace& ALL;
+
+ // Creates a dynamic DataSpace object representing the C constant
+ // - in "H5DataSpace.cpp"
+ ALL_ = new DataSpace(H5S_ALL);
+
+ // Assign the constant reference to the dynamic object
+ // - in "H5DataSpace.cpp"
+ const DataSpace& DataSpace::ALL = *ALL_;
+
+ Functions added to class DataSpace:
+
+ // Creates the constant
+ static DataSpace* getConstant(); // private
+
+ // Deletes the constant
+ static void deleteConstants(); // public
+
+ 4. This section shows the differences between the old and new methods
+ for allocating the following constants
+ - PropList constant, PropList::DEFAULT.
+ - DSetCreatPropList constant, DSetCreatPropList::DEFAULT.
+ - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT.
+ - FileCreatPropList constant, FileCreatPropList::DEFAULT.
+ - FileAccPropList constant, FileAccPropList::DEFAULT.
+
+ For these constants, the library has the same changes, except the
+ class names and the HDF5 corresponding constants. Only the items
+ of PropList are listed, and "PropList" can be replaced by any of
+ DSetCreatPropList, DSetMemXferPropList, FileCreatPropList,
+ FileAccPropList for those classes. The HDF5 C constant "H5P_DEFAULT"
+ can be replaced by any of these respectively: H5P_DATASET_CREATE,
+ H5P_DATASET_XFER, H5P_FILE_CREATE, and H5P_FILE_ACCESS.
+
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5PropList.h"
+ static const PropList DEFAULT;
+
+ // Definition of the constant - in "H5PropList.cpp"
+ const PropList PropList::DEFAULT(H5P_DEFAULT);
+
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5PropList.h"
+ static PropList* DEFAULT_; // "H5PropList.h"
+
+ // Change previous constant to reference - in "H5PropList.h"
+ static const PropList& DEFAULT;
+
+ // Creates a dynamic PropList object representing the C constant
+ // - in "H5PropList.cpp"
+ DEFAULT_ = new PropList(H5P_DEFAULT);
+
+ // Assign the constant reference to the dynamic object
+ // - in "H5PropList.cpp"
+ const PropList& PropList::DEFAULT = *DEFAULT_;
+
+ Functions added to class PropList:
+
+ // Creates the constant
+ static PropList* getConstant(); // private
+
+ // Deletes the constants
+ static void deleteConstants(); // public
+
+ The same functions are added to the subclasses of PropList instead of
+ using PropList's because of the class types and in favor of clarity.
+
+****************************************************************************/
+
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index 494b169..f560765 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -21,16 +21,6 @@
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 */
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-#define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
/*! \class PredType
\brief Class PredType holds the definition of all the HDF5 predefined
datatypes.
@@ -53,211 +43,400 @@ class H5_DLLCPP PredType : public AtomType {
// Noop destructor
virtual ~PredType();
- // Declaration of predefined types; their definition is in H5PredType.cpp
- static const PredType STD_I8BE;
- static const PredType STD_I8LE;
- static const PredType STD_I16BE;
- static const PredType STD_I16LE;
- static const PredType STD_I32BE;
- static const PredType STD_I32LE;
- static const PredType STD_I64BE;
- static const PredType STD_I64LE;
- static const PredType STD_U8BE;
- static const PredType STD_U8LE;
- static const PredType STD_U16BE;
- static const PredType STD_U16LE;
- static const PredType STD_U32BE;
- static const PredType STD_U32LE;
- static const PredType STD_U64BE;
- static const PredType STD_U64LE;
- static const PredType STD_B8BE;
- static const PredType STD_B8LE;
- static const PredType STD_B16BE;
- static const PredType STD_B16LE;
- static const PredType STD_B32BE;
- static const PredType STD_B32LE;
- static const PredType STD_B64BE;
- static const PredType STD_B64LE;
- static const PredType STD_REF_OBJ;
- static const PredType STD_REF_DSETREG;
-
- static const PredType C_S1;
- static const PredType FORTRAN_S1;
-
- static const PredType IEEE_F32BE;
- static const PredType IEEE_F32LE;
- static const PredType IEEE_F64BE;
- static const PredType IEEE_F64LE;
-
- static const PredType UNIX_D32BE;
- static const PredType UNIX_D32LE;
- static const PredType UNIX_D64BE;
- static const PredType UNIX_D64LE;
-
- static const PredType INTEL_I8;
- static const PredType INTEL_I16;
- static const PredType INTEL_I32;
- static const PredType INTEL_I64;
- static const PredType INTEL_U8;
- static const PredType INTEL_U16;
- static const PredType INTEL_U32;
- static const PredType INTEL_U64;
- static const PredType INTEL_B8;
- static const PredType INTEL_B16;
- static const PredType INTEL_B32;
- static const PredType INTEL_B64;
- static const PredType INTEL_F32;
- static const PredType INTEL_F64;
-
- static const PredType ALPHA_I8;
- static const PredType ALPHA_I16;
- static const PredType ALPHA_I32;
- static const PredType ALPHA_I64;
- static const PredType ALPHA_U8;
- static const PredType ALPHA_U16;
- static const PredType ALPHA_U32;
- static const PredType ALPHA_U64;
- static const PredType ALPHA_B8;
- static const PredType ALPHA_B16;
- static const PredType ALPHA_B32;
- static const PredType ALPHA_B64;
- static const PredType ALPHA_F32;
- static const PredType ALPHA_F64;
-
- static const PredType MIPS_I8;
- static const PredType MIPS_I16;
- static const PredType MIPS_I32;
- static const PredType MIPS_I64;
- static const PredType MIPS_U8;
- static const PredType MIPS_U16;
- static const PredType MIPS_U32;
- static const PredType MIPS_U64;
- static const PredType MIPS_B8;
- static const PredType MIPS_B16;
- static const PredType MIPS_B32;
- static const PredType MIPS_B64;
- static const PredType MIPS_F32;
- static const PredType MIPS_F64;
-
- static const PredType NATIVE_CHAR;
- static const PredType NATIVE_SCHAR;
- static const PredType NATIVE_UCHAR;
- static const PredType NATIVE_SHORT;
- static const PredType NATIVE_USHORT;
- static const PredType NATIVE_INT;
- static const PredType NATIVE_UINT;
- static const PredType NATIVE_LONG;
- static const PredType NATIVE_ULONG;
- static const PredType NATIVE_LLONG;
- static const PredType NATIVE_ULLONG;
- static const PredType NATIVE_FLOAT;
- static const PredType NATIVE_DOUBLE;
- static const PredType NATIVE_LDOUBLE;
- static const PredType NATIVE_B8;
- static const PredType NATIVE_B16;
- static const PredType NATIVE_B32;
- static const PredType NATIVE_B64;
- static const PredType NATIVE_OPAQUE;
- static const PredType NATIVE_HSIZE;
- static const PredType NATIVE_HSSIZE;
- static const PredType NATIVE_HERR;
- static const PredType NATIVE_HBOOL;
-
- static const PredType NATIVE_INT8;
- static const PredType NATIVE_UINT8;
- static const PredType NATIVE_INT16;
- static const PredType NATIVE_UINT16;
- static const PredType NATIVE_INT32;
- static const PredType NATIVE_UINT32;
- static const PredType NATIVE_INT64;
- static const PredType NATIVE_UINT64;
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location& loc, const H5std_string& name );
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location& loc, const char* name );
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ bool committed();
+
+ ///\brief PredType constants
+ static const PredType& STD_I8BE;
+ static const PredType& STD_I8LE;
+ static const PredType& STD_I16BE;
+ static const PredType& STD_I16LE;
+ static const PredType& STD_I32BE;
+ static const PredType& STD_I32LE;
+ static const PredType& STD_I64BE;
+ static const PredType& STD_I64LE;
+ static const PredType& STD_U8BE;
+ static const PredType& STD_U8LE;
+ static const PredType& STD_U16BE;
+ static const PredType& STD_U16LE;
+ static const PredType& STD_U32BE;
+ static const PredType& STD_U32LE;
+ static const PredType& STD_U64BE;
+ static const PredType& STD_U64LE;
+ static const PredType& STD_B8BE;
+ static const PredType& STD_B8LE;
+ static const PredType& STD_B16BE;
+ static const PredType& STD_B16LE;
+ static const PredType& STD_B32BE;
+ static const PredType& STD_B32LE;
+ static const PredType& STD_B64BE;
+ static const PredType& STD_B64LE;
+ static const PredType& STD_REF_OBJ;
+ static const PredType& STD_REF_DSETREG;
+
+ static const PredType& C_S1;
+ static const PredType& FORTRAN_S1;
+
+ static const PredType& IEEE_F32BE;
+ static const PredType& IEEE_F32LE;
+ static const PredType& IEEE_F64BE;
+ static const PredType& IEEE_F64LE;
+
+ static const PredType& UNIX_D32BE;
+ static const PredType& UNIX_D32LE;
+ static const PredType& UNIX_D64BE;
+ static const PredType& UNIX_D64LE;
+
+ static const PredType& INTEL_I8;
+ static const PredType& INTEL_I16;
+ static const PredType& INTEL_I32;
+ static const PredType& INTEL_I64;
+ static const PredType& INTEL_U8;
+ static const PredType& INTEL_U16;
+ static const PredType& INTEL_U32;
+ static const PredType& INTEL_U64;
+ static const PredType& INTEL_B8;
+ static const PredType& INTEL_B16;
+ static const PredType& INTEL_B32;
+ static const PredType& INTEL_B64;
+ static const PredType& INTEL_F32;
+ static const PredType& INTEL_F64;
+
+ static const PredType& ALPHA_I8;
+ static const PredType& ALPHA_I16;
+ static const PredType& ALPHA_I32;
+ static const PredType& ALPHA_I64;
+ static const PredType& ALPHA_U8;
+ static const PredType& ALPHA_U16;
+ static const PredType& ALPHA_U32;
+ static const PredType& ALPHA_U64;
+ static const PredType& ALPHA_B8;
+ static const PredType& ALPHA_B16;
+ static const PredType& ALPHA_B32;
+ static const PredType& ALPHA_B64;
+ static const PredType& ALPHA_F32;
+ static const PredType& ALPHA_F64;
+
+ static const PredType& MIPS_I8;
+ static const PredType& MIPS_I16;
+ static const PredType& MIPS_I32;
+ static const PredType& MIPS_I64;
+ static const PredType& MIPS_U8;
+ static const PredType& MIPS_U16;
+ static const PredType& MIPS_U32;
+ static const PredType& MIPS_U64;
+ static const PredType& MIPS_B8;
+ static const PredType& MIPS_B16;
+ static const PredType& MIPS_B32;
+ static const PredType& MIPS_B64;
+ static const PredType& MIPS_F32;
+ static const PredType& MIPS_F64;
+
+ static const PredType& NATIVE_CHAR;
+ static const PredType& NATIVE_SCHAR;
+ static const PredType& NATIVE_UCHAR;
+ static const PredType& NATIVE_SHORT;
+ static const PredType& NATIVE_USHORT;
+ static const PredType& NATIVE_INT;
+ static const PredType& NATIVE_UINT;
+ static const PredType& NATIVE_LONG;
+ static const PredType& NATIVE_ULONG;
+ static const PredType& NATIVE_LLONG;
+ static const PredType& NATIVE_ULLONG;
+ static const PredType& NATIVE_FLOAT;
+ static const PredType& NATIVE_DOUBLE;
+ static const PredType& NATIVE_LDOUBLE;
+ static const PredType& NATIVE_B8;
+ static const PredType& NATIVE_B16;
+ static const PredType& NATIVE_B32;
+ static const PredType& NATIVE_B64;
+ static const PredType& NATIVE_OPAQUE;
+ static const PredType& NATIVE_HSIZE;
+ static const PredType& NATIVE_HSSIZE;
+ static const PredType& NATIVE_HERR;
+ static const PredType& NATIVE_HBOOL;
+
+ static const PredType& NATIVE_INT8;
+ static const PredType& NATIVE_UINT8;
+ static const PredType& NATIVE_INT16;
+ static const PredType& NATIVE_UINT16;
+ static const PredType& NATIVE_INT32;
+ static const PredType& NATIVE_UINT32;
+ static const PredType& NATIVE_INT64;
+ static const PredType& NATIVE_UINT64;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static const PredType NATIVE_INT_LEAST8;
+ static const PredType& NATIVE_INT_LEAST8;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static const PredType NATIVE_UINT_LEAST8;
+ static const PredType& NATIVE_UINT_LEAST8;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static const PredType NATIVE_INT_LEAST16;
+ static const PredType& NATIVE_INT_LEAST16;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static const PredType NATIVE_UINT_LEAST16;
+ static const PredType& NATIVE_UINT_LEAST16;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static const PredType NATIVE_INT_LEAST32;
+ static const PredType& NATIVE_INT_LEAST32;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static const PredType NATIVE_UINT_LEAST32;
+ static const PredType& NATIVE_UINT_LEAST32;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static const PredType NATIVE_INT_LEAST64;
+ static const PredType& NATIVE_INT_LEAST64;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static const PredType NATIVE_UINT_LEAST64;
+ static const PredType& NATIVE_UINT_LEAST64;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static const PredType NATIVE_INT_FAST8;
+ static const PredType& NATIVE_INT_FAST8;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static const PredType NATIVE_UINT_FAST8;
+ static const PredType& NATIVE_UINT_FAST8;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static const PredType NATIVE_INT_FAST16;
+ static const PredType& NATIVE_INT_FAST16;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static const PredType NATIVE_UINT_FAST16;
+ static const PredType& NATIVE_UINT_FAST16;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static const PredType NATIVE_INT_FAST32;
+ static const PredType& NATIVE_INT_FAST32;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static const PredType NATIVE_UINT_FAST32;
+ static const PredType& NATIVE_UINT_FAST32;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static const PredType NATIVE_INT_FAST64;
+ static const PredType& NATIVE_INT_FAST64;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static const PredType NATIVE_UINT_FAST64;
+ static const PredType& NATIVE_UINT_FAST64;
#endif /* H5_SIZEOF_UINT_FAST64_T */
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const H5std_string& name );
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const char* name );
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- bool committed();
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the PredType global constants
+ static void deleteConstants();
+
+ // Dummy constant
+ static const PredType& PREDTYPE_CONST; // dummy constant
protected:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Default constructor
PredType();
// Creates a pre-defined type using an HDF5 pre-defined constant
PredType( const hid_t predtype_id ); // used by the library only
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
private:
- // 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;
+ // Activates the creation of the PredType global constants
+ static PredType* getPredTypes();
+
+ // Dynamically allocates PredType global constants
+ static void makePredTypes();
+
+ // Dummy constant
+ static PredType* PREDTYPE_CONST_;
+
+ // Declaration of pointers to constants
+ static PredType* STD_I8BE_;
+ static PredType* STD_I8LE_;
+ static PredType* STD_I16BE_;
+ static PredType* STD_I16LE_;
+ static PredType* STD_I32BE_;
+ static PredType* STD_I32LE_;
+ static PredType* STD_I64BE_;
+ static PredType* STD_I64LE_;
+ static PredType* STD_U8BE_;
+ static PredType* STD_U8LE_;
+ static PredType* STD_U16BE_;
+ static PredType* STD_U16LE_;
+ static PredType* STD_U32BE_;
+ static PredType* STD_U32LE_;
+ static PredType* STD_U64BE_;
+ static PredType* STD_U64LE_;
+ static PredType* STD_B8BE_;
+ static PredType* STD_B8LE_;
+ static PredType* STD_B16BE_;
+ static PredType* STD_B16LE_;
+ static PredType* STD_B32BE_;
+ static PredType* STD_B32LE_;
+ static PredType* STD_B64BE_;
+ static PredType* STD_B64LE_;
+ static PredType* STD_REF_OBJ_;
+ static PredType* STD_REF_DSETREG_;
+
+ static PredType* C_S1_;
+ static PredType* FORTRAN_S1_;
+
+ static PredType* IEEE_F32BE_;
+ static PredType* IEEE_F32LE_;
+ static PredType* IEEE_F64BE_;
+ static PredType* IEEE_F64LE_;
+
+ static PredType* UNIX_D32BE_;
+ static PredType* UNIX_D32LE_;
+ static PredType* UNIX_D64BE_;
+ static PredType* UNIX_D64LE_;
+
+ static PredType* INTEL_I8_;
+ static PredType* INTEL_I16_;
+ static PredType* INTEL_I32_;
+ static PredType* INTEL_I64_;
+ static PredType* INTEL_U8_;
+ static PredType* INTEL_U16_;
+ static PredType* INTEL_U32_;
+ static PredType* INTEL_U64_;
+ static PredType* INTEL_B8_;
+ static PredType* INTEL_B16_;
+ static PredType* INTEL_B32_;
+ static PredType* INTEL_B64_;
+ static PredType* INTEL_F32_;
+ static PredType* INTEL_F64_;
+
+ static PredType* ALPHA_I8_;
+ static PredType* ALPHA_I16_;
+ static PredType* ALPHA_I32_;
+ static PredType* ALPHA_I64_;
+ static PredType* ALPHA_U8_;
+ static PredType* ALPHA_U16_;
+ static PredType* ALPHA_U32_;
+ static PredType* ALPHA_U64_;
+ static PredType* ALPHA_B8_;
+ static PredType* ALPHA_B16_;
+ static PredType* ALPHA_B32_;
+ static PredType* ALPHA_B64_;
+ static PredType* ALPHA_F32_;
+ static PredType* ALPHA_F64_;
+
+ static PredType* MIPS_I8_;
+ static PredType* MIPS_I16_;
+ static PredType* MIPS_I32_;
+ static PredType* MIPS_I64_;
+ static PredType* MIPS_U8_;
+ static PredType* MIPS_U16_;
+ static PredType* MIPS_U32_;
+ static PredType* MIPS_U64_;
+ static PredType* MIPS_B8_;
+ static PredType* MIPS_B16_;
+ static PredType* MIPS_B32_;
+ static PredType* MIPS_B64_;
+ static PredType* MIPS_F32_;
+ static PredType* MIPS_F64_;
+
+ static PredType* NATIVE_CHAR_;
+ static PredType* NATIVE_SCHAR_;
+ static PredType* NATIVE_UCHAR_;
+ static PredType* NATIVE_SHORT_;
+ static PredType* NATIVE_USHORT_;
+ static PredType* NATIVE_INT_;
+ static PredType* NATIVE_UINT_;
+ static PredType* NATIVE_LONG_;
+ static PredType* NATIVE_ULONG_;
+ static PredType* NATIVE_LLONG_;
+ static PredType* NATIVE_ULLONG_;
+ static PredType* NATIVE_FLOAT_;
+ static PredType* NATIVE_DOUBLE_;
+ static PredType* NATIVE_LDOUBLE_;
+ static PredType* NATIVE_B8_;
+ static PredType* NATIVE_B16_;
+ static PredType* NATIVE_B32_;
+ static PredType* NATIVE_B64_;
+ static PredType* NATIVE_OPAQUE_;
+ static PredType* NATIVE_HSIZE_;
+ static PredType* NATIVE_HSSIZE_;
+ static PredType* NATIVE_HERR_;
+ static PredType* NATIVE_HBOOL_;
+
+ static PredType* NATIVE_INT8_;
+ static PredType* NATIVE_UINT8_;
+ static PredType* NATIVE_INT16_;
+ static PredType* NATIVE_UINT16_;
+ static PredType* NATIVE_INT32_;
+ static PredType* NATIVE_UINT32_;
+ static PredType* NATIVE_INT64_;
+ static PredType* NATIVE_UINT64_;
+
+// LEAST types
+#if H5_SIZEOF_INT_LEAST8_T != 0
+ static PredType* NATIVE_INT_LEAST8_;
+#endif /* H5_SIZEOF_INT_LEAST8_T */
+#if H5_SIZEOF_UINT_LEAST8_T != 0
+ static PredType* NATIVE_UINT_LEAST8_;
+#endif /* H5_SIZEOF_UINT_LEAST8_T */
+
+#if H5_SIZEOF_INT_LEAST16_T != 0
+ static PredType* NATIVE_INT_LEAST16_;
+#endif /* H5_SIZEOF_INT_LEAST16_T */
+#if H5_SIZEOF_UINT_LEAST16_T != 0
+ static PredType* NATIVE_UINT_LEAST16_;
+#endif /* H5_SIZEOF_UINT_LEAST16_T */
+
+#if H5_SIZEOF_INT_LEAST32_T != 0
+ static PredType* NATIVE_INT_LEAST32_;
+#endif /* H5_SIZEOF_INT_LEAST32_T */
+#if H5_SIZEOF_UINT_LEAST32_T != 0
+ static PredType* NATIVE_UINT_LEAST32_;
+#endif /* H5_SIZEOF_UINT_LEAST32_T */
+
+#if H5_SIZEOF_INT_LEAST64_T != 0
+ static PredType* NATIVE_INT_LEAST64_;
+#endif /* H5_SIZEOF_INT_LEAST64_T */
+#if H5_SIZEOF_UINT_LEAST64_T != 0
+ static PredType* NATIVE_UINT_LEAST64_;
+#endif /* H5_SIZEOF_UINT_LEAST64_T */
+
+// FAST types
+#if H5_SIZEOF_INT_FAST8_T != 0
+ static PredType* NATIVE_INT_FAST8_;
+#endif /* H5_SIZEOF_INT_FAST8_T */
+#if H5_SIZEOF_UINT_FAST8_T != 0
+ static PredType* NATIVE_UINT_FAST8_;
+#endif /* H5_SIZEOF_UINT_FAST8_T */
+
+#if H5_SIZEOF_INT_FAST16_T != 0
+ static PredType* NATIVE_INT_FAST16_;
+#endif /* H5_SIZEOF_INT_FAST16_T */
+#if H5_SIZEOF_UINT_FAST16_T != 0
+ static PredType* NATIVE_UINT_FAST16_;
+#endif /* H5_SIZEOF_UINT_FAST16_T */
+
+#if H5_SIZEOF_INT_FAST32_T != 0
+ static PredType* NATIVE_INT_FAST32_;
+#endif /* H5_SIZEOF_INT_FAST32_T */
+#if H5_SIZEOF_UINT_FAST32_T != 0
+ static PredType* NATIVE_UINT_FAST32_;
+#endif /* H5_SIZEOF_UINT_FAST32_T */
+
+#if H5_SIZEOF_INT_FAST64_T != 0
+ static PredType* NATIVE_INT_FAST64_;
+#endif /* H5_SIZEOF_INT_FAST64_T */
+#if H5_SIZEOF_UINT_FAST64_T != 0
+ static PredType* NATIVE_UINT_FAST64_;
+#endif /* H5_SIZEOF_UINT_FAST64_T */
+ // End of Declaration of pointers
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 70ec629..807aa0a 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -36,10 +36,60 @@ namespace H5 {
#endif // H5_NO_STD
#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
+PropList* PropList::DEFAULT_ = 0;
+
//--------------------------------------------------------------------------
-///\brief Constant for default property.
+// Function: PropList::getConstant
+// Purpose: Creates a PropList object representing the HDF5 constant
+// H5P_DEFAULT, pointed to by PropList::DEFAULT_.
+// Exception H5::PropListIException
+// Description
+// If PropList::DEFAULT_ already points to an allocated object,
+// throw a PropListIException. This scenario should not happen.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const PropList PropList::DEFAULT;
+PropList* PropList::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 PropList(H5P_DEFAULT);
+ else
+ throw PropListIException("PropList::getConstant", "PropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: PropList::deleteConstants
+// Purpose: Deletes the constant object that PropList::DEFAULT_ points to.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void PropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose Constant for default property.
+//--------------------------------------------------------------------------
+const PropList& PropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function Default constructor
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index f26201d..be04451 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -24,8 +24,8 @@ namespace H5 {
//! Class PropList provides operations for generic property lists.
class H5_DLLCPP PropList : public IdComponent {
public:
- // Default property list
- static const PropList DEFAULT;
+ ///\brief Default property list
+ static const PropList& DEFAULT;
// Creates a property list of a given type or creates a copy of an
// existing property list giving the property list id.
@@ -110,12 +110,23 @@ class H5_DLLCPP PropList : public IdComponent {
// Destructor: properly terminates access to this property list.
virtual ~PropList();
- protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the PropList global constant
+ static void deleteConstants();
+
+ protected:
hid_t id; // HDF5 property list id
// Sets the property list id.
virtual void p_setId(const hid_t new_id);
+
+ private:
+ static PropList* DEFAULT_;
+
+ // Dynamically allocates the PropList global constant
+ static PropList* getConstant();
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 5195bba..b067746 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 3641a5d..2fab1f3 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -20,6 +20,7 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index cdef7bf..84af348 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -36,10 +36,10 @@ bin_SCRIPTS=h5c++
libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \
H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \
H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \
- H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \
- H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \
- H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
- H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
+ H5OcreatProp.cpp H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp \
+ H5AtomType.cpp H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
+ H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \
+ H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
libhdf5_cpp_la_LIBADD=$(LIBHDF5)
@@ -47,11 +47,11 @@ libhdf5_cpp_la_LIBADD=$(LIBHDF5)
# Public headers
include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
- H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
- H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \
- H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \
- H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \
- H5VarLenType.h
+ H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \
+ H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \
+ H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5Library.h \
+ H5Location.h H5Object.h H5PredType.h H5PropList.h H5StrType.h \
+ H5CppDoc.h H5ArrayType.h H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
# distclean.
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index c020531..7060fd2 100644
--- a/c++/src/cpp_doc_config
+++ b/c++/src/cpp_doc_config
@@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = "1.9.232 currently under development"
+PROJECT_NUMBER = "1.9.233 currently under development"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a