summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CommonFG.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2005-03-14 19:32:26 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2005-03-14 19:32:26 (GMT)
commit49fa4563ef21009a05c11da5e05d0e71d2c24366 (patch)
tree73f57a583375fef27b3616e0febaa786394c7ae5 /c++/src/H5CommonFG.cpp
parent7e6577fdea9f78e4b140f2b1c7684c9cec7d9a7e (diff)
downloadhdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.zip
hdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.tar.gz
hdf5-49fa4563ef21009a05c11da5e05d0e71d2c24366.tar.bz2
[svn-r10212] Purpose: Added more wrappers
Description: Added the following to the C++ library + overloaded functions: string CommonFG::getObjnameByIdx(hsize_t idx) H5T_order_t AtomType::getOrder() + wrappers for H5*close + wrappers for H5Arename, H5Aget_storage_size, and H5Dget_storage_size Platforms tested: Linux 2.4 (heping) AIX 5.1 (copper) SunOS 5.8 64-bit (sol)
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r--c++/src/H5CommonFG.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 05da7bd..61fa5a1 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -756,6 +756,40 @@ hsize_t CommonFG::getNumObjs() const
//--------------------------------------------------------------------------
// Function: CommonFG::getObjnameByIdx
+///\brief Returns the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object name
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c CommonFG::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+string CommonFG::getObjnameByIdx(hsize_t idx) const
+{
+ // call H5Gget_objname_by_idx with name as NULL to get its length
+ ssize_t name_len = H5Gget_objname_by_idx(getLocId(), idx, NULL, 0);
+ if(name_len < 0)
+ {
+ throwException("getObjnameByIdx", "H5Gget_objname_by_idx failed");
+ }
+
+ // now, allocate C buffer to get the name
+ char* name_C = new char[name_len];
+ name_len = H5Gget_objname_by_idx(getLocId(), idx, name_C, name_len);
+
+ // clean up and return the string
+ string name = string(name_C);
+ delete [] name_C;
+ return (name);
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::getObjnameByIdx
///\brief Retrieves the name of an object in this group, given the
/// object's index.
///\param idx - IN: Transient index of the object