summaryrefslogtreecommitdiffstats
path: root/c++/src/H5PropList.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2005-07-25 03:37:21 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2005-07-25 03:37:21 (GMT)
commitfab172d704065dba31fbf34d3fe7e56c3e63fe36 (patch)
tree59a35e3b906d509134ed4d581e134054359e999e /c++/src/H5PropList.cpp
parentf208550696646adcc6e59e339745b0433e28f770 (diff)
downloadhdf5-fab172d704065dba31fbf34d3fe7e56c3e63fe36.zip
hdf5-fab172d704065dba31fbf34d3fe7e56c3e63fe36.tar.gz
hdf5-fab172d704065dba31fbf34d3fe7e56c3e63fe36.tar.bz2
[svn-r11151] Purpose: Fix bugzilla #407 and #408
Description: PropList::copyProp has incorrect prototype; although it works, it does cause users inconvenience. Solution: Added another overloaded function with correct prototype. The old version will be removed in a future release. In the meantime, "Obsolete" will be displayed in its RM page. Also, changed several checks on the returned value of a C API from non-positive to negative because id = 0 is no longer significant, now that the C++ reference counting had been removed. Platforms tested: Linux 2.4 (heping) IRIX64 with -n32 (modi4) Linux 2.4 w/PGI (colonelk)
Diffstat (limited to 'c++/src/H5PropList.cpp')
-rw-r--r--c++/src/H5PropList.cpp41
1 files changed, 37 insertions, 4 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index e0d0143..c4b96c7 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -67,7 +67,7 @@ PropList::PropList( const hid_t plist_id ) : IdComponent(0)
if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
// call C routine to create the new property
id = H5Pcreate(plist_id);
- if( id <= 0 )
+ if( id < 0 )
{
throw PropListIException("PropList constructor", "H5Pcreate failed");
}
@@ -104,7 +104,7 @@ void PropList::copy( const PropList& like_plist )
// call C routine to copy the property list
id = H5Pcopy( like_plist.getId() );
- if( id <= 0 )
+ if( id < 0 )
throw PropListIException("PropList::copy", "H5Pcopy failed");
}
@@ -126,10 +126,43 @@ PropList& PropList::operator=( const PropList& rhs )
//--------------------------------------------------------------------------
// Function: PropList::copyProp
-///\brief Copies a property from one list or class to another
+///\brief Copies a property from this property list or class to another
+///\param dest - IN: Destination property list or class
+///\param name - IN: Name of the property to copy - \c char pointer
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+void PropList::copyProp(PropList& dest, const char *name) const
+{
+ hid_t dst_id = dest.getId();
+ herr_t ret_value = H5Pcopy_prop(dst_id, id, name);
+ if( ret_value < 0 )
+ {
+ throw PropListIException("PropList::copyProp", "H5Pcopy_prop failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: PropList::copyProp
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param dest - IN: Destination property list or class
+///\param name - IN: Name of the property to copy - \c std::string
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+void PropList::copyProp( PropList& dest, const string& name ) const
+{
+ copyProp( dest, name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: PropList::copyProp
+///\brief Copies a property from one list or class to another - Obsolete
///\param dest - IN: Destination property list or class
///\param src - IN: Source property list or class
///\param name - IN: Name of the property to copy - \c char pointer
+///\notes This member function will be removed in the next release
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
@@ -149,7 +182,7 @@ void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const
// Function: PropList::copyProp
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in what arguments it
-/// accepts.
+/// accepts. - Obsolete
///\param dest - IN: Destination property list or class
///\param src - IN: Source property list or class
///\param name - IN: Name of the property to copy - \c std::string