summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2008-07-22 20:36:31 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2008-07-22 20:36:31 (GMT)
commit8704820d1c56165fcf930ab21adebea0a48c664f (patch)
treeb74991b3c84c1a6d52e1003c7668863b1fd3dfb4 /c++/src/H5IdComponent.cpp
parent717388ea0683ff9db970cd8f8998ba9b94d62cf0 (diff)
downloadhdf5-8704820d1c56165fcf930ab21adebea0a48c664f.zip
hdf5-8704820d1c56165fcf930ab21adebea0a48c664f.tar.gz
hdf5-8704820d1c56165fcf930ab21adebea0a48c664f.tar.bz2
[svn-r15395] When an attribute was opened twice and data was written with one of the handles,
the file didn't have the data. It happened because each handle had its own object structure, and the empty one overwrote the data with fill value. This is fixed by making some attribute information like the data be shared in the attribute structure. Tested on smirom, kagiso, and linew.
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp80
1 files changed, 3 insertions, 77 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index fa2f3db..b22d869 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -177,59 +177,13 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
// copy the data members from the rhs object
setId(rhs.getId());
- /* id = rhs.id;
- */
+ incRefCount(getId()); // a = b, so there are two objects with the same
+ // hdf5 id
}
return *this;
}
//--------------------------------------------------------------------------
-// Function: IdComponent::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
-//--------------------------------------------------------------------------
-#if 0
-void IdComponent::setId(const hid_t new_id)
-{
- // handling references to this old id
- try {
- close();
- }
- catch (Exception close_error) {
- throw IdComponentException(inMemFunc("copy"), close_error.getDetailMsg());
- }
-
- // reset object's id to the given id
- /* id = new_id;
- */
- setId(new_id);
-
- // increment the reference counter of the new id
- incRefCount();
-}
-#endif
-
-//--------------------------------------------------------------------------
-// Function: IdComponent::getId
-///\brief Returns the id of this object
-///\return HDF5 id
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-/*
-hid_t IdComponent::getId () const
-{
- return(id);
-}
-*/
-
-//--------------------------------------------------------------------------
// Function: IdComponent destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
@@ -273,10 +227,7 @@ H5std_string IdComponent::inMemFunc(const char* func_name) const
///\brief Default constructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IdComponent::IdComponent() {
- /* setId(-1);
- */
-}
+IdComponent::IdComponent() {}
//--------------------------------------------------------------------------
// Function: IdComponent::p_get_file_name (protected)
@@ -335,31 +286,6 @@ hid_t IdComponent::p_dereference(void* ref)
return(temp_id);
}
-//--------------------------------------------------------------------------
-// Function: IdComponent::p_reference (protected)
-// Purpose Creates a reference to an HDF5 object or a dataset region.
-// Parameters
-// name - IN: Name of the object to be referenced
-// dataspace - IN: Dataspace with selection
-// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
-// Return A reference
-// Exception H5::IdComponentException
-// Notes This function is incorrect, and will be removed in the near
-// future after notifying users of the new APIs ::reference's.
-// BMR - Oct 8, 2006
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
- /* void* IdComponent::p_reference(const char* name, hid_t space_id, H5R_type_t ref_type) const
-{
- hobj_ref_t ref;
- herr_t ret_value = H5Rcreate(&ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
- throw IdComponentException("", "H5Rcreate failed");
- }
- return (reinterpret_cast<void*>(ref));
-}
- */
//
// Local functions used in this class
//