summaryrefslogtreecommitdiffstats
path: root/src/H5Snone.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-13 19:08:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-13 19:08:17 (GMT)
commit925f2ba71017081543f904a6a113055432693dab (patch)
treeb0f6e886d3da273d6588c453eab6f18bc8e827e8 /src/H5Snone.c
parentb33344a7bebf46ff905b10c751cf39f7974e88d3 (diff)
downloadhdf5-925f2ba71017081543f904a6a113055432693dab.zip
hdf5-925f2ba71017081543f904a6a113055432693dab.tar.gz
hdf5-925f2ba71017081543f904a6a113055432693dab.tar.bz2
[svn-r8673] Purpose:
Code optimization Description: Revised dataspace selections to use a more "object oriented" mechanism to set the function pointers for each selection and selection iterator. This reduces the amount and number of times that dataspace selection info has to be copied. Additionally, change hyperslab selection information to be dynamically allocated instead of an inline struct. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'src/H5Snone.c')
-rw-r--r--src/H5Snone.c81
1 files changed, 57 insertions, 24 deletions
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 4409d2b..9e5e726 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -37,6 +37,24 @@
static int interface_initialize_g = 0;
/* Static function prototypes */
+
+/* Selection callbacks */
+static herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+static herr_t H5S_none_release(H5S_t *space);
+static htri_t H5S_none_is_valid(const H5S_t *space);
+static hssize_t H5S_none_serial_size(const H5S_t *space);
+static herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
+static herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf);
+static herr_t H5S_none_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static htri_t H5S_none_is_contiguous(const H5S_t *space);
+static htri_t H5S_none_is_single(const H5S_t *space);
+static htri_t H5S_none_is_regular(const H5S_t *space);
+static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+
+/* Selection iteration callbacks */
static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter);
@@ -45,6 +63,39 @@ static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter);
+/* Selection properties for "none" selections */
+const H5S_select_class_t H5S_sel_none[1] = {{
+ H5S_SEL_NONE,
+
+ /* Methods on selection */
+ H5S_none_copy,
+ H5S_none_get_seq_list,
+ H5S_none_release,
+ H5S_none_is_valid,
+ H5S_none_serial_size,
+ H5S_none_serialize,
+ H5S_none_deserialize,
+ H5S_none_bounds,
+ H5S_none_is_contiguous,
+ H5S_none_is_single,
+ H5S_none_is_regular,
+ H5S_none_iter_init,
+}};
+
+/* Iteration properties for "none" selections */
+static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
+ H5S_SEL_NONE,
+
+ /* Methods on selection iterator */
+ H5S_none_iter_coords,
+ H5S_none_iter_block,
+ H5S_none_iter_nelmts,
+ H5S_none_iter_has_next_block,
+ H5S_none_iter_next,
+ H5S_none_iter_next_block,
+ H5S_none_iter_release,
+}};
+
/*-------------------------------------------------------------------------
* Function: H5S_none_iter_init
@@ -68,17 +119,11 @@ H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space)
FUNC_ENTER_NOAPI(H5S_none_iter_init, FAIL);
/* Check args */
- assert (space && H5S_SEL_NONE==space->select.type);
+ assert (space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space));
assert (iter);
- /* Initialize methods for selection iterator */
- iter->iter_coords=H5S_none_iter_coords;
- iter->iter_block=H5S_none_iter_block;
- iter->iter_nelmts=H5S_none_iter_nelmts;
- iter->iter_has_next_block=H5S_none_iter_has_next_block;
- iter->iter_next=H5S_none_iter_next;
- iter->iter_next_block=H5S_none_iter_next_block;
- iter->iter_release=H5S_none_iter_release;
+ /* Initialize type of selection iterator */
+ iter->type=H5S_sel_iter_none;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -338,7 +383,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_none_copy (H5S_t *dst, const H5S_t *src)
+H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
{
herr_t ret_value=SUCCEED; /* return value */
@@ -457,7 +502,7 @@ H5S_none_serialize (const H5S_t *space, uint8_t *buf)
assert(space);
/* Store the preamble information */
- UINT32ENCODE(buf, (uint32_t)space->select.type); /* Store the type of selection */
+ UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */
UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */
@@ -677,19 +722,7 @@ herr_t H5S_select_none (H5S_t *space)
space->select.num_elem=0;
/* Set selection type */
- space->select.type=H5S_SEL_NONE;
-
- /* Set selection methods */
- space->select.get_seq_list=H5S_none_get_seq_list;
- space->select.release=H5S_none_release;
- space->select.is_valid=H5S_none_is_valid;
- space->select.serial_size=H5S_none_serial_size;
- space->select.serialize=H5S_none_serialize;
- space->select.bounds=H5S_none_bounds;
- space->select.is_contiguous=H5S_none_is_contiguous;
- space->select.is_single=H5S_none_is_single;
- space->select.is_regular=H5S_none_is_regular;
- space->select.iter_init=H5S_none_iter_init;
+ space->select.type=H5S_sel_none;
done:
FUNC_LEAVE_NOAPI(ret_value);