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 /*
17  * This file contains public declarations for the H5S module.
18  */
19 #ifndef _H5Spublic_H
20 #define _H5Spublic_H
21 
22 /* Public headers needed by this file */
23 #include "H5public.h"
24 #include "H5Ipublic.h"
25 
26 /* Define atomic datatypes */
27 #define H5S_ALL         0
28 #define H5S_UNLIMITED	((hsize_t)(hssize_t)(-1))
29 
30 /* Define user-level maximum number of dimensions */
31 #define H5S_MAX_RANK    32
32 
33 /* Different types of dataspaces */
34 typedef enum H5S_class_t {
35     H5S_NO_CLASS         = -1,  /*error                                      */
36     H5S_SCALAR           = 0,   /*scalar variable                            */
37     H5S_SIMPLE           = 1,   /*simple data space                          */
38     H5S_NULL             = 2    /*null data space                            */
39 } H5S_class_t;
40 
41 /* Different ways of combining selections */
42 typedef enum H5S_seloper_t {
43     H5S_SELECT_NOOP      = -1,  /* error                                     */
44     H5S_SELECT_SET       = 0,   /* Select "set" operation 		     */
45     H5S_SELECT_OR,              /* Binary "or" operation for hyperslabs
46                                  * (add new selection to existing selection)
47                                  * Original region:  AAAAAAAAAA
48                                  * New region:             BBBBBBBBBB
49                                  * A or B:           CCCCCCCCCCCCCCCC
50                                  */
51     H5S_SELECT_AND,             /* Binary "and" operation for hyperslabs
52                                  * (only leave overlapped regions in selection)
53                                  * Original region:  AAAAAAAAAA
54                                  * New region:             BBBBBBBBBB
55                                  * A and B:                CCCC
56                                  */
57     H5S_SELECT_XOR,             /* Binary "xor" operation for hyperslabs
58                                  * (only leave non-overlapped regions in selection)
59                                  * Original region:  AAAAAAAAAA
60                                  * New region:             BBBBBBBBBB
61                                  * A xor B:          CCCCCC    CCCCCC
62                                  */
63     H5S_SELECT_NOTB,            /* Binary "not" operation for hyperslabs
64                                  * (only leave non-overlapped regions in original selection)
65                                  * Original region:  AAAAAAAAAA
66                                  * New region:             BBBBBBBBBB
67                                  * A not B:          CCCCCC
68                                  */
69     H5S_SELECT_NOTA,            /* Binary "not" operation for hyperslabs
70                                  * (only leave non-overlapped regions in new selection)
71                                  * Original region:  AAAAAAAAAA
72                                  * New region:             BBBBBBBBBB
73                                  * B not A:                    CCCCCC
74                                  */
75     H5S_SELECT_APPEND,          /* Append elements to end of point selection */
76     H5S_SELECT_PREPEND,         /* Prepend elements to beginning of point selection */
77     H5S_SELECT_INVALID          /* Invalid upper bound on selection operations */
78 } H5S_seloper_t;
79 
80 /* Enumerated type for the type of selection */
81 typedef enum {
82     H5S_SEL_ERROR	= -1, 	/* Error			*/
83     H5S_SEL_NONE	= 0,    /* Nothing selected 		*/
84     H5S_SEL_POINTS	= 1,    /* Sequence of points selected	*/
85     H5S_SEL_HYPERSLABS  = 2,    /* "New-style" hyperslab selection defined	*/
86     H5S_SEL_ALL		= 3,    /* Entire extent selected	*/
87     H5S_SEL_N			/*THIS MUST BE LAST		*/
88 }H5S_sel_type;
89 
90 #ifdef __cplusplus
91 extern "C" {
92 #endif
93 
94 /* Functions in H5S.c */
95 H5_DLL hid_t H5Screate(H5S_class_t type);
96 H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
97 			       const hsize_t maxdims[]);
98 H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
99 				    const hsize_t dims[],
100 				    const hsize_t max[]);
101 H5_DLL hid_t H5Scopy(hid_t space_id);
102 H5_DLL herr_t H5Sclose(hid_t space_id);
103 H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
104 H5_DLL hid_t H5Sdecode(const void *buf);
105 H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
106 H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
107 H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
108 				      hsize_t maxdims[]);
109 H5_DLL htri_t H5Sis_simple(hid_t space_id);
110 H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
111 H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
112 				   const hsize_t start[],
113 				   const hsize_t _stride[],
114 				   const hsize_t count[],
115 				   const hsize_t _block[]);
116 /* #define NEW_HYPERSLAB_API */
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 hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
139 H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
140 H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
141     hsize_t numblocks, hsize_t buf[/*numblocks*/]);
142 H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
143     hsize_t numpoints, hsize_t buf[/*numpoints*/]);
144 H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
145     hsize_t end[]);
146 H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 #endif /* _H5Spublic_H */
152 
153