summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Location.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2013-03-23 17:37:49 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2013-03-23 17:37:49 (GMT)
commit1f6cd26a93875c34d3a43921fe0d9637879b15ae (patch)
treeb87d0d0885d80240d9db183c7bb99740fb1e13d2 /c++/src/H5Location.cpp
parent5c459618453c684cd7bcd8c2b8117bb3e6ad1b27 (diff)
downloadhdf5-1f6cd26a93875c34d3a43921fe0d9637879b15ae.zip
hdf5-1f6cd26a93875c34d3a43921fe0d9637879b15ae.tar.gz
hdf5-1f6cd26a93875c34d3a43921fe0d9637879b15ae.tar.bz2
[svn-r23438] Purpose: Fix bug HDFFV-7520
Description: Added wrappers for H5Aexists. Platforms Tested: Linux/32 2.6 (jam) Linux/64 2.6 (koala) Linux/ppc64 (ostrich)
Diffstat (limited to 'c++/src/H5Location.cpp')
-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 b93cd86..be59f51 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