1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * This file contains public declarations for the H5S module.
16  */
17 #ifndef _H5Spublic_H
18 #define _H5Spublic_H
19 
20 /* Public headers needed by this file */
21 #include "H5public.h"
22 #include "H5Ipublic.h"
23 
24 /* Define atomic datatypes */
25 #define H5S_ALL         (hid_t)0
26 #define H5S_UNLIMITED   HSIZE_UNDEF
27 
28 /* Define user-level maximum number of dimensions */
29 #define H5S_MAX_RANK    32
30 
31 /* Different types of dataspaces */
32 typedef enum H5S_class_t {
33     H5S_NO_CLASS         = -1,  /*error                                      */
34     H5S_SCALAR           = 0,   /*scalar variable                            */
35     H5S_SIMPLE           = 1,   /*simple dataspace                           */
36     H5S_NULL             = 2    /*null dataspace                             */
37 } H5S_class_t;
38 
39 /* Different ways of combining selections */
40 typedef enum H5S_seloper_t {
41     H5S_SELECT_NOOP      = -1,  /* error                                     */
42     H5S_SELECT_SET       = 0,   /* Select "set" operation 		     */
43     H5S_SELECT_OR,              /* Binary "or" operation for hyperslabs
44                                  * (add new selection to existing selection)
45                                  * Original region:  AAAAAAAAAA
46                                  * New region:             BBBBBBBBBB
47                                  * A or B:           CCCCCCCCCCCCCCCC
48                                  */
49     H5S_SELECT_AND,             /* Binary "and" operation for hyperslabs
50                                  * (only leave overlapped regions in selection)
51                                  * Original region:  AAAAAAAAAA
52                                  * New region:             BBBBBBBBBB
53                                  * A and B:                CCCC
54                                  */
55     H5S_SELECT_XOR,             /* Binary "xor" operation for hyperslabs
56                                  * (only leave non-overlapped regions in selection)
57                                  * Original region:  AAAAAAAAAA
58                                  * New region:             BBBBBBBBBB
59                                  * A xor B:          CCCCCC    CCCCCC
60                                  */
61     H5S_SELECT_NOTB,            /* Binary "not" operation for hyperslabs
62                                  * (only leave non-overlapped regions in original selection)
63                                  * Original region:  AAAAAAAAAA
64                                  * New region:             BBBBBBBBBB
65                                  * A not B:          CCCCCC
66                                  */
67     H5S_SELECT_NOTA,            /* Binary "not" operation for hyperslabs
68                                  * (only leave non-overlapped regions in new selection)
69                                  * Original region:  AAAAAAAAAA
70                                  * New region:             BBBBBBBBBB
71                                  * B not A:                    CCCCCC
72                                  */
73     H5S_SELECT_APPEND,          /* Append elements to end of point selection */
74     H5S_SELECT_PREPEND,         /* Prepend elements to beginning of point selection */
75     H5S_SELECT_INVALID          /* Invalid upper bound on selection operations */
76 } H5S_seloper_t;
77 
78 /* Enumerated type for the type of selection */
79 typedef enum {
80     H5S_SEL_ERROR	= -1, 	/* Error			*/
81     H5S_SEL_NONE	= 0,    /* Nothing selected 		*/
82     H5S_SEL_POINTS	= 1,    /* Sequence of points selected	*/
83     H5S_SEL_HYPERSLABS  = 2,    /* "New-style" hyperslab selection defined	*/
84     H5S_SEL_ALL		= 3,    /* Entire extent selected	*/
85     H5S_SEL_N			/*THIS MUST BE LAST		*/
86 }H5S_sel_type;
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 /* Functions in H5S.c */
93 H5_DLL hid_t H5Screate(H5S_class_t type);
94 H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
95 			       const hsize_t maxdims[]);
96 H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
97 				    const hsize_t dims[],
98 				    const hsize_t max[]);
99 H5_DLL hid_t H5Scopy(hid_t space_id);
100 H5_DLL herr_t H5Sclose(hid_t space_id);
101 H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
102 H5_DLL hid_t H5Sdecode(const void *buf);
103 H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
104 H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
105 H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
106 				      hsize_t maxdims[]);
107 H5_DLL htri_t H5Sis_simple(hid_t space_id);
108 H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
109 H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
110 				   const hsize_t start[],
111 				   const hsize_t _stride[],
112 				   const hsize_t count[],
113 				   const hsize_t _block[]);
114 /* #define NEW_HYPERSLAB_API */
115 /* Note that these haven't been working for a while and were never
116  *      publicly released - QAK */
117 #ifdef NEW_HYPERSLAB_API
118 H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
119 				   const hsize_t start[],
120 				   const hsize_t _stride[],
121 				   const hsize_t count[],
122 				   const hsize_t _block[]);
123 H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
124                                   hid_t space2_id);
125 H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
126                                   hid_t space2_id);
127 #endif /* NEW_HYPERSLAB_API */
128 H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
129     size_t num_elem, const hsize_t *coord);
130 H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
131 H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
132 H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
133 H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
134 H5_DLL herr_t H5Sselect_all(hid_t spaceid);
135 H5_DLL herr_t H5Sselect_none(hid_t spaceid);
136 H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
137 H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
138 H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
139 H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
140     hsize_t stride[], hsize_t count[], hsize_t block[]);
141 H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
142 H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
143 H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
144     hsize_t numblocks, hsize_t buf[/*numblocks*/]);
145 H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
146     hsize_t numpoints, hsize_t buf[/*numpoints*/]);
147 H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
148     hsize_t end[]);
149 H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 #endif /* _H5Spublic_H */
155 
156