summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5CommonFG.cpp30
-rw-r--r--c++/src/H5CommonFG.h1
2 files changed, 30 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
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 75c9259..4f32d21 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -78,6 +78,7 @@ class H5_DLLCPP CommonFG {
// Returns the type of an object in this group, given the
// object's index.
H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
// Returns information about an HDF5 object, given by its name,