summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-09 21:59:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-09 21:59:13 (GMT)
commitcc1c7331a5f57b1d8beae65c257164e11060ebef (patch)
tree8fa82792e82c57b48da65fce053c7b48339fd4a9 /src/H5O.c
parent658c1b9e75291ea3dba584d93fda02f0079afc02 (diff)
downloadhdf5-cc1c7331a5f57b1d8beae65c257164e11060ebef.zip
hdf5-cc1c7331a5f57b1d8beae65c257164e11060ebef.tar.gz
hdf5-cc1c7331a5f57b1d8beae65c257164e11060ebef.tar.bz2
[svn-r18223] Description:
Bring r18205 & r18222 from trunk to 1.8 branch: Add new H5Oexists_by_name() routine. Tested on: Mac OS X/32 10.6.2 (amazon) w/debug & production (daily tested on trunk already)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/H5O.c b/src/H5O.c
index a443724..52db34f 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -536,6 +536,47 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Oexists_by_name
+ *
+ * Purpose: Determine if a linked-to object exists
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * February 2 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location info */
+ hid_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_API(H5Oexists_by_name, FAIL)
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ 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")
+
+ /* Check if the object exists */
+ if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oexists_by_name() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Oget_info
*
* Purpose: Retrieve information about an object.