summaryrefslogtreecommitdiffstats
path: root/c++/src/H5PropList.cpp
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-06 19:45:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-06 19:45:35 (GMT)
commit98754fa9d12090f5e048fdb05cc5e9ce9111676f (patch)
tree407e611b19ee551d8153779104022dd886a467e5 /c++/src/H5PropList.cpp
parent29321bcafa9f1c6108bb92b5a844a9d4d9c2c8e7 (diff)
downloadhdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.zip
hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.gz
hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.bz2
[svn-r19050] Description:
Bring r18704:19049 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'c++/src/H5PropList.cpp')
-rw-r--r--c++/src/H5PropList.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 579c8ac..2530204 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -66,29 +66,35 @@ PropList::PropList(const PropList& original) : IdComponent(original)
///\param plist_id - IN: Id of the existing property list
///\exception H5::PropListIException
// Description
-// This function calls H5Pcreate to create a new property list
-// if the given id, plist_id, is that of a property class. If
-// the given id is equal to H5P_ROOT, then set this
-// property's id to H5P_DEFAULT, otherwise, to the given id.
-// Note: someone else added this code without comments and this
-// description was what I came up with from reading the code.
+// This function creates a new property list if a property
+// class is provided or makes a copy of a property list if one
+// is given. If the given id is anything else, then set this
+// property's id to H5P_DEFAULT.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PropList::PropList( const hid_t plist_id ) : IdComponent()
{
- if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
- // call C routine to create the new property
- id = H5Pcreate(plist_id);
- if( id < 0 )
- {
- throw PropListIException("PropList constructor", "H5Pcreate failed");
- }
- }
- else {
- if(plist_id==H5P_ROOT)
- id=H5P_DEFAULT;
- else
- id=plist_id;
+ H5I_type_t id_type = H5Iget_type(plist_id);
+ switch (id_type) {
+ case H5I_GENPROP_CLS:
+ // call C routine to create a new property from the given prop class
+ id = H5Pcreate(plist_id);
+ if( id < 0 )
+ {
+ throw PropListIException("PropList constructor", "H5Pcreate failed");
+ }
+ break;
+ case H5I_GENPROP_LST:
+ // call C routine to make a copy of the given property list
+ id = H5Pcopy(plist_id);
+ if( id < 0 )
+ {
+ throw PropListIException("PropList constructor", "H5Pcopy failed");
+ }
+ break;
+ default:
+ id = H5P_DEFAULT;
+ break;
}
}