diff options
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r-- | src/H5Gdeprec.c | 99 |
1 files changed, 50 insertions, 49 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 9145b3b..bf90f1e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -787,6 +787,56 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, done: FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5Gget_num_objs + * + * Purpose: Returns the number of objects in the group. It iterates + * all B-tree leaves and sum up total number of group members. + * + * Note: Deprecated in favor of H5Gget_info + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Nov 20, 2002 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) +{ + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(H5Gget_num_objs, FAIL) + H5TRACE2("e", "i*h", loc_id, num_objs); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + if(!num_objs) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + + /* Retrieve information about the group */ + if(H5G_obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") + + /* Set the number of objects [sic: links] in the group */ + *num_objs = grp_info.nlinks; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_num_objs() */ + #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1022,52 +1072,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_objinfo() */ - -/*------------------------------------------------------------------------- - * Function: H5Gget_num_objs - * - * Purpose: Returns the number of objects in the group. It iterates - * all B-tree leaves and sum up total number of group members. - * - * Note: Deprecated in favor of H5Gget_info - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) -{ - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(H5Gget_num_objs, FAIL) - H5TRACE2("e", "i*h", loc_id, num_objs); - - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - if(!num_objs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - - /* Retrieve information about the group */ - if(H5G_obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") - - /* Set the number of objects [sic: links] in the group */ - *num_objs = grp_info.nlinks; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_num_objs() */ - |