diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-20 00:19:46 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-04-20 00:19:46 (GMT) |
commit | 365ca1225d447e1680d9c0dbe00c375655c3948d (patch) | |
tree | 509845d3928879ed774f8c48d44acb669565f1c2 /src/H5I.c | |
parent | beb0079ae11d4932a1ce91545e49801ac206c75a (diff) | |
download | hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.zip hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.tar.gz hdf5-365ca1225d447e1680d9c0dbe00c375655c3948d.tar.bz2 |
[svn-r8397] Purpose:
h5repack in 1.6
Description:
2 functions we re added to /src:
H5Premove filter and H5Iget_file_id
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 92 |
1 files changed, 92 insertions, 0 deletions
@@ -1434,3 +1434,95 @@ done: } #endif /* H5I_DEBUG_OUTPUT */ + + +/*------------------------------------------------------------------------- + * Function: H5Iget_file_id + * + * Purpose: The public version of H5I_get_file_id(), obtains the file + * ID given an object ID. User has to close this ID. + * + * Return: Success: file ID + * + * Failure: a negative value + * + * Programmer: Raymond Lu + * Oct 27, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hid_t +H5Iget_file_id(hid_t obj_id) +{ + hid_t ret_value; + + FUNC_ENTER_API(H5Iget_file_id, FAIL); + H5TRACE1("i","i",obj_id); + + if((ret_value = H5I_get_file_id(obj_id))<0) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID"); + +done: + FUNC_LEAVE_API(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5I_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: file ID + * + * Failure: a negative value + * + * Programmer: Raymond Lu + * Oct 27, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hid_t +H5I_get_file_id(hid_t obj_id) +{ + H5G_entry_t *ent; + hid_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id); + + /* Get object type */ + switch(H5I_GROUP(obj_id)) { + case H5I_FILE: + ret_value = obj_id; + + /* Increment reference count on atom. */ + if (H5I_inc_ref(ret_value)<0) + HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed"); + + break; + + case H5I_DATATYPE: + if((ent = H5G_loc(obj_id))==NULL) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype"); + ret_value = H5F_get_id(ent->file); + break; + + case H5I_GROUP: + case H5I_DATASET: + case H5I_ATTR: + if((ent = H5G_loc(obj_id))==NULL) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info"); + ret_value = H5F_get_id(ent->file); + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); +}
\ No newline at end of file |