[svn-r15407] Purpose: Fix bug

Description:
    Changed all subclasses' setId to protected p_setId and put back setId
    in IdComponent.  p_setId is used in the library where the id provided
    by a C API passed on to user's application in the form of a C++ API
    object, which will be destroyed properly, and so p_setId does not
    call incRefCount.  On the other hand, the public version setId is
    used by other applications, in which the id passed to setId needs
    to be closed properly by the application, so setId must call incRefCount
    for the new object to prevent prematurely closing of the id.

Platforms tested:
    Linux 2.6 (kagiso)
    SunOS 5.10 (linew)
    FreeBSD (duty)
This commit is contained in:
Binh-Minh Ribler
2008-07-25 16:51:01 -05:00
parent bb8bf261ee
commit 18fb7d1a78
18 changed files with 90 additions and 35 deletions

View File

@@ -534,7 +534,7 @@ hid_t DataSet::getId() const
}
//--------------------------------------------------------------------------
// Function: DataSet::setId
// Function: DataSet::p_setId
///\brief Sets the identifier of this object to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
@@ -545,14 +545,14 @@ hid_t DataSet::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::setId(const hid_t new_id)
void DataSet::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
catch (Exception close_error) {
throw DataSetIException(inMemFunc("setId"), close_error.getDetailMsg());
throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;