summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2013-09-30 19:44:52 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2013-09-30 19:44:52 (GMT)
commit467050b23dca60a1177b1fb7dc6e080709e08dac (patch)
treea97ed61b21df2f6eab3b12bd4a1e70f69c73780d /c++/src
parenteccd41643b07c2e33b2c163cfc8c71a9f60a54d3 (diff)
downloadhdf5-467050b23dca60a1177b1fb7dc6e080709e08dac.zip
hdf5-467050b23dca60a1177b1fb7dc6e080709e08dac.tar.gz
hdf5-467050b23dca60a1177b1fb7dc6e080709e08dac.tar.bz2
[svn-r24229] Purpose: Fix bug HDFFV-7520
Description: Added wrappers for H5Aexists. (merged from trunk) Platforms Tested: Linux/32 2.6 (jam) Linux/64 2.6 (koala) Linux/ppc64 (ostrich)
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5Location.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index a527712..1307740 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -250,6 +250,39 @@ int H5Location::getNumAttrs() const
}
//--------------------------------------------------------------------------
+// Function: H5Location::attrExists
+///\brief Checks whether the named attribute exists at this location.
+///\param name - IN: Name of the attribute to be queried
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2013
+//--------------------------------------------------------------------------
+bool H5Location::attrExists(const char* name) const
+{
+ // Call C routine H5Aexists to determine whether an attribute exists
+ // at this location, which could be specified by a file, group, dataset,
+ // or named datatype.
+ herr_t ret_value = H5Aexists(getId(), name);
+ if( ret_value > 0 )
+ return true;
+ else if(ret_value == 0)
+ return false;
+ else // Raise exception when H5Aexists returns a negative value
+ throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::attrExists
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+bool H5Location::attrExists(const H5std_string& name) const
+{
+ attrExists(name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: H5Location::removeAttr
///\brief Removes the named attribute from this object.
///\param name - IN: Name of the attribute to be removed