diff options
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 101 |
1 files changed, 55 insertions, 46 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index c88f6c1..339af54 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -68,21 +68,21 @@ using namespace std; /// then a default size is chosen. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group CommonFG::createGroup( const char* name, size_t size_hint ) const + Group CommonFG::createGroup( const char* name, size_t size_hint ) const { - // Group creation property list for size_hint - hid_t gcpl_id = 0; - - // Set the local heap size hint - if(!(size_hint == (size_t)-1 || size_hint == 0)) { + // Group creation property list for size hint + hid_t gcpl_id = 0; + // Set the local heap size hint + if (size_hint > 0) + { // If the creation of the property list failed, throw an exception - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) throwException("createGroup", "H5Pcreate failed"); - if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { + if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { H5Pclose(gcpl_id); - throwException("createGroup", "H5Pset_local_heap_size failed"); + throwException("createGroup", "H5Pset_local_heap_size_hint failed"); } } @@ -269,6 +269,9 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne ret_value = H5Lcreate_soft( curr_name, getLocId(), new_name, H5P_DEFAULT, H5P_DEFAULT ); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: throwException("link", "unknown link type"); break; @@ -328,7 +331,7 @@ void CommonFG::unlink( const H5std_string& name ) const /// Exercise care in moving groups as it is possible to render /// data in a file inaccessible with Group::move. Please refer /// to the Group Interface in the HDF5 User's Guide for details at: -/// http://www.hdfgroup.org/HDF5/doc/UG/UG_frame09Groups.html +/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm // Programmer Binh-Minh Ribler - 2000 // Modification // 2007: QAK modified to use H5L APIs - BMR @@ -496,18 +499,21 @@ void CommonFG::mount(const char* name, const H5File& child, const PropList& plis //-------------------------------------------------------------------------- // Function: CommonFG::mount -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param name - IN: Name of the group -///\param child - IN: File to mount -///\param plist - IN: Property list to use -///\exception H5::FileIException or H5::GroupIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param name - IN: Name of the group +// Param child - IN: File to mount +// Param plist - IN: Property list to use +// Exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void CommonFG::mount(const char* name, H5File& child, PropList& plist) const { - mount(name, (const H5File)child, (const PropList)plist); + mount(name, child, plist); } //-------------------------------------------------------------------------- @@ -523,14 +529,17 @@ void CommonFG::mount(const H5std_string& name, const H5File& child, const PropLi //-------------------------------------------------------------------------- // Function: CommonFG::mount -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. // Programmer Binh-Minh Ribler - 2014 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const { - mount(name.c_str(), (const H5File)child, (const PropList)plist); + mount(name.c_str(), child, plist); } //-------------------------------------------------------------------------- @@ -1034,6 +1043,8 @@ H5O_type_t CommonFG::childObjType(const char* objname) const case H5O_TYPE_NAMED_DATATYPE: objtype = objinfo.type; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: throwException("childObjType", "Unknown type of object"); } @@ -1107,6 +1118,8 @@ H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_ case H5O_TYPE_NAMED_DATATYPE: objtype = objinfo.type; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: throwException("childObjType", "Unknown type of object"); } @@ -1195,21 +1208,13 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const ///\return Object type ///\exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - May, 2010 +// Modification +// Modified to use the other function. -BMR, 2016/03/07 //-------------------------------------------------------------------------- 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: HDstrcpy(type_name, "symbolic link"); break; - case H5G_GROUP: HDstrcpy(type_name, "group"); break; - case H5G_DATASET: HDstrcpy(type_name, "dataset"); break; - case H5G_TYPE: HDstrcpy(type_name, "datatype"); break; - case H5G_UNKNOWN: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } - return (obj_type); + H5std_string stype_name(type_name); + return(getObjTypeByIdx(idx, stype_name)); } //-------------------------------------------------------------------------- // Function: CommonFG::getObjTypeByIdx @@ -1224,18 +1229,22 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const //-------------------------------------------------------------------------- H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const { - H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); - switch (obj_type) - { - case H5G_LINK: type_name = H5std_string("symbolic link"); break; - case H5G_GROUP: type_name = H5std_string("group"); break; - case H5G_DATASET: type_name = H5std_string("dataset"); break; - case H5G_TYPE: type_name = H5std_string("datatype"); break; - case H5G_UNKNOWN: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } - return (obj_type); + H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); + switch (obj_type) + { + case H5G_LINK: type_name = H5std_string("symbolic link"); break; + case H5G_GROUP: type_name = H5std_string("group"); break; + case H5G_DATASET: type_name = H5std_string("dataset"); break; + case H5G_TYPE: type_name = H5std_string("datatype"); break; + case H5G_UNKNOWN: + case H5G_UDLINK: + case H5G_RESERVED_5: + case H5G_RESERVED_6: + case H5G_RESERVED_7: + default: + throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); + } + return (obj_type); } #endif // DOXYGEN_SHOULD_SKIP_THIS |