summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Location.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-05-13 11:00:33 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-05-13 11:00:33 (GMT)
commit8b1a53896565cafca3795d139a37148f89bf928d (patch)
treec4df84bc37434a0d4df14e73d65723c77e32d7ed /c++/src/H5Location.cpp
parent77eb59b4343c9c9d6786cf620ea4d9c498af279f (diff)
downloadhdf5-8b1a53896565cafca3795d139a37148f89bf928d.zip
hdf5-8b1a53896565cafca3795d139a37148f89bf928d.tar.gz
hdf5-8b1a53896565cafca3795d139a37148f89bf928d.tar.bz2
Add H5Lexists wrappers
Description: Added wrappers H5Location::exists() for H5Lexists. Added new class LinkAccPropList to be used by H5Location::exists() Rearranged source files in Makefile.am Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++/src/H5Location.cpp')
-rw-r--r--c++/src/H5Location.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 60f9c3b..f10ad0d 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -20,6 +20,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
@@ -353,6 +354,42 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new
}
//--------------------------------------------------------------------------
+// Function: H5Location::nameExists
+///\brief Checks if a link of a given name exists in a location
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Nov, 2016
+// Modification
+//--------------------------------------------------------------------------
+bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
+{
+ htri_t ret_value = H5Lexists(getId(), name, lapl.getId());
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Lexists returns a negative value
+ {
+ throw LocationException(inMemFunc("nameExists"), "H5Lexists failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::nameExists
+///\brief Checks if a link of a given name exists in a location
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Dec, 2016
+// Modification
+//--------------------------------------------------------------------------
+bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ return(nameExists(name.c_str(), lapl));
+}
+
+//--------------------------------------------------------------------------
// Function: H5Location::flush
///\brief Flushes all buffers associated with a location to disk.
///\param scope - IN: Specifies the scope of the flushing action,