diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-09-26 20:29:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-09-26 20:29:35 (GMT) |
commit | 7a96b1a0d2b943aa4c4187b4424bea8ae826ee5f (patch) | |
tree | 6f69e5f4f0852885fd4e93927d4ffba71dbe6c44 /c++ | |
parent | e09ac06d96dfaca15d74e683a24b0fdcf21f906c (diff) | |
download | hdf5-7a96b1a0d2b943aa4c4187b4424bea8ae826ee5f.zip hdf5-7a96b1a0d2b943aa4c4187b4424bea8ae826ee5f.tar.gz hdf5-7a96b1a0d2b943aa4c4187b4424bea8ae826ee5f.tar.bz2 |
[svn-r4482] Purpose:
Kludge
Description:
Since we're only about halfway through converting the internal use of
property lists from the "old way" to the generic property lists, we turned
off snapshots to avoid exposing lots of API changes to users, until the
APIs settled down.
Getting the snapshots rolling again seems to have become a priority, so
some changes are going to have to be made now that were going to be
postponed until we were completely finished with the conversion. This
requires that the old API functions be able to deal with both the old
and new property lists smoothly.
Solution:
Kludge together the property list code so that they can transparently handle
dealing with both the old and new property lists
Platforms tested:
FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5DcreatProp.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5DxferProp.cpp | 4 | ||||
-rw-r--r-- | c++/src/H5FaccProp.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5FcreatProp.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5IdComponent.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 42 | ||||
-rw-r--r-- | c++/src/H5PropList.h | 11 |
7 files changed, 27 insertions, 38 deletions
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 4f3d2e4..ec5a10a 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -13,7 +13,7 @@ namespace H5 { #endif -const DSetCreatPropList DSetCreatPropList::DEFAULT( H5P_DEFAULT ); +const DSetCreatPropList DSetCreatPropList::DEFAULT( H5P_NO_CLASS ); // Copy constructor: makes a copy of the original DSetCreatPropList object; DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList( orig ) {} diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 389db89..96444aa 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -11,10 +11,10 @@ namespace H5 { #endif -const DSetMemXferPropList DSetMemXferPropList::DEFAULT( H5P_DEFAULT ); +const DSetMemXferPropList DSetMemXferPropList::DEFAULT( H5P_NO_CLASS ); // Creates a dataset memory and transfer property list -DSetMemXferPropList::DSetMemXferPropList() : PropList( H5P_DATASET_XFER_NEW ) {} +DSetMemXferPropList::DSetMemXferPropList() : PropList( H5P_DATASET_XFER) {} // Copy constructor: makes a copy of the original DSetMemXferPropList object; DSetMemXferPropList::DSetMemXferPropList( const DSetMemXferPropList& orig ) : PropList( orig ) {} diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 4eae889..3ade17e 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -11,7 +11,7 @@ namespace H5 { #endif -const FileAccPropList FileAccPropList::DEFAULT( H5P_DEFAULT ); +const FileAccPropList FileAccPropList::DEFAULT( H5P_NO_CLASS ); // Creates a file access property list FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {} diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index d511595..3d4b21f 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -11,7 +11,7 @@ namespace H5 { #endif -const FileCreatPropList FileCreatPropList::DEFAULT( H5P_DEFAULT ); +const FileCreatPropList FileCreatPropList::DEFAULT( H5P_NO_CLASS ); // Creates a file create property list FileCreatPropList::FileCreatPropList() : PropList( H5P_FILE_CREATE ) {} diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index d7ba7c4..1275ee5 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -12,7 +12,7 @@ namespace H5 { #endif // Default constructor - private -IdComponent::IdComponent() : id( 0 ) +IdComponent::IdComponent() : id( -1 ) { // starts counting object references ref_count = new RefCounter; diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 985d895..3982288 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -11,23 +11,12 @@ namespace H5 { #endif -const PropList PropList::DEFAULT( H5P_DEFAULT ); +const PropList PropList::DEFAULT( H5P_NO_CLASS ); // Default constructor - set id to 0 by default here but may be set // to a valid one, if any, by a subclass constructor. PropList::PropList() : IdComponent( 0 ) {} -// Creates a new property of specified type -PropList::PropList( H5P_class_t type ) : IdComponent( 0 ) -{ - // call C routine to create the new property - id = H5Pcreate(type ); - if( id <= 0 ) - { - throw PropListIException("PropList constructor", "H5Pcreate failed"); - } -} - // Copy constructor: makes a copy of the original object PropList::PropList( const PropList& original ) : IdComponent( original ) {} @@ -39,18 +28,25 @@ Description: the identifier still has reference counter; the p_close function will take care of not to call H5Pclose on the default id. */ -PropList::PropList( const hid_t plist_id ) : IdComponent() +PropList::PropList( const hid_t plist_id ) : IdComponent(0) { - if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) { + if (H5I_GENPROP_CLS == H5Iget_type(plist_id) + || plist_id==H5P_FILE_CREATE + || plist_id==H5P_FILE_ACCESS + || plist_id==H5P_DATASET_CREATE + || plist_id==H5P_MOUNT) { // call C routine to create the new property - id = H5Pcreate_list(plist_id); + id = H5Pcreate(plist_id); if( id <= 0 ) { - throw PropListIException("PropList constructor", "H5Pcreate_list failed"); + throw PropListIException("PropList constructor", "H5Pcreate failed"); } } else { - id=plist_id; + if(plist_id==H5P_NO_CLASS) + id=H5P_DEFAULT; + else + id=plist_id; } } @@ -88,15 +84,11 @@ PropList& PropList::operator=( const PropList& rhs ) // Closes the property list if it is not a default one void PropList::p_close() const { - if( id != H5P_DEFAULT ) // not a constant, should call H5Pclose + if( id != H5P_NO_CLASS ) // not a constant, should call H5Pclose { herr_t ret_value; - if (H5I_GENPROP_LST == H5Iget_type(id)) { - ret_value = H5Pclose_list( id ); - } else { - ret_value = H5Pclose( id ); - } + ret_value = H5Pclose( id ); if( ret_value < 0 ) { @@ -106,9 +98,9 @@ void PropList::p_close() const } // Returns the class of this property list, i.e. H5P_FILE_CREATE... -H5P_class_t PropList::getClass() const +hid_t PropList::getClass() const { - H5P_class_t plist_class = H5Pget_class( id ); + hid_t plist_class = H5Pget_class( id ); if( plist_class == H5P_NO_CLASS ) { throw PropListIException("PropList::getClass", diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 037b0d8..c800ace 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -11,8 +11,9 @@ class PropList : public IdComponent { // Default property list static const PropList DEFAULT; - // Creates a property list given the property list type. - PropList( H5P_class_t type ); + // Creates a property list of a given type or creates a copy of an + // existing property list giving the property list id + PropList( const hid_t plist_id ); // Default constructor: creates a PropList object - this object // does not represent any property list yet. @@ -29,11 +30,7 @@ class PropList : public IdComponent { // Gets the class of this property list, i.e. H5P_FILE_CREATE, // H5P_FILE_ACCESS, ... - H5P_class_t getClass() const; - - // Creates a default property list or creates a copy of an - // existing property list giving the property list id - PropList( const hid_t plist_id ); + hid_t getClass() const; // Used by the API to close the property list void p_close() const; |