summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-02-23 22:53:16 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-02-23 22:53:16 (GMT)
commitd7c6fa00da4ddb9de5501b27e5496045ccb98572 (patch)
treed13939c871fce92b84af5d716f23ab92cfd2faf8 /c++/src/H5IdComponent.cpp
parentb55626e0715204f56f192911f1a44e4a430b42b2 (diff)
downloadhdf5-d7c6fa00da4ddb9de5501b27e5496045ccb98572.zip
hdf5-d7c6fa00da4ddb9de5501b27e5496045ccb98572.tar.gz
hdf5-d7c6fa00da4ddb9de5501b27e5496045ccb98572.tar.bz2
Purpose: Add new C++ wrappers
Description: Added wrappers for H5Fget_info2, H5Inmembers, and H5Itype_exists // Gets general information about this file. void getFileInfo(H5F_info2_t& file_info) const; // Returns the number of members in a type. static hsize_t getNumMembers(H5I_type_t type); // Determines if an element type exists. static bool typeExists(H5I_type_t type); Platforms tested: Linux/32 2.6 (jam) Linux/64 (jelly) Darwin (osx1010test)
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index f3d916a..ae60c5e 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -162,6 +162,72 @@ H5I_type_t IdComponent::getHDFObjType() const
}
//--------------------------------------------------------------------------
+// Function: getNumMembers (static)
+///\brief Returns the number of members of the given type.
+///\return Number of members
+///\Description
+/// If there is no member of the given type, getNumMembers will
+/// return 0. Valid types are:
+/// \li \c H5I_FILE (= 1)
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE
+/// \li \c H5I_VFL
+/// \li \c H5I_GENPROP_CLS
+/// \li \c H5I_GENPROP_LST
+/// \li \c H5I_ERROR_CLASS
+/// \li \c H5I_ERROR_MSG
+/// \li \c H5I_ERROR_STACK
+// Programmer Binh-Minh Ribler - Feb, 2017
+//--------------------------------------------------------------------------
+hsize_t IdComponent::getNumMembers(H5I_type_t type)
+{
+ hsize_t nmembers = 0;
+ herr_t ret_value = H5Inmembers(type, &nmembers);
+ if (ret_value < 0)
+ throw IdComponentException("getNumMembers", "H5Inmembers failed");
+ else
+ return(nmembers);
+}
+
+//--------------------------------------------------------------------------
+// Function: typeExists (static)
+///\brief Queries if a given type is currently registered with the
+/// library.
+///\return true if the given type exists, and false, otherwise.
+///\Description
+/// Valid types are:
+/// \li \c H5I_FILE (= 1)
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE
+/// \li \c H5I_VFL
+/// \li \c H5I_GENPROP_CLS
+/// \li \c H5I_GENPROP_LST
+/// \li \c H5I_ERROR_CLASS
+/// \li \c H5I_ERROR_MSG
+/// \li \c H5I_ERROR_STACK
+// Programmer Binh-Minh Ribler - Feb, 2017
+//--------------------------------------------------------------------------
+bool IdComponent::typeExists(H5I_type_t type)
+{
+ // Call C function
+ htri_t ret_value = H5Itype_exists(type);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Itype_exists returns a negative value
+ throw IdComponentException("typeExists", "H5Itype_exists failed");
+}
+
+//--------------------------------------------------------------------------
// Function: IdComponent::operator=
///\brief Assignment operator.
///\param rhs - IN: Reference to the existing object