summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
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/H5Sselect.c
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/H5Sselect.c')
-rw-r--r--src/H5Sselect.c46
1 files changed, 46 insertions, 0 deletions
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
*