summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-10-04 07:33:40 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-10-04 07:33:40 (GMT)
commit914643490ab581c4b0bb78ca30a8e1fa520b4d6d (patch)
tree53436d1611395e02c652c7ac5c075898fc2ae261
parent0ee053bb95a620b6f8109d22a372f6acc1cee300 (diff)
parent888a002cddaa4e1d9a165ea01dfe62f399df9eb9 (diff)
downloadhdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.zip
hdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.tar.gz
hdf5-914643490ab581c4b0bb78ca30a8e1fa520b4d6d.tar.bz2
[svn-r27946] Brought VDS branch in sync with trunk (up to r27945).
Tested on Ubuntu 15.04 (Linux 3.19 x86_64), gcc 4.9.2, MPICH 3.1.4 and CMake 3.3.2. - Autotools serial w/ Fortran, C++ - Autotools parallel w/ Fortran - CMake serial w/ Fortran, C++
-rw-r--r--c++/src/H5Attribute.cpp1
-rw-r--r--c++/src/H5CommonFG.cpp5
-rw-r--r--c++/src/H5DataSpace.cpp54
-rw-r--r--c++/src/H5DataSpace.h20
-rw-r--r--c++/src/H5DataType.cpp18
-rw-r--r--c++/src/H5DcreatProp.cpp57
-rw-r--r--c++/src/H5DcreatProp.h17
-rw-r--r--c++/src/H5DxferProp.cpp65
-rw-r--r--c++/src/H5DxferProp.h16
-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/H5IdComponent.cpp33
-rw-r--r--c++/src/H5IdComponent.h6
-rw-r--r--c++/src/H5Library.cpp118
-rw-r--r--c++/src/H5Library.h35
-rw-r--r--c++/src/H5Location.cpp7
-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--config/cmake_ext_mod/runTest.cmake50
-rw-r--r--hl/src/CMakeLists.txt6
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/H5A.c24
-rw-r--r--src/H5Aint.c58
-rw-r--r--src/H5Apkg.h2
-rw-r--r--src/H5Aprivate.h3
-rw-r--r--src/H5D.c22
-rw-r--r--src/H5Dchunk.c36
-rw-r--r--src/H5Dint.c48
-rw-r--r--src/H5Dpkg.h2
-rw-r--r--src/H5Sprivate.h28
-rw-r--r--src/H5Sselect.c30
-rw-r--r--test/CMakeTests.cmake2
36 files changed, 2080 insertions, 574 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 0bfdff8..cb09980 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -45,6 +45,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..5f43533 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"
@@ -1268,7 +1267,7 @@ CommonFG::~CommonFG() {}
//--------------------------------------------------------------------------
void f_DataType_setId(DataType* dtype, hid_t new_id)
{
- dtype->id = new_id;
+ dtype->p_setId(new_id);
}
//--------------------------------------------------------------------------
@@ -1283,7 +1282,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/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..02d3eda 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -760,23 +760,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..5ee212a 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -28,10 +28,63 @@
namespace H5 {
#endif
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
+// the order of creation and deletion of the global constants. See Design Notes
+// in "H5PredType.cpp" for information.
+
+// Initialize a pointer for the constant
+DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: DSetCreatPropList::getConstant
+// Purpose: Creates a DSetCreatPropList object representing the HDF5
+// constant H5P_DATASET_CREATE, pointed to by
+// DSetCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If DSetCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should
+// not happen.
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+DSetCreatPropList* DSetCreatPropList::getConstant()
+{
+ // Tell the C library not to clean up, H5Library::termH5cpp will call
+ // H5close - more dependency if use H5Library::dontAtExit()
+ if (!IdComponent::H5dontAtexit_called)
+ {
+ (void) H5dont_atexit();
+ IdComponent::H5dontAtexit_called = true;
+ }
+
+ // If the constant pointer is not allocated, allocate it. Otherwise,
+ // throw because it shouldn't be.
+ if (DEFAULT_ == 0)
+ DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE);
+ else
+ throw PropListIException("DSetCreatPropList::getConstant", "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
//--------------------------------------------------------------------------
-///\brief Constant for dataset creation default property
+// Function: DSetCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_
+// points to.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-const DSetCreatPropList DSetCreatPropList::DEFAULT;
+void DSetCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose Constant for dataset creation default property
+//--------------------------------------------------------------------------
+const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DSetCreatPropList default constructor
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 7434b9b..0bb1459 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -27,8 +27,8 @@ namespace H5 {
*/
class H5_DLLCPP DSetCreatPropList : public PropList {
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/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/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/H5Library.cpp b/c++/src/H5Library.cpp
index ecc5141..31856ec 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -14,10 +14,22 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#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 "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 +37,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 +74,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 +158,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 +269,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..a9d3e6d 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -33,9 +33,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 +948,7 @@ H5Location::~H5Location() {}
//--------------------------------------------------------------------------
void f_Attribute_setId(Attribute* attr, hid_t new_id)
{
- attr->id = new_id;
+ attr->p_setId(new_id);
}
//--------------------------------------------------------------------------
@@ -966,7 +963,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/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/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake
index 6506183..c2b7527 100644
--- a/config/cmake_ext_mod/runTest.cmake
+++ b/config/cmake_ext_mod/runTest.cmake
@@ -37,7 +37,7 @@ endif (TEST_ENV_VAR)
if (NOT TEST_INPUT)
# run the test program, capture the stdout/stderr and the result var
- EXECUTE_PROCESS (
+ execute_process (
COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
@@ -48,7 +48,7 @@ if (NOT TEST_INPUT)
)
else (NOT TEST_INPUT)
# run the test program with stdin, capture the stdout/stderr and the result var
- EXECUTE_PROCESS (
+ execute_process (
COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
@@ -80,13 +80,13 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}")
if (TEST_MASK)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
- STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif (TEST_MASK)
if (TEST_MASK_MOD)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
- STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif (TEST_MASK_MOD)
@@ -96,13 +96,13 @@ if (TEST_MASK_ERROR)
else (NOT TEST_ERRREF)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
endif (NOT TEST_ERRREF)
- STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
if (NOT TEST_ERRREF)
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
else (NOT TEST_ERRREF)
@@ -112,7 +112,7 @@ endif (TEST_MASK_ERROR)
if (TEST_FILTER)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
- STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
+ string (REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif (TEST_FILTER)
@@ -123,21 +123,21 @@ if (NOT TEST_SKIP_COMPARE)
endif (WIN32 AND NOT MINGW)
# now compare the output with the reference
- EXECUTE_PROCESS (
+ execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
RESULT_VARIABLE TEST_RESULT
)
if (NOT ${TEST_RESULT} STREQUAL 0)
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
- LIST (LENGTH test_act len_act)
+ list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
- LIST (LENGTH test_ref len_ref)
+ list (LENGTH test_ref len_ref)
if (NOT ${len_act} STREQUAL "0")
- MATH (EXPR _FP_LEN "${len_ref} - 1")
+ math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
- LIST (GET test_act ${line} str_act)
- LIST (GET test_ref ${line} str_ref)
+ list (GET test_act ${line} str_act)
+ list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
@@ -165,22 +165,22 @@ if (NOT TEST_SKIP_COMPARE)
endif (WIN32 AND NOT MINGW)
# now compare the error output with the error reference
- EXECUTE_PROCESS (
+ execute_process (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
RESULT_VARIABLE TEST_RESULT
)
if (NOT ${TEST_RESULT} STREQUAL 0)
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
- LIST (LENGTH test_act len_act)
+ list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
- LIST (LENGTH test_ref len_ref)
- MATH (EXPR _FP_LEN "${len_ref} - 1")
+ list (LENGTH test_ref len_ref)
+ math (EXPR _FP_LEN "${len_ref} - 1")
if (NOT ${len_act} STREQUAL "0")
- MATH (EXPR _FP_LEN "${len_ref} - 1")
+ math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
- LIST (GET test_act ${line} str_act)
- LIST (GET test_ref ${line} str_ref)
+ list (GET test_act ${line} str_act)
+ list (GET test_ref ${line} str_ref)
if (NOT "${str_act}" STREQUAL "${str_ref}")
if (NOT "${str_act}" STREQUAL "")
set (TEST_RESULT 1)
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index a90e3c8..df1962b 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -20,20 +20,22 @@ if (HDF5_GENERATE_HEADERS)
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h
+ PRE_BUILD
COMMAND "${CMAKE_COMMAND}"
-D "GEN_DIR=genLT"
-D "FILE_PARSE=H5LTparse"
-P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTparse.c"
+ DEPENDS "${BISON_H5LT_PARSER_OUTPUTS}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c
+ PRE_BUILD
COMMAND "${CMAKE_COMMAND}"
-D "GEN_DIR=genLT"
-D "FILE_ANALYZE=H5LTanalyze.c"
-P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c"
+ DEPENDS "${FLEX_H5LT_SCANNER_OUTPUTS}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target (process_gen_H5LT
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 32fd1be..ef3e760 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -809,11 +809,8 @@ if (HDF5_GENERATE_HEADERS)
COMMENT " Creating Assignment overflow macro"
)
- add_custom_target(generate_precompiled DEPENDS
- "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h")
-
add_custom_target(run_perl_scripts ALL
- DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h
+ DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h
)
else (PERL_FOUND)
message (STATUS "Cannot generate headers - perl not found")
@@ -830,7 +827,7 @@ if (MSVC OR MINGW)
target_link_libraries (H5detect "ws2_32.lib")
endif (MSVC OR MINGW)
if (HDF5_GENERATE_HEADERS)
- add_dependencies(H5detect generate_precompiled)
+ add_dependencies(H5detect run_perl_scripts)
else (HDF5_GENERATE_HEADERS)
add_dependencies(H5detect "${H5_GENERATED_HEADERS}")
endif (HDF5_GENERATE_HEADERS)
@@ -849,7 +846,7 @@ if (MSVC OR MINGW)
target_link_libraries (H5make_libsettings "ws2_32.lib")
endif (MSVC OR MINGW)
if (HDF5_GENERATE_HEADERS)
- add_dependencies(H5detect generate_precompiled)
+ add_dependencies(H5make_libsettings run_perl_scripts)
else (HDF5_GENERATE_HEADERS)
add_dependencies(H5make_libsettings "${H5_GENERATED_HEADERS}")
endif (HDF5_GENERATE_HEADERS)
diff --git a/src/H5A.c b/src/H5A.c
index 440fc31..cc30319 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -684,6 +684,7 @@ hid_t
H5Aget_space(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
+ H5S_t *ds = NULL;
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -693,10 +694,19 @@ H5Aget_space(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if((ret_value = H5A_get_space(attr)) < 0)
+ if(NULL == (ds = H5A_get_space(attr)))
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
done:
+ if(ret_value < 0) {
+ if(ds && (H5S_close(ds) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -721,6 +731,7 @@ hid_t
H5Aget_type(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
+ H5T_t *dt = NULL;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -730,10 +741,19 @@ H5Aget_type(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if((ret_value = H5A_get_type(attr)) < 0)
+ if(NULL == (dt = H5A_get_type(attr)))
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ /* Create an atom */
+ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+
done:
+ if(ret_value < 0) {
+ if(dt && (H5T_close(dt) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 193e8f4..baa352c 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -734,39 +734,31 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
/*-------------------------------------------------------------------------
* Function: H5A_get_space
*
- * Purpose: Returns and ID for the dataspace of the attribute.
+ * Purpose: Returns dataspace of the attribute.
*
- * Return: Success: ID for dataspace
+ * Return: Success: dataspace
*
- * Failure: FAIL
+ * Failure: NULL
*
* Programmer: Mohamad Chaarawi
* March, 2012
*
*-------------------------------------------------------------------------
*/
-hid_t
+H5S_t *
H5A_get_space(H5A_t *attr)
{
- H5S_t *ds = NULL;
- hid_t ret_value = FAIL;
+ H5S_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
- /* Copy the attribute's dataspace */
- if(NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to copy dataspace")
+ HDassert(attr);
- /* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ /* Copy the attribute's dataspace */
+ if(NULL == (ret_value = H5S_copy(attr->shared->ds, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy dataspace")
done:
- if(ret_value < 0 && ds) {
- if(H5S_close(ds) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- } /* end if */
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_get_space() */
@@ -774,28 +766,30 @@ done:
/*-------------------------------------------------------------------------
* Function: H5A_get_type
*
- * Purpose: Returns and ID for the datatype of the dataset.
+ * Purpose: Returns datatype of the dataset.
*
- * Return: Success: ID for datatype
+ * Return: Success: datatype
*
- * Failure: FAIL
+ * Failure: NULL
*
* Programmer: Mohamad Chaarawi
* March, 2012
*
*-------------------------------------------------------------------------
*/
-hid_t
+H5T_t *
H5A_get_type(H5A_t *attr)
{
- H5T_t *dt = NULL;
- hid_t ret_value = FAIL;
+ H5T_t *dt = NULL;
+ H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
+ HDassert(attr);
+
/* Patch the datatype's "top level" file pointer */
if(H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer")
/*
* Copy the attribute's datatype. If the type is a named type then
@@ -803,25 +797,21 @@ H5A_get_type(H5A_t *attr)
* read-only.
*/
if(NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to copy datatype")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Lock copied type */
if(H5T_lock(dt, FALSE) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to lock transient datatype")
- /* Create an atom */
- if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ ret_value = dt;
done:
- if(ret_value < 0) {
- if(dt && H5T_close(dt) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
- } /* end if */
+ if(!ret_value && dt && (H5T_close(dt) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_get_type() */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index b815d11..b392497 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -193,8 +193,6 @@ H5_DLL H5A_t *H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
-H5_DLL hid_t H5A_get_type(H5A_t *attr);
-H5_DLL hid_t H5A_get_space(H5A_t *attr);
H5_DLL hid_t H5A_get_create_plist(H5A_t* attr);
H5_DLL herr_t H5A_free(H5A_t *attr);
H5_DLL herr_t H5A_close(H5A_t *attr);
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index 6646fa2..6b62692 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -25,6 +25,7 @@
/* Private headers needed by this file */
#include "H5Gprivate.h" /* Groups */
#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspace */
#include "H5Tprivate.h" /* Datatypes */
@@ -77,6 +78,8 @@ typedef struct H5A_attr_iter_op_t {
H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr);
H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr);
H5_DLL H5T_t *H5A_type(const H5A_t *attr);
+H5_DLL H5T_t *H5A_get_type(H5A_t *attr);
+H5_DLL H5S_t *H5A_get_space(H5A_t *attr);
H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc,
hid_t dxpl_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip,
hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data);
diff --git a/src/H5D.c b/src/H5D.c
index 1ffee94..72f3f06 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -697,7 +697,9 @@ herr_t
H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
void *operator_data)
{
+ H5T_t *type; /* Datatype */
H5S_t *space; /* Dataspace for iteration */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -710,12 +712,18 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
if(H5I_DATATYPE != H5I_get_type(type_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype")
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
if(!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
- ret_value = H5D__iterate(buf, type_id, space, op, operator_data);
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = op;
+ dset_op.u.app_op.type_id = type_id;
+
+ ret_value = H5S_select_iterate(buf, type, space, &dset_op, operator_data);
done:
FUNC_LEAVE_API(ret_value)
@@ -804,6 +812,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
char bogus; /* bogus value to pass to H5Diterate() */
H5S_t *space; /* Dataspace for iteration */
H5P_genplist_t *plist; /* Property list */
+ H5T_t *type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -815,6 +825,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (dset = (H5D_t *)H5I_object(dataset_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
if(!(H5S_has_extent(space)))
@@ -854,8 +866,12 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
/* Set the initial number of bytes required */
vlen_bufsize.size = 0;
- /* Call H5D__iterate with args, etc. */
- ret_value = H5D__iterate(&bogus, type_id, space, H5D__vlen_get_buf_size, &vlen_bufsize);
+ /* Call H5S_select_iterate with args, etc. */
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5D__vlen_get_buf_size;
+ dset_op.u.app_op.type_id = type_id;
+
+ ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
/* Get the size if we succeeded */
if(ret_value >= 0)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 1987b40..5664d84 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -231,9 +231,9 @@ static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm,
static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_file_cb(void *elem, hid_t type_id, unsigned ndims,
+static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims,
const hsize_t *coords, void *fm);
-static herr_t H5D__chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims,
+static herr_t H5D__chunk_mem_cb(void *elem, const H5T_t *type, unsigned ndims,
const hsize_t *coords, void *fm);
static unsigned H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled);
static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id,
@@ -722,7 +722,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
- hid_t f_tid = (-1); /* Temporary copy of file datatype for iteration */
+ H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
@@ -875,11 +875,12 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
} /* end while */
} /* end if */
else {
+ H5S_sel_iter_op_t iter_op; /* Operator for iteration */
H5D_chunk_file_iter_ud_t udata; /* User data for iteration */
/* Create temporary datatypes for selection iteration */
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL), FALSE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
/* Initialize the user data */
udata.fm = fm;
@@ -887,8 +888,11 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
udata.io_info = io_info;
#endif /* H5_HAVE_PARALLEL */
+ iter_op.op_type = H5S_SEL_ITER_OP_LIB;
+ iter_op.u.lib_op = H5D__chunk_file_cb;
+
/* Spaces might not be the same shape, iterate over the file selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D__chunk_file_cb, &udata) < 0)
+ if(H5S_select_iterate(&bogus, file_type, file_space, &iter_op, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Reset "last chunk" info */
@@ -908,6 +912,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end if */
else {
+ H5S_sel_iter_op_t iter_op; /* Operator for iteration */
size_t elmt_size; /* Memory datatype size */
/* Make a copy of equivalent memory space */
@@ -922,9 +927,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
fm->mchunk_tmpl = tmp_mspace;
/* Create temporary datatypes for selection iteration */
- if(f_tid < 0) {
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL), FALSE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if(!file_type) {
+ if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
} /* end if */
/* Create selection iterator for memory selection */
@@ -934,8 +939,11 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
+ iter_op.op_type = H5S_SEL_ITER_OP_LIB;
+ iter_op.u.lib_op = H5D__chunk_mem_cb;
+
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D__chunk_mem_cb, fm) < 0)
+ if(H5S_select_iterate(&bogus, file_type, file_space, &iter_op, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
/* Clean up hyperslab stuff, if necessary */
@@ -978,8 +986,8 @@ done:
if(iter_init && H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(f_tid != (-1) && H5I_dec_ref(f_tid) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if(file_type && (H5T_close(file_type) < 0))
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
if(file_space_normalized) {
/* (Casting away const OK -QAK) */
if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
@@ -1525,7 +1533,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_udata)
+H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, const hsize_t *coords, void *_udata)
{
H5D_chunk_file_iter_ud_t *udata = (H5D_chunk_file_iter_ud_t *)_udata; /* User data for operation */
H5D_chunk_map_t *fm = udata->fm; /* File<->memory chunk mapping info */
@@ -1642,7 +1650,7 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_fm)
+H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, const hsize_t *coords, void *_fm)
{
H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 49075d9..b0e31a6 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2144,41 +2144,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__iterate
- *
- * Purpose: Internal version of H5Diterate()
- *
- * Return: Returns the return value of the last operator if it was non-zero,
- * or zero if all elements were processed. Otherwise returns a
- * negative value.
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 22, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5D__iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op,
- void *operator_data)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_NOERR
-
- /* Check args */
- HDassert(buf);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
- HDassert(space);
- HDassert(H5S_has_extent(space));
- HDassert(op);
-
- ret_value = H5S_select_iterate(buf, type_id, space, op, operator_data);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__iterate() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_vlen_reclaim
*
* Purpose: Frees the buffers allocated for storing variable-length data
@@ -2196,6 +2161,8 @@ H5D__iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op,
herr_t
H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
{
+ H5T_t *type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */
herr_t ret_value = FAIL; /* Return value */
@@ -2208,12 +2175,19 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
HDassert(H5P_isa_class(plist_id, H5P_DATASET_XFER));
HDassert(buf);
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
+
/* Get the allocation info */
if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
- /* Call H5D__iterate with args, etc. */
- ret_value = H5D__iterate(buf, type_id, space ,H5T_vlen_reclaim, vl_alloc_info);
+ /* Call H5S_select_iterate with args, etc. */
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5T_vlen_reclaim;
+ dset_op.u.app_op.type_id = type_id;
+
+ ret_value = H5S_select_iterate(buf, type, space, &dset_op, vl_alloc_info);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index f07b8f0..552c61b 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -545,8 +545,6 @@ H5_DLL herr_t H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_allo
hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
-H5_DLL herr_t H5D__iterate(void *buf, hid_t type_id, const H5S_t *space,
- H5D_operator_t op, void *operator_data);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *op_data);
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 6c4265d..b00dc6b 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -31,6 +31,7 @@
#include "H5Gprivate.h" /* Groups */
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
/* Flags for H5S_find */
#define H5S_CONV_PAR_IO_POSSIBLE 0x0001
@@ -115,6 +116,29 @@ typedef struct H5S_sel_iter_t {
} u;
} H5S_sel_iter_t;
+/* Selection iteration operator for internal library callbacks */
+typedef herr_t (*H5S_sel_iter_lib_op_t)(void *elem, const H5T_t *type,
+ unsigned ndim, const hsize_t *point, void *op_data);
+
+/* Describe kind of callback to make */
+typedef enum H5S_sel_iter_op_type_t {
+ H5S_SEL_ITER_OP_APP, /* Application callback */
+ H5S_SEL_ITER_OP_LIB /* Library internal callback */
+} H5S_sel_iter_op_type_t;
+
+typedef struct H5S_sel_iter_app_op_t {
+ H5D_operator_t op; /* Callback */
+ hid_t type_id; /* Type ID to be passed to callback */
+} H5S_sel_iter_app_op_t;
+
+typedef struct H5S_sel_iter_op_t {
+ H5S_sel_iter_op_type_t op_type;
+ union {
+ H5S_sel_iter_app_op_t app_op; /* Application callback */
+ H5S_sel_iter_lib_op_t lib_op; /* Library internal callback */
+ } u;
+} H5S_sel_iter_op_t;
+
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5S_MODULE
#define H5S_GET_EXTENT_TYPE(S) ((S)->extent.type)
@@ -213,8 +237,8 @@ H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src);
/* Operations on selections */
H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p);
H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space);
-H5_DLL herr_t H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space,
- H5D_operator_t op, void *operator_data);
+H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
+ const H5S_sel_iter_op_t *op, void *op_data);
H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size,
const H5S_t *space, void *buf);
H5_DLL htri_t H5S_select_valid(const H5S_t *space);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index d66a30a..d4a4d69 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1338,9 +1338,9 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
PURPOSE
Iterate over the selected elements in a memory buffer.
USAGE
- herr_t H5S_select_iterate(buf, type_id, space, operator, operator_data)
+ herr_t H5S_select_iterate(buf, type, space, operator, operator_data)
void *buf; IN/OUT: Buffer containing elements to iterate over
- hid_t type_id; IN: Datatype ID of BUF array.
+ H5T_t *type; IN: Datatype of BUF array.
H5S_t *space; IN: Dataspace object containing selection to iterate over
H5D_operator_t op; IN: Function pointer to the routine to be
called for each element in BUF iterated over.
@@ -1361,10 +1361,9 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
the selection is not modified.
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op,
- void *operator_data)
+H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
+ const H5S_sel_iter_op_t *op, void *op_data)
{
- H5T_t *dt; /* Datatype structure */
H5S_sel_iter_t iter; /* Selection iteration info */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
hssize_t nelmts; /* Number of elements in selection */
@@ -1379,14 +1378,12 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Check args */
HDassert(buf);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(type);
HDassert(space);
HDassert(op);
/* Get the datatype size */
- if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
- if(0 == (elmt_size = H5T_get_size(dt)))
+ if(0 == (elmt_size = H5T_get_size(type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
/* Initialize iterator */
@@ -1450,8 +1447,19 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Get the location within the user's buffer */
loc = (unsigned char *)buf + curr_off;
- /* Call user's callback routine */
- user_ret = (*op)(loc, type_id, ndims, coords, operator_data);
+ /* Check which type of callback to make */
+ switch(op->op_type) {
+ case H5S_SEL_ITER_OP_APP:
+ /* Make the application callback */
+ user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data);
+ break;
+ case H5S_SEL_ITER_OP_LIB:
+ /* Call the library's callback */
+ user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type")
+ } /* end switch */
/* Increment offset in dataspace */
curr_off += elmt_size;
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 98d488f..64031eb 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -1159,6 +1159,7 @@ if (HDF5_TEST_VFD)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1)
set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
+ set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
if (NOT CYGWIN)
set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
endif (NOT CYGWIN)
@@ -1166,6 +1167,7 @@ if (HDF5_TEST_VFD)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
+ set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
if (NOT CYGWIN)
set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
endif (NOT CYGWIN)