summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
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.