summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-16 23:19:32 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-16 23:19:32 (GMT)
commitf7711df680f2ccd07f23223deccb217440ec3788 (patch)
tree4ad4633af3ce182c14aecd4430135298d0a95371 /c++/src/H5IdComponent.cpp
parent368089572a079f0801ab7177aab2719d4cbd4e48 (diff)
parent98090fe3b08a0ff85ae9bc93218a14017a6f37fe (diff)
downloadhdf5-f7711df680f2ccd07f23223deccb217440ec3788.zip
hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.gz
hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.bz2
Merge pull request #334 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp2:develop to develop
* commit '98090fe3b08a0ff85ae9bc93218a14017a6f37fe': Purpose: Add new C++ wrappers Description: Added wrappers for H5Iis_valid, H5Ps/get_nlinks, H5Tget_create_plist, H5Oopen, H5Oclose and H5Pset_virtual
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 574b28a..0bcc67a 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -194,6 +194,27 @@ hsize_t IdComponent::getNumMembers(H5I_type_t type)
}
//--------------------------------------------------------------------------
+// Function: isValid (static)
+///\brief Checks if the given ID is valid.
+///\return true if the given identifier is valid, and false, otherwise.
+///\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: typeExists (static)
///\brief Queries if a given type is currently registered with the
/// library.