From 883a235d5ca81770228c5cb5f9d162afda0b411f Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 25 Aug 2017 12:07:04 -0500 Subject: Miscellaneous improvements (cont.) Description: Put back H5Location::getNumObjs and marked as deprecated in favor of Group::getNumObjs. Platforms tested: Linux/32 2.6 (jam) Darwin (osx1010test) --- c++/src/H5Location.cpp | 17 +++++++++++++++++ c++/src/H5Location.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index a81e300..9f2d7d5 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1282,6 +1282,23 @@ int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t o #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- +// Function: H5Location::getNumObjs +///\brief Deprecated - moved to H5::Group in 1.10.2. +///\return Deprecated +///\exception Deprecated +// Programmer Binh-Minh Ribler - January, 2003 +//-------------------------------------------------------------------------- +hsize_t H5Location::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: H5Location::getObjnameByIdx ///\brief Returns the name of an object in this group, given the /// object's index. diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 41f7ca0..3dfa5d5 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -113,6 +113,10 @@ class H5_DLLCPP H5Location : public IdComponent { H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; + // Returns the number of objects in this group. + // Deprecated - moved to H5::Group in 1.10.2. + hsize_t getNumObjs() const; + // Retrieves the name of an object in this group, given the // object's index. H5std_string getObjnameByIdx(hsize_t idx) const; -- cgit v0.12