diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2013-03-29 23:13:05 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2013-03-29 23:13:05 (GMT) |
commit | 6c974c824db0c4b97a5ec5e03726ebe4a2198ad9 (patch) | |
tree | a89f756228cc72486ff1e71fbc68fd29baa01ba3 /c++/src/H5Location.cpp | |
parent | ed621aae38837e90c7273087de22f1752eee7cc7 (diff) | |
download | hdf5-6c974c824db0c4b97a5ec5e03726ebe4a2198ad9.zip hdf5-6c974c824db0c4b97a5ec5e03726ebe4a2198ad9.tar.gz hdf5-6c974c824db0c4b97a5ec5e03726ebe4a2198ad9.tar.bz2 |
[svn-r23495] ported revisions 23433:23494 from the trunk
Diffstat (limited to 'c++/src/H5Location.cpp')
-rw-r--r-- | c++/src/H5Location.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b93cd86..98878d7 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 +{ + return(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 |