summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-02-03 15:05:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-02-03 15:05:41 (GMT)
commitc8d05fbe4d4d135ee2ec352f6437e43bdbe423b7 (patch)
tree1257e54854f3b85d498ad078aaa562cc9cd2680d /src/H5O.c
parent1c05d48b9329e05f874e494c45c429f6cadc1ee5 (diff)
downloadhdf5-c8d05fbe4d4d135ee2ec352f6437e43bdbe423b7.zip
hdf5-c8d05fbe4d4d135ee2ec352f6437e43bdbe423b7.tar.gz
hdf5-c8d05fbe4d4d135ee2ec352f6437e43bdbe423b7.tar.bz2
[svn-r18205] Description:
Add prototype of new H5Oexists() API routine. Tested on: Mac OS X/32 10.6.2 (amazon) (further tests pending shortly)
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 d437f8f..253ed8d 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -537,6 +537,47 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Oexists
+ *
+ * Purpose: Determine if a linked-to object exists
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * February 2 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Oexists(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, 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() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Oget_info
*
* Purpose: Retrieve information about an object.