mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-24 17:51:25 +08:00
[svn-r27945] Purpose: Fix HDFFV-9529
Description: Merged from hdf5_CppAPI_Constants r27942: ------ Description: - Added H5dont_atexit() to getPredType and all the getConstant's to prevent the C library from terminating before the C++ library cleanup. - More cleanup and added more comments r27923: ------ - Updated more comments and moved some things around for consistency - Removed check for "new" failure, exceptions would be thrown r27922: ------ Description: Added function headers and more comments for clarity. r27917: ------ Description: 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. Solution: The static approach is changed to dynamic. In order to avoid an impact on existing applications, the static global constants are changed to constant references to the dynamically allocated objects. A detailed explanation of the new method and a description of the changes are in a Design Notes at the end of the file H5PredType.cpp. New functions added to support the new methods are listed below. class H5Library: // 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 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 class DataSpace: // Creates the constant static DataSpace* getConstant(); // private class PropList: // Creates the constant static PropList* getConstant(); // private class DSetCreatPropList: // Creates the constant static DSetCreatPropList* getConstant(); // private class DSetMemXferPropList: // Creates the constant static DSetMemXferPropList* getConstant(); // private class FileCreatPropList: // Creates the constant static FileCreatPropList* getConstant(); // private class FileAccPropList: // Creates the constant static FileAccPropList* getConstant(); // private This function is added to PredType, DataSpace, PropList, and the four subclasses of PropList: // Deletes the constant static void deleteConstants(); // public Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
This commit is contained in:
parent
0ef29b550b
commit
888a002cdd
@ -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
|
||||
|
@ -14,7 +14,6 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5Exception.h"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
///\brief Constant for dataset creation default property
|
||||
// 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
|
||||
//--------------------------------------------------------------------------
|
||||
const DSetCreatPropList DSetCreatPropList::DEFAULT;
|
||||
DSetCreatPropList* DSetCreatPropList::getConstant()
|
||||
{
|
||||
// Tell the C library not to clean up, H5Library::termH5cpp will call
|
||||
// H5close - more dependency if use H5Library::dontAtExit()
|
||||
if (!IdComponent::H5dontAtexit_called)
|
||||
{
|
||||
(void) H5dont_atexit();
|
||||
IdComponent::H5dontAtexit_called = true;
|
||||
}
|
||||
|
||||
// If the constant pointer is not allocated, allocate it. Otherwise,
|
||||
// throw because it shouldn't be.
|
||||
if (DEFAULT_ == 0)
|
||||
DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE);
|
||||
else
|
||||
throw PropListIException("DSetCreatPropList::getConstant", "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
|
||||
return(DEFAULT_);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::deleteConstants
|
||||
// Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_
|
||||
// points to.
|
||||
// Programmer Binh-Minh Ribler - 2015
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::deleteConstants()
|
||||
{
|
||||
if (DEFAULT_ != 0)
|
||||
delete DEFAULT_;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Purpose Constant for dataset creation default property
|
||||
//--------------------------------------------------------------------------
|
||||
const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList default constructor
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
|
||||
// the order of creation and deletion of the global constants. See Design Notes
|
||||
// in "H5PredType.cpp" for information.
|
||||
|
||||
// Initialize a pointer for the constant
|
||||
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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
///\brief Constant for default property
|
||||
// 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
|
||||
//--------------------------------------------------------------------------
|
||||
const FileAccPropList FileAccPropList::DEFAULT;
|
||||
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_);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::deleteConstants
|
||||
// Purpose: Deletes the constant object that FileAccPropList::DEFAULT_
|
||||
// points to.
|
||||
// exception H5::PropListIException
|
||||
// Programmer Binh-Minh Ribler - 2015
|
||||
//--------------------------------------------------------------------------
|
||||
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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
///\brief Constant for default property
|
||||
// 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
|
||||
//--------------------------------------------------------------------------
|
||||
const FileCreatPropList FileCreatPropList::DEFAULT;
|
||||
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_);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::deleteConstants
|
||||
// Purpose: Deletes the constant object that FileCreatPropList::DEFAULT_
|
||||
// points to.
|
||||
// Programmer Binh-Minh Ribler - 2015
|
||||
//--------------------------------------------------------------------------
|
||||
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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -147,6 +157,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.
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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,183 +43,6 @@ 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;
|
||||
|
||||
// LEAST types
|
||||
#if H5_SIZEOF_INT_LEAST8_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_LEAST8_T */
|
||||
|
||||
#if H5_SIZEOF_INT_LEAST16_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_LEAST16_T */
|
||||
|
||||
#if H5_SIZEOF_INT_LEAST32_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_LEAST32_T */
|
||||
|
||||
#if H5_SIZEOF_INT_LEAST64_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_LEAST64_T */
|
||||
|
||||
// FAST types
|
||||
#if H5_SIZEOF_INT_FAST8_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_FAST8_T */
|
||||
|
||||
#if H5_SIZEOF_INT_FAST16_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_FAST16_T */
|
||||
|
||||
#if H5_SIZEOF_INT_FAST32_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_FAST32_T */
|
||||
|
||||
#if H5_SIZEOF_INT_FAST64_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_UINT_FAST64_T */
|
||||
|
||||
/*! \brief This dummy function do not inherit from DataType - it will
|
||||
throw a DataTypeIException if invoked.
|
||||
*/
|
||||
@ -243,21 +56,387 @@ class H5_DLLCPP PredType : public AtomType {
|
||||
*/
|
||||
bool committed();
|
||||
|
||||
protected:
|
||||
///\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;
|
||||
#endif /* H5_SIZEOF_INT_LEAST8_T */
|
||||
#if H5_SIZEOF_UINT_LEAST8_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_LEAST16_T */
|
||||
#if H5_SIZEOF_UINT_LEAST16_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_LEAST32_T */
|
||||
#if H5_SIZEOF_UINT_LEAST32_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_LEAST64_T */
|
||||
#if H5_SIZEOF_UINT_LEAST64_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_FAST8_T */
|
||||
#if H5_SIZEOF_UINT_FAST8_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_FAST16_T */
|
||||
#if H5_SIZEOF_UINT_FAST16_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_FAST32_T */
|
||||
#if H5_SIZEOF_UINT_FAST32_T != 0
|
||||
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;
|
||||
#endif /* H5_SIZEOF_INT_FAST64_T */
|
||||
#if H5_SIZEOF_UINT_FAST64_T != 0
|
||||
static const PredType& NATIVE_UINT_FAST64;
|
||||
#endif /* H5_SIZEOF_UINT_FAST64_T */
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
// Deletes the PredType global constants
|
||||
static void deleteConstants();
|
||||
|
||||
// Dummy constant
|
||||
static const PredType& PREDTYPE_CONST; // dummy constant
|
||||
|
||||
protected:
|
||||
// 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user