//-------------------------------------------------------------------------- // Function: IdComponent::setId ///\brief Sets the identifier of this object to a new value. ///\param new_id - IN: New identifier to be set to ///\exception H5::IdComponentException when the attempt to close the HDF5 /// object fails // Description: // p_setId ensures that the current valid id of this object is // properly closed before resetting the object's id to the new id. // Programmer Binh-Minh Ribler - 2000 // Modification // 2008/7/23 - BMR // Changed all subclasses' setId to p_setId and put back setId // here. 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 is that of another C++ API object, so // setId must call incRefCount. //-------------------------------------------------------------------------- void IdComponent::setId(const hid_t new_id) { // set to new_id p_setId(new_id); // increment the reference counter of the new id incRefCount(); }
//-------------------------------------------------------------------------- // Function: H5Object::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Object::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { temp_id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Object::dereference - located by attribute", E.getDetailMsg()); } p_setId(temp_id); }
//-------------------------------------------------------------------------- // Function: H5Object::dereference ///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. ///\param h5file - IN: HDF5 file specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Object::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { temp_id = p_dereference(h5file.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Object::dereference - located by file", E.getDetailMsg()); } p_setId(temp_id); }
//-------------------------------------------------------------------------- // Function: IdComponent::operator= ///\brief Assignment operator. ///\param rhs - IN: Reference to the existing object ///\return Reference to IdComponent instance ///\exception H5::IdComponentException when attempt to close the HDF5 /// object fails // Description // First, close the current valid id of this object. Then // copy the id from rhs to this object, and increment the // reference counter of the id to indicate that another object // is referencing that id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent& IdComponent::operator=( const IdComponent& rhs ) { if (this != &rhs) { // handling references to this id try { close(); } catch (Exception close_error) { throw FileIException(inMemFunc("operator="), close_error.getDetailMsg()); } // copy the data members from the rhs object p_setId(rhs.getId()); incRefCount(getId()); // a = b, so there are two objects with the same // hdf5 id } return *this; }
//-------------------------------------------------------------------------- // Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference")); }
//-------------------------------------------------------------------------- // Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. ///\param loc - IN: Location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); }
//-------------------------------------------------------------------------- // Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. ///\param loc - IN: Location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type) { p_setId(p_dereference(loc.getId(), ref, ref_type, "dereference")); }