summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2020-09-21 23:39:35 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2020-09-21 23:39:35 (GMT)
commitfebc343e7ebd8469fbbd87f2f727d9e42a6be589 (patch)
treeaf7953452b3a9886671ad41587f705e17aa05ef0 /src
parent9eaeac2e1bb660d9b19a766e38764a6895ae22c4 (diff)
parent9b3a3445dbb72a95b2b9355e0196efdaa5b0f452 (diff)
downloadhdf5-febc343e7ebd8469fbbd87f2f727d9e42a6be589.zip
hdf5-febc343e7ebd8469fbbd87f2f727d9e42a6be589.tar.gz
hdf5-febc343e7ebd8469fbbd87f2f727d9e42a6be589.tar.bz2
Merge pull request #2891 in HDFFV/hdf5 from ~JHENDERSON/hdf52:develop to develop
* commit '9b3a3445dbb72a95b2b9355e0196efdaa5b0f452': Add release note for new H5Ssel_iter_reset function 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
*