mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
[svn-r18745] Purpose: Fixed bug 1852
Description: When a property class id is given to PropList(id), create new prop list, but when a property list id is given, make a copy of it. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew)
This commit is contained in:
parent
5d8a2cca07
commit
1c9e998d0d
@ -66,29 +66,35 @@ PropList::PropList(const PropList& original) : IdComponent(original)
|
|||||||
///\param plist_id - IN: Id of the existing property list
|
///\param plist_id - IN: Id of the existing property list
|
||||||
///\exception H5::PropListIException
|
///\exception H5::PropListIException
|
||||||
// Description
|
// Description
|
||||||
// This function calls H5Pcreate to create a new property list
|
// This function creates a new property list if a property
|
||||||
// if the given id, plist_id, is that of a property class. If
|
// class is provided or makes a copy of a property list if one
|
||||||
// the given id is equal to H5P_ROOT, then set this
|
// is given. If the given id is anything else, then set this
|
||||||
// property's id to H5P_DEFAULT, otherwise, to the given id.
|
// property's id to H5P_DEFAULT.
|
||||||
// Note: someone else added this code without comments and this
|
|
||||||
// description was what I came up with from reading the code.
|
|
||||||
// Programmer Binh-Minh Ribler - 2000
|
// Programmer Binh-Minh Ribler - 2000
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
PropList::PropList( const hid_t plist_id ) : IdComponent()
|
PropList::PropList( const hid_t plist_id ) : IdComponent()
|
||||||
{
|
{
|
||||||
if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
|
H5I_type_t id_type = H5Iget_type(plist_id);
|
||||||
// call C routine to create the new property
|
switch (id_type) {
|
||||||
id = H5Pcreate(plist_id);
|
case H5I_GENPROP_CLS:
|
||||||
if( id < 0 )
|
// call C routine to create a new property from the given prop class
|
||||||
{
|
id = H5Pcreate(plist_id);
|
||||||
throw PropListIException("PropList constructor", "H5Pcreate failed");
|
if( id < 0 )
|
||||||
}
|
{
|
||||||
}
|
throw PropListIException("PropList constructor", "H5Pcreate failed");
|
||||||
else {
|
}
|
||||||
if(plist_id==H5P_ROOT)
|
break;
|
||||||
id=H5P_DEFAULT;
|
case H5I_GENPROP_LST:
|
||||||
else
|
// call C routine to make a copy of the given property list
|
||||||
id=plist_id;
|
id = H5Pcopy(plist_id);
|
||||||
|
if( id < 0 )
|
||||||
|
{
|
||||||
|
throw PropListIException("PropList constructor", "H5Pcopy failed");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
id = H5P_DEFAULT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user