diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 18:26:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 18:26:12 (GMT) |
commit | 27a1a10fbb6101a071ddb4f5f29e3bcaeb9ef8d0 (patch) | |
tree | dc5e01059a3f849f448403a23a62a55ff2bc45f7 /src/H5Gstab.c | |
parent | 095762a736c3125c0190409b7c3ca01c42605ad7 (diff) | |
download | hdf5-27a1a10fbb6101a071ddb4f5f29e3bcaeb9ef8d0.zip hdf5-27a1a10fbb6101a071ddb4f5f29e3bcaeb9ef8d0.tar.gz hdf5-27a1a10fbb6101a071ddb4f5f29e3bcaeb9ef8d0.tar.bz2 |
[svn-r14146] Description:
Move H5Gget_objtype_by_idx() to deprecated symbols section, replacing
with H5Oget_info_by_idx()
Tested on:
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
AIX/32 5.3 (copper)
Solaris/32 2.10 (linew)
Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r-- | src/H5Gstab.c | 222 |
1 files changed, 112 insertions, 110 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 269c224..e84f5e1 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -770,116 +770,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_get_type_by_idx_cb - * - * Purpose: Callback for B-tree iteration 'by index' info query to - * retrieve the type of an object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Nov 7, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) -{ - H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5G_stab_get_type_by_idx_cb) - - /* Sanity check */ - HDassert(ent); - HDassert(udata); - - /* Check for a soft link */ - switch(ent->type) { - case H5G_CACHED_SLINK: - udata->type = H5G_LINK; - break; - - default: - { - 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 = udata->common.f; - HDassert(H5F_addr_defined(ent->header)); - tmp_oloc.addr = ent->header; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type, udata->dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - udata->type = H5G_map_obj_type(obj_type); - } - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_type_by_idx_cb */ - - -/*------------------------------------------------------------------------- - * Function: H5G_get_objtype_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: UNKNOWN - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) -{ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5G_stab_get_type_by_idx, H5G_UNKNOWN) - - /* Sanity check */ - HDassert(oloc); - - /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") - - /* Set iteration information */ - udata.common.f = oloc->file; - udata.common.idx = idx; - udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_type_by_idx_cb; - udata.dxpl_id = dxpl_id; - udata.type = H5G_UNKNOWN; - - /* Iterate over the group members */ - if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_by_idx, stab.btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") - - /* If we don't know the type now, we almost certainly went out of bounds */ - if(udata.type == H5G_UNKNOWN) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound") - - /* Set the return value */ - ret_value = udata.type; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_type_by_idx() */ - - -/*------------------------------------------------------------------------- * Function: H5G_stab_lookup_cb * * Purpose: B-tree 'find' callback to retrieve location for an object @@ -1089,3 +979,115 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_stab_lookup_by_idx() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*------------------------------------------------------------------------- + * Function: H5G_stab_get_type_by_idx_cb + * + * Purpose: Callback for B-tree iteration 'by index' info query to + * retrieve the type of an object + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Nov 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) +{ + H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5G_stab_get_type_by_idx_cb) + + /* Sanity check */ + HDassert(ent); + HDassert(udata); + + /* Check for a soft link */ + switch(ent->type) { + case H5G_CACHED_SLINK: + udata->type = H5G_LINK; + break; + + default: + { + 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 = udata->common.f; + HDassert(H5F_addr_defined(ent->header)); + tmp_oloc.addr = ent->header; + + /* Get the type of the object */ + if(H5O_obj_type(&tmp_oloc, &obj_type, udata->dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + udata->type = H5G_map_obj_type(obj_type); + } + break; + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_stab_get_type_by_idx_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5G_get_objtype_by_idx + * + * Purpose: Private function for H5Gget_objtype_by_idx. + * Returns the type of objects in the group by giving index. + * + * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) + * + * Failure: UNKNOWN + * + * Programmer: Raymond Lu + * Nov 20, 2002 + * + *------------------------------------------------------------------------- + */ +H5G_obj_t +H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) +{ + H5O_stab_t stab; /* Info about local heap & B-tree */ + H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ + H5G_obj_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5G_stab_get_type_by_idx, H5G_UNKNOWN) + + /* Sanity check */ + HDassert(oloc); + + /* Get the B-tree & local heap info */ + if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") + + /* Set iteration information */ + udata.common.f = oloc->file; + udata.common.idx = idx; + udata.common.num_objs = 0; + udata.common.op = H5G_stab_get_type_by_idx_cb; + udata.dxpl_id = dxpl_id; + udata.type = H5G_UNKNOWN; + + /* Iterate over the group members */ + if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_by_idx, stab.btree_addr, &udata) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") + + /* If we don't know the type now, we almost certainly went out of bounds */ + if(udata.type == H5G_UNKNOWN) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound") + + /* Set the return value */ + ret_value = udata.type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_stab_get_type_by_idx() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + |