summaryrefslogtreecommitdiffstats
path: root/src/H5Spkg.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-07-31 15:27:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-07-31 15:27:07 (GMT)
commit17275779d07c094741039d0c263fdf055c32bfb6 (patch)
treeb8c90295b95498184125853f93fbb8717e2c5e8e /src/H5Spkg.h
parent79b2b5a3213eb3dd950b5ad4d806f828e7fedb88 (diff)
downloadhdf5-17275779d07c094741039d0c263fdf055c32bfb6.zip
hdf5-17275779d07c094741039d0c263fdf055c32bfb6.tar.gz
hdf5-17275779d07c094741039d0c263fdf055c32bfb6.tar.bz2
[svn-r5839] Purpose:
Code cleanup Description: Move operations on each type of selection into the source code file for each selection type (all->H5Sall.c, hyperslab->H5Shyper.c, etc.) Remove central H5S_select_<foo> operations, instead calling the operations through function pointers in each selection (a much more object-oriented approach). Platforms tested: FreeBSD 4.6 (sleipnir)
Diffstat (limited to 'src/H5Spkg.h')
-rw-r--r--src/H5Spkg.h148
1 files changed, 102 insertions, 46 deletions
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index d31d894..288fffe 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -96,7 +96,37 @@ typedef struct {
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
} H5S_hyper_sel_t;
-/* Selection information container */
+/* Selection information methods */
+/* Method to retrieve a list of offset/length sequences for selection */
+typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+/* Method to compute number of elements in current selection */
+typedef hsize_t (*H5S_sel_get_npoints_func_t)(const H5S_t *space);
+/* Method to release current selection */
+typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space);
+/* Method to initialize iterator for current selection */
+typedef herr_t (*H5S_sel_iter_init_func_t)(const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *sel_iter);
+/* Method to determine number of elements left in iterator for current selection */
+typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
+/* Method to release iterator for current selection */
+typedef herr_t (*H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter);
+/* Method to determine if current selection is valid for dataspace */
+typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space);
+/* Method to determine number of bytes required to store current selection */
+typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
+/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
+typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf);
+/* Method to determine to smallest n-D bounding box containing the current selection */
+typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
+/* Method to determine if current selection is contiguous */
+typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
+/* Method to determine if current selection is a single block */
+typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
+/* Method to determine if current selection is "regular" */
+typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
+
+/* Selection information object */
typedef struct {
H5S_sel_type type; /* Type of selection (list of points or hyperslabs) */
hssize_t *offset; /* Offset within the extent (NULL means a 0 offset) */
@@ -106,6 +136,19 @@ typedef struct {
H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
H5S_hyper_sel_t hslab; /* Info about new-style hyperslab selections */
} sel_info;
+ H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
+ H5S_sel_get_npoints_func_t get_npoints; /* Method to compute number of elements in current selection */
+ H5S_sel_release_func_t release; /* Method to release current selection */
+ H5S_sel_iter_init_func_t iter_init; /* Method to initialize iterator for current selection */
+ H5S_sel_iter_nelmts_func_t iter_nelmts; /* Method to determine number of elements left in iterator for current selection */
+ H5S_sel_iter_release_func_t iter_release; /* Method to release iterator for current selection */
+ H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
+ H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
+ H5S_sel_serialize_func_t serialize; /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
+ H5S_sel_bounds_func_t bounds; /* Method to determine to smallest n-D bounding box containing the current selection */
+ H5S_sel_is_contiguous_func_t is_contiguous; /* Method to determine if current selection is contiguous */
+ H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */
+ H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */
} H5S_select_t;
/* Main dataspace structure (typedef'd in H5Sprivate.h) */
@@ -114,76 +157,89 @@ struct H5S_t {
H5S_select_t select; /* Dataspace selection */
};
+/* Extent functions */
__DLL__ herr_t H5S_close_simple(H5S_simple_t *simple);
__DLL__ herr_t H5S_release_simple(H5S_simple_t *simple);
__DLL__ herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src);
/* Point select functions */
-__DLL__ herr_t H5S_point_init (const H5S_t *space, size_t elmt_size,
+__DLL__ herr_t H5S_point_iter_init (const H5S_t *space, size_t elmt_size,
H5S_sel_iter_t *iter);
-__DLL__ hsize_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
- hsize_t max);
-__DLL__ herr_t H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem,
- const hssize_t **coord);
+__DLL__ hsize_t H5S_point_iter_nelmts (const H5S_sel_iter_t *iter);
+__DLL__ herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter);
__DLL__ herr_t H5S_point_release(H5S_t *space);
__DLL__ hsize_t H5S_point_npoints(const H5S_t *space);
__DLL__ herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src);
-__DLL__ htri_t H5S_point_select_valid(const H5S_t *space);
-__DLL__ hssize_t H5S_point_select_serial_size(const H5S_t *space);
-__DLL__ herr_t H5S_point_select_serialize(const H5S_t *space, uint8_t *buf);
-__DLL__ herr_t H5S_point_select_deserialize(H5S_t *space, const uint8_t *buf);
-__DLL__ herr_t H5S_point_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
-__DLL__ htri_t H5S_point_select_contiguous(const H5S_t *space);
-__DLL__ htri_t H5S_point_select_single(const H5S_t *space);
-__DLL__ htri_t H5S_point_select_regular(const H5S_t *space);
-__DLL__ herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op,
- size_t num_elem, const hssize_t **coord);
-__DLL__ herr_t H5S_point_select_get_seq_list(unsigned flags, const H5S_t *space,H5S_sel_iter_t *iter,
- size_t elem_size, size_t maxseq, size_t maxbytes,
+__DLL__ htri_t H5S_point_is_valid(const H5S_t *space);
+__DLL__ hssize_t H5S_point_serial_size(const H5S_t *space);
+__DLL__ herr_t H5S_point_serialize(const H5S_t *space, uint8_t *buf);
+__DLL__ herr_t H5S_point_deserialize(H5S_t *space, const uint8_t *buf);
+__DLL__ herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+__DLL__ htri_t H5S_point_is_contiguous(const H5S_t *space);
+__DLL__ htri_t H5S_point_is_single(const H5S_t *space);
+__DLL__ htri_t H5S_point_is_regular(const H5S_t *space);
+__DLL__ herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
/* "All" select functions */
-__DLL__ herr_t H5S_all_init (const H5S_t *space, size_t elmt_size,
+__DLL__ herr_t H5S_all_iter_init (const H5S_t *space, size_t elmt_size,
H5S_sel_iter_t *iter);
-__DLL__ hsize_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
- hsize_t max);
+__DLL__ hsize_t H5S_all_iter_nelmts (const H5S_sel_iter_t *iter);
+__DLL__ herr_t H5S_all_iter_release(H5S_sel_iter_t *sel_iter);
__DLL__ herr_t H5S_all_release(H5S_t *space);
__DLL__ hsize_t H5S_all_npoints(const H5S_t *space);
-__DLL__ herr_t H5S_all_select_serialize(const H5S_t *space, uint8_t *buf);
-__DLL__ herr_t H5S_all_select_deserialize(H5S_t *space, const uint8_t *buf);
-__DLL__ herr_t H5S_all_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
-__DLL__ herr_t H5S_all_select_get_seq_list(unsigned flags, const H5S_t *space,H5S_sel_iter_t *iter,
- size_t elem_size, size_t maxseq, size_t maxbytes,
+__DLL__ htri_t H5S_all_is_valid(const H5S_t *space);
+__DLL__ hssize_t H5S_all_serial_size(const H5S_t *space);
+__DLL__ herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf);
+__DLL__ herr_t H5S_all_deserialize(H5S_t *space, const uint8_t *buf);
+__DLL__ herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+__DLL__ htri_t H5S_all_is_contiguous(const H5S_t *space);
+__DLL__ htri_t H5S_all_is_single(const H5S_t *space);
+__DLL__ htri_t H5S_all_is_regular(const H5S_t *space);
+__DLL__ herr_t H5S_all_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
/* Hyperslab selection functions */
-__DLL__ herr_t H5S_hyper_init (const H5S_t *space, size_t elmt_size,
+__DLL__ herr_t H5S_hyper_iter_init (const H5S_t *space, size_t elmt_size,
H5S_sel_iter_t *iter);
-__DLL__ hsize_t H5S_hyper_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
- hsize_t max);
+__DLL__ hsize_t H5S_hyper_iter_nelmts (const H5S_sel_iter_t *iter);
+__DLL__ herr_t H5S_hyper_iter_release(H5S_sel_iter_t *sel_iter);
__DLL__ herr_t H5S_hyper_release(H5S_t *space);
-__DLL__ herr_t H5S_hyper_sel_iter_release(H5S_sel_iter_t *sel_iter);
__DLL__ hsize_t H5S_hyper_npoints(const H5S_t *space);
__DLL__ herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src);
-__DLL__ htri_t H5S_hyper_select_valid(const H5S_t *space);
-__DLL__ hssize_t H5S_hyper_select_serial_size(const H5S_t *space);
-__DLL__ herr_t H5S_hyper_select_serialize(const H5S_t *space, uint8_t *buf);
-__DLL__ herr_t H5S_hyper_select_deserialize(H5S_t *space, const uint8_t *buf);
-__DLL__ hssize_t H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans);
-__DLL__ herr_t H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hssize_t start[], hssize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf);
-__DLL__ herr_t H5S_hyper_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
-__DLL__ htri_t H5S_hyper_select_contiguous(const H5S_t *space);
-__DLL__ htri_t H5S_hyper_select_single(const H5S_t *space);
-__DLL__ htri_t H5S_hyper_select_regular(const H5S_t *space);
-__DLL__ herr_t H5S_hyper_select_get_seq_list(unsigned flags, const H5S_t *space,H5S_sel_iter_t *iter,
- size_t elem_size, size_t maxseq, size_t maxbytes,
+__DLL__ htri_t H5S_hyper_is_valid(const H5S_t *space);
+__DLL__ hssize_t H5S_hyper_serial_size(const H5S_t *space);
+__DLL__ herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf);
+__DLL__ herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf);
+__DLL__ herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+__DLL__ htri_t H5S_hyper_is_contiguous(const H5S_t *space);
+__DLL__ htri_t H5S_hyper_is_single(const H5S_t *space);
+__DLL__ htri_t H5S_hyper_is_regular(const H5S_t *space);
+__DLL__ herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
/* "None" selection functions */
+__DLL__ herr_t H5S_none_iter_init (const H5S_t *space, size_t elmt_size,
+ H5S_sel_iter_t *iter);
+__DLL__ hsize_t H5S_none_iter_nelmts (const H5S_sel_iter_t *iter);
+__DLL__ herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter);
+__DLL__ herr_t H5S_none_release(H5S_t *space);
+__DLL__ hsize_t H5S_none_npoints(const H5S_t *space);
+__DLL__ htri_t H5S_none_is_valid(const H5S_t *space);
+__DLL__ hssize_t H5S_none_serial_size(const H5S_t *space);
+__DLL__ herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
+__DLL__ herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf);
+__DLL__ herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+__DLL__ htri_t H5S_none_is_contiguous(const H5S_t *space);
+__DLL__ htri_t H5S_none_is_single(const H5S_t *space);
+__DLL__ htri_t H5S_none_is_regular(const H5S_t *space);
+__DLL__ herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+/* Needed for use in hyperslab code (H5Shyper.c) */
__DLL__ herr_t H5S_select_none(H5S_t *space);
-__DLL__ herr_t H5S_none_select_serialize(const H5S_t *space, uint8_t *buf);
-__DLL__ herr_t H5S_none_select_deserialize(H5S_t *space, const uint8_t *buf);
-__DLL__ herr_t H5S_none_select_iterate(void *buf, hid_t type_id, H5S_t *space,
- H5D_operator_t op, void *operator_data);
#endif