diff options
Diffstat (limited to 'c++/src/H5Object.cpp')
-rw-r--r-- | c++/src/H5Object.cpp | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 8fe8e56..868a5d3 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -11,6 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifdef OLD_HEADER_FILENAME +#include <iostream.h> +#else +#include <iostream> +#endif + #include <string> #include "H5private.h" // for HDmemset @@ -19,6 +25,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5DataSpace.h" +#include "H5StrcreatProp.h" +#include "H5LcreatProp.h" #include "H5AbstractDs.h" #include "H5LaccProp.h" #include "H5Location.h" @@ -53,32 +61,19 @@ namespace H5 { H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- -// Function: H5Object overloaded constructor (protected) -// Purpose Creates an H5Object object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It will be removed in 1.10 release. If its -// removal does not raise any problems in 1.10, it will be removed from 1.8 in -// subsequent releases. -// Removed in 1.8.18 and 1.10.1 - Aug 2016 -//-------------------------------------------------------------------------- -//H5Object::H5Object(const hid_t object_id) : H5Location() {} - -//-------------------------------------------------------------------------- -// Function: H5Object copy constructor -///\brief Copy constructor: makes a copy of the original H5Object -/// instance. -///\param original - IN: H5Object instance to copy -// Programmer Binh-Minh Ribler - 2000 -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It is removed from 1.8.15 because it is -// a noop and it can be generated by the compiler if needed. +// Function: f_Attribute_setId - friend +// Purpose: This function is friend to class H5::Attribute so that it +// can set Attribute::id in order to work around a problem +// described in the JIRA issue HDFFV-7947. +// Applications shouldn't need to use it. +// param attr - IN/OUT: Attribute object to be changed +// param new_id - IN: New id to set +// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- -// H5Object::H5Object(const H5Object& original) : H5Location() {} +void f_Attribute_setId(Attribute* attr, hid_t new_id) +{ + attr->p_setId(new_id); +} /*************************************************************************** Notes for H5A wrappers @@ -290,21 +285,22 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna //-------------------------------------------------------------------------- // Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this HDF5 object. +///\brief Deprecated - replaced by H5Location::getNumAttrs() +// brief Returns the number of attributes attached to this HDF5 object. ///\return Number of attributes ///\exception H5::AttributeIException // Programmer Binh-Minh Ribler - 2000 // Modification -// - Moved from H5Location in 1.8.20. -BMR Oct, 2017 +// - Moved to H5Location to allow passing an attribute id to the +// C API, in 1.8.20. //-------------------------------------------------------------------------- int H5Object::getNumAttrs() const { - H5O_info_t oinfo; /* Object info */ + H5O_info_t oinfo; /* Object info */ if(H5Oget_info(getId(), &oinfo) < 0) - throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); - else - return(static_cast<int>(oinfo.num_attrs)); + throwException("getNumAttrs", "H5Oget_info failed"); + return(static_cast<int>(oinfo.num_attrs)); } //-------------------------------------------------------------------------- @@ -321,11 +317,11 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const // If H5Iget_name returns a negative value, raise an exception if (name_size < 0) { - throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); + throwException("getObjName", "H5Iget_name failed"); } else if (name_size == 0) { - throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); + throwException("getObjName", "Object must have a name, but name length is 0"); } // Return length of the name return(name_size); @@ -337,7 +333,6 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const ///\return Name of the object ///\exception H5::Exception // Programmer Binh-Minh Ribler - Mar, 2014 -// Modification //-------------------------------------------------------------------------- H5std_string H5Object::getObjName() const { @@ -349,11 +344,11 @@ H5std_string H5Object::getObjName() const // If H5Iget_name failed, throw exception if (name_size < 0) { - throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); + throwException("getObjName", "H5Iget_name failed"); } else if (name_size == 0) { - throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); + throwException("getObjName", "Object must have a name, but name length is 0"); } // Object's name exists, retrieve it else if (name_size > 0) |