summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CommonFG.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-02 19:15:43 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-02 19:15:43 (GMT)
commit85ca829e712aa303e74806fc1d9af8b900fdbc4f (patch)
treef73d94650d485f7c90d88c61449eb770a7730efc /c++/src/H5CommonFG.cpp
parent54cd6ecec92e81bdcac3299b844a61f14bc89d69 (diff)
downloadhdf5-85ca829e712aa303e74806fc1d9af8b900fdbc4f.zip
hdf5-85ca829e712aa303e74806fc1d9af8b900fdbc4f.tar.gz
hdf5-85ca829e712aa303e74806fc1d9af8b900fdbc4f.tar.bz2
[svn-r18685] Description:
Added missing overloaded function getObjTypeByIdx to return type name as a char*. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew)
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r--c++/src/H5CommonFG.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 2772903..7748963 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -1112,7 +1112,35 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const
// Function: CommonFG::getObjTypeByIdx
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function because it also provides
-/// the returned object type in text.
+/// the returned object type in text (char*)
+///\param idx - IN: Transient index of the object
+///\param type_name - IN: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - May, 2010
+//--------------------------------------------------------------------------
+H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const
+{
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
+ switch (obj_type)
+ {
+ case H5G_LINK: strcpy(type_name, "symbolic link"); break;
+ case H5G_GROUP: strcpy(type_name, "group"); break;
+ case H5G_DATASET: strcpy(type_name, "dataset"); break;
+ case H5G_TYPE: strcpy(type_name, "datatype"); break;
+ case H5G_UNKNOWN:
+ default:
+ {
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ }
+ }
+ return (obj_type);
+}
+//--------------------------------------------------------------------------
+// Function: CommonFG::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (H5std_string&)
///\param idx - IN: Transient index of the object
///\param type_name - IN: Object type in text
///\return Object type