diff options
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 30 |
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 |