summaryrefslogtreecommitdiffstats
path: root/c++/src/H5PropList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5PropList.cpp')
-rw-r--r--c++/src/H5PropList.cpp53
1 files changed, 50 insertions, 3 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 76bc089..a65c300 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -45,7 +45,7 @@ const PropList PropList::DEFAULT( H5P_DEFAULT );
///\brief Default constructor: creates a stub property list object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList() : IdComponent( 0 ) {}
+PropList::PropList() : IdComponent(), id(0) {}
//--------------------------------------------------------------------------
// Function: PropList copy constructor
@@ -53,7 +53,11 @@ PropList::PropList() : IdComponent( 0 ) {}
///\param original - IN: The original property list to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList( const PropList& original ) : IdComponent( original ) {}
+PropList::PropList(const PropList& original) : IdComponent(original)
+{
+ id = original.getId();
+ incRefCount(); // increment number of references to this id
+}
//--------------------------------------------------------------------------
// Function: PropList overloaded constructor
@@ -69,7 +73,7 @@ PropList::PropList( const PropList& original ) : IdComponent( original ) {}
// description was what I came up with from reading the code.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList( const hid_t plist_id ) : IdComponent(0)
+PropList::PropList( const hid_t plist_id ) : IdComponent()
{
if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
// call C routine to create the new property
@@ -204,6 +208,49 @@ void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name
}
//--------------------------------------------------------------------------
+// Function: PropList::getId
+// Purpose: Get the id of this attribute
+// Description:
+// Class hierarchy is revised to address bugzilla 1068. Class
+// AbstractDS and Attribute are moved out of H5Object. In
+// addition, member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
+// Programmer Binh-Minh Ribler - May, 2008
+//--------------------------------------------------------------------------
+hid_t PropList::getId() const
+{
+ return(id);
+}
+
+//--------------------------------------------------------------------------
+// Function: PropList::setId
+///\brief Sets the identifier of this object to a new value.
+///
+///\exception H5::IdComponentException when the attempt to close the HDF5
+/// object fails
+// Description:
+// The underlaying reference counting in the C library ensures
+// that the current valid id of this object is properly closed.
+// Then the object's id is reset to the new id.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void PropList::setId(const hid_t new_id)
+{
+ // handling references to this old id
+ try {
+ close();
+ }
+ catch (Exception close_error) {
+ throw PropListIException(inMemFunc("setId"), close_error.getDetailMsg());
+ }
+ // reset object's id to the given id
+ id = new_id;
+
+ // increment the reference counter of the new id
+ incRefCount();
+}
+
+//--------------------------------------------------------------------------
// Function: PropList::close
///\brief Closes the property list if it is not a default one.
///