summaryrefslogtreecommitdiffstats
path: root/src/H5EA.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-04-05 07:12:56 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-04-05 07:12:56 (GMT)
commit5d46ad9b3984dcddffaf369a92a8ef95339f8547 (patch)
treec2d31d43ca3a4030d6809b65d719e064ca27fa17 /src/H5EA.c
parenta816d031089f0afd2f2a2261a4e0d6277491e8b5 (diff)
downloadhdf5-5d46ad9b3984dcddffaf369a92a8ef95339f8547.zip
hdf5-5d46ad9b3984dcddffaf369a92a8ef95339f8547.tar.gz
hdf5-5d46ad9b3984dcddffaf369a92a8ef95339f8547.tar.bz2
[svn-r29635] Description:
Bring support for earray and v2 B-trees from revise_chunks branch to trunk. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (h5committest forthcoming)
Diffstat (limited to 'src/H5EA.c')
-rw-r--r--src/H5EA.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index 34173e4..756eb93 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -88,6 +88,8 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* client class..
*/
const H5EA_class_t *const H5EA_client_class_g[] = {
+ H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */
+ H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */
H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
};
@@ -104,6 +106,8 @@ const H5EA_class_t *const H5EA_client_class_g[] = {
/* Declare a free list to manage the H5EA_t struct */
H5FL_DEFINE_STATIC(H5EA_t);
+/* Declare a PQ free list to manage the element */
+H5FL_BLK_DEFINE(ea_native_elmt);
/*-------------------------------------------------------------------------
@@ -1032,3 +1036,87 @@ CATCH
END_FUNC(PRIV) /* end H5EA_delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_iterate
+ *
+ * Purpose: Iterate over the elements of an extensible array
+ * (copied and modified from FA_iterate() in H5FA.c)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi; Feb 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PRIV, ERR,
+herr_t, SUCCEED, FAIL,
+H5EA_iterate(H5EA_t *ea, hid_t dxpl_id, H5EA_operator_t op, void *udata))
+
+ /* Local variables */
+ uint8_t *elmt = NULL;
+ hsize_t u;
+
+ /*
+ * Check arguments.
+ */
+ HDassert(ea);
+ HDassert(op);
+ HDassert(udata);
+
+ /* Allocate space for a native array element */
+ if(NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
+
+ /* Iterate over all elements in array */
+ for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) {
+ int cb_ret; /* Return value from callback */
+
+ /* Get array element */
+ if(H5EA_get(ea, dxpl_id, u, elmt) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+
+ /* Make callback */
+ if((cb_ret = (*op)(u, elmt, udata)) < 0) {
+ H5E_PRINTF(H5E_BADITER, "iterator function failed");
+ H5_LEAVE(cb_ret)
+ } /* end if */
+ } /* end for */
+
+CATCH
+
+ if(elmt)
+ elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
+
+END_FUNC(PRIV) /* end H5EA_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_patch_file
+ *
+ * Purpose: Patch the top-level file pointer contained in ea
+ * to point to idx_info->f if they are different.
+ * This is possible because the file pointer in ea can be
+ * closed out if ea remains open.
+ *
+ * Return: SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PRIV, NOERR,
+herr_t, SUCCEED, -,
+H5EA_patch_file(H5EA_t *ea, H5F_t *f))
+
+ /* Local variables */
+
+ /*
+ * Check arguments.
+ */
+ HDassert(ea);
+ HDassert(f);
+
+ if(ea->f != f || ea->hdr->f != f)
+ ea->f = ea->hdr->f = f;
+
+END_FUNC(PRIV) /* end H5EA_patch_file() */
+