summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/H5I.c b/src/H5I.c
index cf78d3b..db3cf6c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -924,6 +924,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5I_subst
+ *
+ * Purpose: Substitute a new object pointer for the specified ID.
+ *
+ * Return: Success: Non-null previsou object pointer associated
+ * with the specified ID.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_subst(hid_t id, const void *new_object)
+{
+ H5I_id_info_t *id_ptr; /* Ptr to the atom */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_subst, NULL)
+
+ /* General lookup of the ID */
+ if(NULL == (id_ptr = H5I_find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
+
+ /* Get the old object pointer to return */
+ /* (Casting away const OK -QAK) */
+ ret_value = (void *)id_ptr->obj_ptr;
+
+ /* Set the new object pointer for the ID */
+ id_ptr->obj_ptr = new_object;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end if */
+
+
+/*-------------------------------------------------------------------------
* Function: H5I_object
*
* Purpose: Find an object pointer for the specified ID.