summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Group.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-08-24 18:46:39 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-08-24 18:46:39 (GMT)
commit0e44181bbb9797bdf4c7b2c192a457639a4e5ea1 (patch)
tree0a2a276797b42ed90291f69de87f8b65b9578bf2 /c++/src/H5Group.cpp
parenta6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff)
downloadhdf5-0e44181bbb9797bdf4c7b2c192a457639a4e5ea1.zip
hdf5-0e44181bbb9797bdf4c7b2c192a457639a4e5ea1.tar.gz
hdf5-0e44181bbb9797bdf4c7b2c192a457639a4e5ea1.tar.bz2
Miscellaneous improvements
Description: Moved H5Location::getNumObjs to Group::getNumObjs (i.e., H5Gget_info) Switched reinterpret_cast to static_cast in H5Object::iterateAttrs Miscellaneous cleanup Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++/src/H5Group.cpp')
-rw-r--r--c++/src/H5Group.cpp93
1 files changed, 55 insertions, 38 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 994d9ff..c0e0dd1 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -62,44 +62,6 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
}
//--------------------------------------------------------------------------
-// Function: Group::getObjId
-///\brief Opens an object via object header.
-///\param obj_name - IN: Path to the object
-///\param plist - IN: Access property list for the link pointing to
-/// the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// This function opens an object in a group or file, using
-/// H5Oopen. Thus, an object can be opened without knowing
-/// the object's type.
-// Programmer Binh-Minh Ribler - March, 2017
-//--------------------------------------------------------------------------
-hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
-{
- hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
- if (ret_value < 0)
- {
- throwException("Group::getObjId", "H5Oopen failed");
- }
- return(ret_value);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::getObjId
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the object's name.
-///\param obj_name - IN: Path to the object
-///\param plist - IN: Access property list for the link pointing to
-/// the object
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - March, 2017
-//--------------------------------------------------------------------------
-hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
-{
- return(getObjId(obj_name.c_str(), plist));
-}
-
-//--------------------------------------------------------------------------
// Function: Group::closeObjId
///\brief Closes an object, which was opened with Group::getObjId
///\exception H5::FileIException or H5::GroupIException
@@ -181,6 +143,61 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
*/
//--------------------------------------------------------------------------
+// Function: Group::getNumObjs
+///\brief Returns the number of objects in this group.
+///\return Number of objects
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+hsize_t Group::getNumObjs() const
+{
+ H5G_info_t ginfo; // Group information
+
+ herr_t ret_value = H5Gget_info(getId(), &ginfo);
+ if(ret_value < 0)
+ throwException("getNumObjs", "H5Gget_info failed");
+ return (ginfo.nlinks);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief Opens an object via object header.
+///\param obj_name - IN: Path to the object
+///\param plist - IN: Access property list for the link pointing to
+/// the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// This function opens an object in a group or file, using
+/// H5Oopen. Thus, an object can be opened without knowing
+/// the object's type.
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
+{
+ hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
+ if (ret_value < 0)
+ {
+ throwException("Group::getObjId", "H5Oopen failed");
+ }
+ return(ret_value);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the object's name.
+///\param obj_name - IN: Path to the object
+///\param plist - IN: Access property list for the link pointing to
+/// the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
+{
+ return(getObjId(obj_name.c_str(), plist));
+}
+
+//--------------------------------------------------------------------------
// Function: Group::getId
///\brief Get the id of this group
///\return Group identifier