diff options
Diffstat (limited to 'src/H5Gdense.c')
-rw-r--r-- | src/H5Gdense.c | 154 |
1 files changed, 78 insertions, 76 deletions
diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 98e216c..5ce4475 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -1254,82 +1254,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Note: This routine assumes a lookup on the link name index in - * increasing order and isn't currently set up to be as - * flexible as other routines in this code module, because - * the H5Gget_objtype_by_idx that it's supporting is - * deprecated. - * - * Return: Success: Non-negative, object type - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 19 2006 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, - hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5G_dense_get_type_by_idx, H5G_UNKNOWN) - - /* - * Check arguments. - */ - HDassert(f); - HDassert(linfo); - - /* Build the table of links for this group */ - if(H5G_dense_build_table(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD) { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = f; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G_link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_type_by_idx() */ - - -/*------------------------------------------------------------------------- * Function: H5G_dense_remove_fh_cb * * Purpose: Callback for fractal heap operator when removing links @@ -1823,3 +1747,81 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_dense_delete() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*------------------------------------------------------------------------- + * Function: H5G_dense_get_type_by_idx + * + * Purpose: Returns the type of objects in the group by giving index. + * + * Note: This routine assumes a lookup on the link name index in + * increasing order and isn't currently set up to be as + * flexible as other routines in this code module, because + * the H5Gget_objtype_by_idx that it's supporting is + * deprecated. + * + * Return: Success: Non-negative, object type + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 19 2006 + * + *------------------------------------------------------------------------- + */ +H5G_obj_t +H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, + hsize_t idx) +{ + H5G_link_table_t ltable = {0, NULL}; /* Table of links */ + H5G_obj_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5G_dense_get_type_by_idx, H5G_UNKNOWN) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(linfo); + + /* Build the table of links for this group */ + if(H5G_dense_build_table(f, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") + + /* Check for going out of bounds */ + if(idx >= ltable.nlinks) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound") + + /* Determine type of object */ + if(ltable.lnks[idx].type == H5L_TYPE_SOFT) + ret_value = H5G_LINK; + else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) + ret_value = H5G_UDLINK; + else if(ltable.lnks[idx].type == H5L_TYPE_HARD) { + H5O_loc_t tmp_oloc; /* Temporary object location */ + H5O_type_t obj_type; /* Type of object at location */ + + /* Build temporary object location */ + tmp_oloc.file = f; + tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; + + /* Get the type of the object */ + if(H5O_obj_type(&tmp_oloc, &obj_type, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") + + /* Map to group object type */ + if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") + } else { + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") + } /* end else */ + +done: + /* Release link table */ + if(ltable.lnks && H5G_link_release_table(<able) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_dense_get_type_by_idx() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + |