summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-27 05:31:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-27 05:31:54 (GMT)
commite32aacbfed751a2ffb2df9579562acfba8e4da37 (patch)
tree6faf99027f82702d73fa7ab835c0d85747b66035 /src/H5O.c
parent5c1fedcb9003ab614db83a15723bb0fc0389e3c7 (diff)
downloadhdf5-e32aacbfed751a2ffb2df9579562acfba8e4da37.zip
hdf5-e32aacbfed751a2ffb2df9579562acfba8e4da37.tar.gz
hdf5-e32aacbfed751a2ffb2df9579562acfba8e4da37.tar.bz2
[svn-r12974] Description:
Add H5Oget_info() and H5Oget_info_by_idx() API routines & tests Tested on: FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir) Mac OS X/32 10.4.8 (amazon) AIX/32 5.? (copper)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/H5O.c b/src/H5O.c
index cec411e..7db15a8 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -609,6 +609,74 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_idx
+ *
+ * Purpose: Retrieve information about an object, according to the order
+ * of an index.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5L_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location of group */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Oget_info_by_idx, FAIL)
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!group_name || !*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(idx_type <= H5L_INDEX_UNKNOWN || idx_type >= H5L_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+ if(H5P_DEFAULT == lapl_id)
+ lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location, according to the order in the index */
+ if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
+ loc_found = TRUE;
+
+ /* Retrieve the object's information */
+ if(H5O_get_info(obj_loc.oloc, oinfo, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info")
+
+done:
+ /* Release the object location */
+ if(loc_found)
+ if(H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_idx() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_open_by_loc
*
* Purpose: Opens an object and returns an ID given its group loction.