summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 7054369..a8e8ba4 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -163,6 +163,27 @@ H5I_type_t IdComponent::getHDFObjType() const
}
//--------------------------------------------------------------------------
+// Function: isValid (static)
+///\brief Checks if the given ID is valid.
+///\return true if the given identifier is valid, and false, otherwise.
+///\par Description
+/// A valid ID is one that is in use and has an application
+/// reference count of at least 1.
+// Programmer Binh-Minh Ribler - Mar 1, 2017
+//--------------------------------------------------------------------------
+bool IdComponent::isValid(hid_t an_id)
+{
+ // Call C function
+ htri_t ret_value = H5Iis_valid(an_id);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Iis_valid returns a negative value
+ throw IdComponentException("isValid", "H5Iis_valid failed");
+}
+
+//--------------------------------------------------------------------------
// Function: IdComponent::operator=
///\brief Assignment operator.
///\param rhs - IN: Reference to the existing object