summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CommonFG.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-03 13:12:12 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-03 13:12:12 (GMT)
commit365e16c48068329b627e0974c7c3ce64f44920db (patch)
treef9651d6b8d6fdfa38de1af409c13e49f1f358b71 /c++/src/H5CommonFG.cpp
parent47fef210e85ecce83cfd1e1971f7748ed9ef3324 (diff)
downloadhdf5-365e16c48068329b627e0974c7c3ce64f44920db.zip
hdf5-365e16c48068329b627e0974c7c3ce64f44920db.tar.gz
hdf5-365e16c48068329b627e0974c7c3ce64f44920db.tar.bz2
[svn-r18689] 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 0b1ff21..a86d1ab 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