summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2020-09-18 05:12:37 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2020-09-18 05:12:37 (GMT)
commitce0f87fb351c1aa0e7842e40ca5ea5e7d1c3da2b (patch)
tree07ee07f5d852e8873f035f907d770c496ed9fdaa /src
parent9eaeac2e1bb660d9b19a766e38764a6895ae22c4 (diff)
downloadhdf5-ce0f87fb351c1aa0e7842e40ca5ea5e7d1c3da2b.zip
hdf5-ce0f87fb351c1aa0e7842e40ca5ea5e7d1c3da2b.tar.gz
hdf5-ce0f87fb351c1aa0e7842e40ca5ea5e7d1c3da2b.tar.bz2
Add H5Ssel_iter_init API call to reset a selection iterator
Diffstat (limited to 'src')
-rw-r--r--src/H5Spublic.h1
-rw-r--r--src/H5Sselect.c46
2 files changed, 47 insertions, 0 deletions
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 1ca79ea..6e5c652 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -178,6 +178,7 @@ H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id,
H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq,
size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+H5_DLL herr_t H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id);
H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index eb5cf1c..d021f0c 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -3116,6 +3116,52 @@ done:
} /* end H5Ssel_iter_get_seq_list() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5Ssel_iter_reset
+ PURPOSE
+ Resets a dataspace selection iterator back to an initial state.
+ USAGE
+ herr_t H5Ssel_iter_reset(sel_iter_id)
+ hid_t sel_iter_id; IN: ID of the dataspace selection iterator to
+ reset
+ hid_t space_id; IN: ID of the dataspace with selection to
+ iterate over
+ RETURNS
+ Non-negative on success / Negative on failure
+ DESCRIPTION
+ Resets a dataspace selection iterator back to an initial state so that
+ the iterator may be used for iteration once again.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id)
+{
+ H5S_sel_iter_t *sel_iter;
+ H5S_t *space;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ii", sel_iter_id, space_id);
+
+ /* Check args */
+ if(NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator")
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Simply re-initialize iterator */
+ if(H5S_select_iter_init(sel_iter, space, sel_iter->elmt_size, sel_iter->flags) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to re-initialize selection iterator")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ssel_iter_reset() */
+
+
/*-------------------------------------------------------------------------
* Function: H5S_sel_iter_close
*