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 files COPYING and Copyright.html.  COPYING can be found at the root   *
9  * of the source code distribution tree; Copyright.html can be found at the  *
10  * root level of an installed copy of the electronic HDF5 document set and   *
11  * is linked from the top-level documents page.  It can also be found at     *
12  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
13  * access to either file, you may request a copy from help@hdfgroup.org.     *
14  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 module hdf5.H5Spublic;
17 
18 /*
19  * This file contains public declarations for the H5S module.
20  */
21 
22 /* Public headers needed by this file */
23 public import hdf5.H5public;
24 public import hdf5.H5Ipublic;
25 
26 extern(C):
27 
28 /* Define atomic datatypes */
29 enum H5S_ALL = 0;
30 enum H5S_UNLIMITED = (cast(hsize_t)cast(hssize_t)(-1));
31 
32 /* Define user-level maximum number of dimensions */
33 enum H5S_MAX_RANK = 32;
34 
35 /* Different types of dataspaces */
36 enum H5S_class_t {
37     H5S_NO_CLASS         = -1,  /*error                                      */
38     H5S_SCALAR           = 0,   /*scalar variable                            */
39     H5S_SIMPLE           = 1,   /*simple data space                          */
40     H5S_NULL             = 2    /*null data space                            */
41 }
42 
43 /* Different ways of combining selections */
44 enum H5S_seloper_t {
45     H5S_SELECT_NOOP      = -1,  /* error                                     */
46     H5S_SELECT_SET       = 0,   /* Select "set" operation 		     */
47     H5S_SELECT_OR,              /* Binary "or" operation for hyperslabs
48                                  * (add new selection to existing selection)
49                                  * Original region:  AAAAAAAAAA
50                                  * New region:             BBBBBBBBBB
51                                  * A or B:           CCCCCCCCCCCCCCCC
52                                  */
53     H5S_SELECT_AND,             /* Binary "and" operation for hyperslabs
54                                  * (only leave overlapped regions in selection)
55                                  * Original region:  AAAAAAAAAA
56                                  * New region:             BBBBBBBBBB
57                                  * A and B:                CCCC
58                                  */
59     H5S_SELECT_XOR,             /* Binary "xor" operation for hyperslabs
60                                  * (only leave non-overlapped regions in selection)
61                                  * Original region:  AAAAAAAAAA
62                                  * New region:             BBBBBBBBBB
63                                  * A xor B:          CCCCCC    CCCCCC
64                                  */
65     H5S_SELECT_NOTB,            /* Binary "not" operation for hyperslabs
66                                  * (only leave non-overlapped regions in original selection)
67                                  * Original region:  AAAAAAAAAA
68                                  * New region:             BBBBBBBBBB
69                                  * A not B:          CCCCCC
70                                  */
71     H5S_SELECT_NOTA,            /* Binary "not" operation for hyperslabs
72                                  * (only leave non-overlapped regions in new selection)
73                                  * Original region:  AAAAAAAAAA
74                                  * New region:             BBBBBBBBBB
75                                  * B not A:                    CCCCCC
76                                  */
77     H5S_SELECT_APPEND,          /* Append elements to end of point selection */
78     H5S_SELECT_PREPEND,         /* Prepend elements to beginning of point selection */
79     H5S_SELECT_INVALID          /* Invalid upper bound on selection operations */
80 }
81 
82 enum {
83     H5S_SELECT_NOOP      = -1,  /* error                                     */
84     H5S_SELECT_SET       = 0,   /* Select "set" operation 		     */
85     H5S_SELECT_OR,              /* Binary "or" operation for hyperslabs
86                                  * (add new selection to existing selection)
87                                  * Original region:  AAAAAAAAAA
88                                  * New region:             BBBBBBBBBB
89                                  * A or B:           CCCCCCCCCCCCCCCC
90                                  */
91     H5S_SELECT_AND,             /* Binary "and" operation for hyperslabs
92                                  * (only leave overlapped regions in selection)
93                                  * Original region:  AAAAAAAAAA
94                                  * New region:             BBBBBBBBBB
95                                  * A and B:                CCCC
96                                  */
97     H5S_SELECT_XOR,             /* Binary "xor" operation for hyperslabs
98                                  * (only leave non-overlapped regions in selection)
99                                  * Original region:  AAAAAAAAAA
100                                  * New region:             BBBBBBBBBB
101                                  * A xor B:          CCCCCC    CCCCCC
102                                  */
103     H5S_SELECT_NOTB,            /* Binary "not" operation for hyperslabs
104                                  * (only leave non-overlapped regions in original selection)
105                                  * Original region:  AAAAAAAAAA
106                                  * New region:             BBBBBBBBBB
107                                  * A not B:          CCCCCC
108                                  */
109     H5S_SELECT_NOTA,            /* Binary "not" operation for hyperslabs
110                                  * (only leave non-overlapped regions in new selection)
111                                  * Original region:  AAAAAAAAAA
112                                  * New region:             BBBBBBBBBB
113                                  * B not A:                    CCCCCC
114                                  */
115     H5S_SELECT_APPEND,          /* Append elements to end of point selection */
116     H5S_SELECT_PREPEND,         /* Prepend elements to beginning of point selection */
117     H5S_SELECT_INVALID          /* Invalid upper bound on selection operations */
118 }
119 
120 /* Enumerated type for the type of selection */
121 enum H5S_sel_type {
122     H5S_SEL_ERROR	= -1, 	/* Error			*/
123     H5S_SEL_NONE	= 0,    /* Nothing selected 		*/
124     H5S_SEL_POINTS	= 1,    /* Sequence of points selected	*/
125     H5S_SEL_HYPERSLABS  = 2,    /* "New-style" hyperslab selection defined	*/
126     H5S_SEL_ALL		= 3,    /* Entire extent selected	*/
127     H5S_SEL_N			/*THIS MUST BE LAST		*/
128 }
129 
130 version(Posix) {
131   /* Functions in H5S.c */
132   hid_t H5Screate(H5S_class_t type);
133   hid_t H5Screate_simple(int rank, const hsize_t *dims,
134                          const hsize_t *maxdims);
135   herr_t H5Sset_extent_simple(hid_t space_id, int rank,
136                               const hsize_t *dims,
137                               const hsize_t *max);
138   hid_t H5Scopy(hid_t space_id);
139   herr_t H5Sclose(hid_t space_id);
140   herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
141   hid_t H5Sdecode(const void *buf);
142   hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
143   int H5Sget_simple_extent_ndims(hid_t space_id);
144   int H5Sget_simple_extent_dims(hid_t space_id, hsize_t *dims,
145                                 hsize_t *maxdims);
146   htri_t H5Sis_simple(hid_t space_id);
147   hssize_t H5Sget_select_npoints(hid_t spaceid);
148   herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
149                              const hsize_t *start,
150                              const hsize_t *_stride,
151                              const hsize_t *count,
152                              const hsize_t *_block);
153   hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
154                              const hsize_t *start,
155                              const hsize_t *_stride,
156                              const hsize_t *count,
157                              const hsize_t *_block);
158   herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
159                           hid_t space2_id);
160   hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
161                           hid_t space2_id);
162   herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
163                             size_t num_elem, const hsize_t *coord);
164   H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
165   herr_t H5Sset_extent_none(hid_t space_id);
166   herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
167   htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
168   herr_t H5Sselect_all(hid_t spaceid);
169   herr_t H5Sselect_none(hid_t spaceid);
170   herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
171   htri_t H5Sselect_valid(hid_t spaceid);
172   hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
173   hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
174   herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
175                                        hsize_t numblocks, hsize_t *buf);
176   herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
177                                       hsize_t numpoints, hsize_t *buf);
178   herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t *start,
179                               hsize_t *end);
180   H5S_sel_type H5Sget_select_type(hid_t spaceid);
181 }
182