netcdf_sys/
dispatch.rs

1use std::os::raw::{c_char, c_int, c_longlong, c_uint, c_void};
2
3use super::nc_type;
4
5pub const NC_DISPATCH_VERSION: usize = 5;
6
7#[repr(C)]
8#[derive(Copy, Clone)]
9pub struct NC_Dispatch {
10    pub model: c_int,
11    pub dispatch_version: c_int,
12
13    pub create: Option<
14        unsafe extern "C" fn(
15            path: *const c_char,
16            cmode: c_int,
17            initialsz: usize,
18            basepe: c_int,
19            chunksizehintp: *mut usize,
20            parameters: *mut c_void,
21            table: *const NC_Dispatch,
22            ncid: c_int,
23        ) -> c_int,
24    >,
25    pub open: Option<
26        unsafe extern "C" fn(
27            path: *const c_char,
28            mode: c_int,
29            basepe: c_int,
30            chunksizehintp: *mut usize,
31            parameters: *mut c_void,
32            table: *const NC_Dispatch,
33            ncid: c_int,
34        ) -> c_int,
35    >,
36    pub redef: Option<unsafe extern "C" fn(c_int) -> c_int>,
37    pub _enddef: Option<unsafe extern "C" fn(c_int, usize, usize, usize, usize) -> c_int>,
38    pub sync: Option<unsafe extern "C" fn(c_int) -> c_int>,
39    pub abort: Option<unsafe extern "C" fn(c_int) -> c_int>,
40    pub close: Option<unsafe extern "C" fn(c_int, *mut c_void) -> c_int>,
41    pub set_fill: Option<unsafe extern "C" fn(c_int, c_int, *mut c_int) -> c_int>,
42    pub inq_format: Option<unsafe extern "C" fn(c_int, *mut c_int) -> c_int>,
43    pub inq_format_extended: Option<unsafe extern "C" fn(c_int, *mut c_int, *mut c_int) -> c_int>,
44    pub inq: Option<
45        unsafe extern "C" fn(c_int, *mut c_int, *mut c_int, *mut c_int, *mut c_int) -> c_int,
46    >,
47    pub inq_type: Option<unsafe extern "C" fn(c_int, nc_type, *mut c_char, *mut usize) -> c_int>,
48    pub def_dim: Option<unsafe extern "C" fn(c_int, *const c_char, usize, *mut c_int) -> c_int>,
49    pub inq_dimid: Option<unsafe extern "C" fn(c_int, *const c_char, *mut c_int) -> c_int>,
50    pub inq_dim: Option<unsafe extern "C" fn(c_int, c_int, *mut c_char, *mut usize) -> c_int>,
51    pub inq_unlimdim: Option<unsafe extern "C" fn(ncid: c_int, unlimdimidp: *mut c_int) -> c_int>,
52    pub rename_dim: Option<unsafe extern "C" fn(c_int, c_int, *const c_char) -> c_int>,
53    pub inq_att: Option<
54        unsafe extern "C" fn(c_int, c_int, *const c_char, *mut nc_type, *mut usize) -> c_int,
55    >,
56    pub inq_attid: Option<unsafe extern "C" fn(c_int, c_int, *const c_char, *mut c_int) -> c_int>,
57    pub inq_attname: Option<unsafe extern "C" fn(c_int, c_int, c_int, *mut c_char) -> c_int>,
58    pub rename_att:
59        Option<unsafe extern "C" fn(c_int, c_int, *const c_char, *const c_char) -> c_int>,
60    pub del_att: Option<unsafe extern "C" fn(c_int, c_int, *const c_char) -> c_int>,
61    pub get_att:
62        Option<unsafe extern "C" fn(c_int, c_int, *const c_char, *mut c_void, nc_type) -> c_int>,
63    pub put_att: Option<
64        unsafe extern "C" fn(
65            c_int,
66            c_int,
67            *const c_char,
68            nc_type,
69            usize,
70            *const c_void,
71            nc_type,
72        ) -> c_int,
73    >,
74    pub def_var: Option<
75        unsafe extern "C" fn(
76            c_int,
77            *const c_char,
78            nc_type,
79            c_int,
80            *const c_int,
81            *mut c_int,
82        ) -> c_int,
83    >,
84    pub inq_varid: Option<unsafe extern "C" fn(c_int, *const c_char, *mut c_int) -> c_int>,
85    pub rename_var: Option<unsafe extern "C" fn(c_int, c_int, *const c_char) -> c_int>,
86    pub get_vara: Option<
87        unsafe extern "C" fn(
88            c_int,
89            c_int,
90            *const usize,
91            *const usize,
92            *mut c_void,
93            nc_type,
94        ) -> c_int,
95    >,
96    pub put_vara: Option<
97        unsafe extern "C" fn(
98            c_int,
99            c_int,
100            *const usize,
101            *const usize,
102            *const c_void,
103            nc_type,
104        ) -> c_int,
105    >,
106    pub get_vars: Option<
107        unsafe extern "C" fn(
108            c_int,
109            c_int,
110            *const usize,
111            *const usize,
112            *const isize,
113            *mut c_void,
114            nc_type,
115        ) -> c_int,
116    >,
117    pub put_vars: Option<
118        unsafe extern "C" fn(
119            c_int,
120            c_int,
121            *const usize,
122            *const usize,
123            *const isize,
124            *const c_void,
125            nc_type,
126        ) -> c_int,
127    >,
128    pub get_varm: Option<
129        unsafe extern "C" fn(
130            c_int,
131            c_int,
132            *const usize,
133            *const usize,
134            *const isize,
135            *const isize,
136            *mut c_void,
137            nc_type,
138        ) -> c_int,
139    >,
140    pub put_varm: Option<
141        unsafe extern "C" fn(
142            c_int,
143            c_int,
144            *const usize,
145            *const usize,
146            *const isize,
147            *const isize,
148            *const c_void,
149            nc_type,
150        ) -> c_int,
151    >,
152    pub inq_var_all: Option<
153        unsafe extern "C" fn(
154            ncid: c_int,
155            varid: c_int,
156            name: *mut c_char,
157            xtypep: *mut nc_type,
158            ndimsp: *mut c_int,
159            dimidsp: *mut c_int,
160            nattsp: *mut c_int,
161            shufflep: *mut c_int,
162            deflatep: *mut c_int,
163            deflate_levelp: *mut c_int,
164            fletcher32p: *mut c_int,
165            contiguousp: *mut c_int,
166            chunksizesp: *mut usize,
167            no_fill: *mut c_int,
168            fill_valuep: *mut c_void,
169            endiannessp: *mut c_int,
170            idp: *mut c_uint,
171            nparamsp: *mut usize,
172            params: *mut c_uint,
173        ) -> c_int,
174    >,
175    pub var_par_access: Option<unsafe extern "C" fn(c_int, c_int, c_int) -> c_int>,
176    pub def_var_fill: Option<unsafe extern "C" fn(c_int, c_int, c_int, *const c_void) -> c_int>,
177    pub show_metadata: Option<unsafe extern "C" fn(c_int) -> c_int>,
178    pub inq_unlimdims: Option<unsafe extern "C" fn(c_int, *mut c_int, *mut c_int) -> c_int>,
179    pub inq_ncid: Option<unsafe extern "C" fn(c_int, *const c_char, *mut c_int) -> c_int>,
180    pub inq_grps: Option<unsafe extern "C" fn(c_int, *mut c_int, *mut c_int) -> c_int>,
181    pub inq_grpname: Option<unsafe extern "C" fn(c_int, *mut c_char) -> c_int>,
182    pub inq_grpname_full: Option<unsafe extern "C" fn(c_int, *mut usize, *mut c_char) -> c_int>,
183    pub inq_grp_parent: Option<unsafe extern "C" fn(c_int, *mut c_int) -> c_int>,
184    pub inq_grp_full_ncid: Option<unsafe extern "C" fn(c_int, *const c_char, *mut c_int) -> c_int>,
185    pub inq_varids:
186        Option<unsafe extern "C" fn(_: c_int, nvars: *mut c_int, _: *mut c_int) -> c_int>,
187    pub inq_dimids:
188        Option<unsafe extern "C" fn(_: c_int, ndims: *mut c_int, _: *mut c_int, _: c_int) -> c_int>,
189    pub inq_typeids:
190        Option<unsafe extern "C" fn(_: c_int, ntypes: *mut c_int, _: *mut c_int) -> c_int>,
191    pub inq_type_equal:
192        Option<unsafe extern "C" fn(c_int, nc_type, c_int, nc_type, *mut c_int) -> c_int>,
193    pub def_grp: Option<unsafe extern "C" fn(c_int, *const c_char, *mut c_int) -> c_int>,
194    pub rename_grp: Option<unsafe extern "C" fn(c_int, *const c_char) -> c_int>,
195    pub inq_user_type: Option<
196        unsafe extern "C" fn(
197            c_int,
198            nc_type,
199            *mut c_char,
200            *mut usize,
201            *mut nc_type,
202            *mut usize,
203            *mut c_int,
204        ) -> c_int,
205    >,
206    pub inq_typeid: Option<unsafe extern "C" fn(c_int, *const c_char, *mut nc_type) -> c_int>,
207    pub def_compound:
208        Option<unsafe extern "C" fn(c_int, usize, *const c_char, *mut nc_type) -> c_int>,
209    pub insert_compound:
210        Option<unsafe extern "C" fn(c_int, nc_type, *const c_char, usize, nc_type) -> c_int>,
211    pub insert_array_compound: Option<
212        unsafe extern "C" fn(
213            c_int,
214            nc_type,
215            *const c_char,
216            usize,
217            nc_type,
218            c_int,
219            *const c_int,
220        ) -> c_int,
221    >,
222    pub inq_compound_field: Option<
223        unsafe extern "C" fn(
224            c_int,
225            nc_type,
226            c_int,
227            *mut c_char,
228            *mut usize,
229            *mut nc_type,
230            *mut c_int,
231            *mut c_int,
232        ) -> c_int,
233    >,
234    pub inq_compound_fieldindex:
235        Option<unsafe extern "C" fn(c_int, nc_type, *const c_char, *mut c_int) -> c_int>,
236    pub def_vlen: Option<
237        unsafe extern "C" fn(
238            _: c_int,
239            _: *const c_char,
240            base_typeid: nc_type,
241            _: *mut nc_type,
242        ) -> c_int,
243    >,
244    pub put_vlen_element:
245        Option<unsafe extern "C" fn(c_int, c_int, *mut c_void, usize, *const c_void) -> c_int>,
246    pub get_vlen_element:
247        Option<unsafe extern "C" fn(c_int, c_int, *const c_void, *mut usize, *mut c_void) -> c_int>,
248    pub def_enum:
249        Option<unsafe extern "C" fn(c_int, nc_type, *const c_char, *mut nc_type) -> c_int>,
250    pub insert_enum:
251        Option<unsafe extern "C" fn(c_int, nc_type, *const c_char, *const c_void) -> c_int>,
252    pub inq_enum_member:
253        Option<unsafe extern "C" fn(c_int, nc_type, c_int, *mut c_char, *mut c_void) -> c_int>,
254    pub inq_enum_ident:
255        Option<unsafe extern "C" fn(c_int, nc_type, c_longlong, *mut c_char) -> c_int>,
256    pub def_opaque:
257        Option<unsafe extern "C" fn(c_int, usize, *const c_char, *mut nc_type) -> c_int>,
258    pub def_var_deflate: Option<unsafe extern "C" fn(c_int, c_int, c_int, c_int, c_int) -> c_int>,
259    pub def_var_fletcher32: Option<unsafe extern "C" fn(c_int, c_int, c_int) -> c_int>,
260    pub def_var_chunking: Option<unsafe extern "C" fn(c_int, c_int, c_int, *const usize) -> c_int>,
261    pub def_var_endian: Option<unsafe extern "C" fn(c_int, c_int, c_int) -> c_int>,
262    pub def_var_filter:
263        Option<unsafe extern "C" fn(c_int, c_int, c_uint, usize, *const c_uint) -> c_int>,
264    pub set_var_chunk_cache: Option<unsafe extern "C" fn(c_int, c_int, usize, usize, f32) -> c_int>,
265    pub get_var_chunk_cache: Option<
266        unsafe extern "C" fn(
267            ncid: c_int,
268            varid: c_int,
269            sizep: *mut usize,
270            nelemsp: *mut usize,
271            preemptionp: *mut f32,
272        ) -> c_int,
273    >,
274    pub inq_var_filter_ids: Option<
275        unsafe extern "C" fn(
276            ncid: c_int,
277            varid: c_int,
278            nfilters: *mut usize,
279            filterids: *mut c_uint,
280        ) -> c_int,
281    >,
282    pub inq_var_filter_info: Option<
283        unsafe extern "C" fn(
284            ncid: c_int,
285            varid: c_int,
286            id: c_uint,
287            nparams: *mut usize,
288            params: *mut c_uint,
289        ) -> c_int,
290    >,
291    pub def_var_quantize: Option<
292        unsafe extern "C" fn(ncid: c_int, varid: c_int, quantize_mode: c_int, nsd: c_int) -> c_int,
293    >,
294    pub inq_var_quantize: Option<
295        unsafe extern "C" fn(
296            ncid: c_int,
297            varid: c_int,
298            quantize_modep: *mut c_int,
299            nsdp: *mut c_int,
300        ) -> c_int,
301    >,
302    pub inq_filter_avail: Option<unsafe extern "C" fn(ncid: c_int, id: c_uint) -> c_int>,
303}
304
305extern "C" {
306    pub fn NC_RO_create(
307        path: *const c_char,
308        cmode: c_int,
309        initialsz: usize,
310        basepe: c_int,
311        chunksizehintp: *mut usize,
312        parameters: *mut c_void,
313        _: *const NC_Dispatch,
314        _: c_int,
315    ) -> c_int;
316    pub fn NC_RO_redef(ncid: c_int) -> c_int;
317    pub fn NC_RO__enddef(
318        ncid: c_int,
319        h_minfree: usize,
320        v_align: usize,
321        v_minfree: usize,
322        r_align: usize,
323    ) -> c_int;
324    pub fn NC_RO_sync(ncid: c_int) -> c_int;
325    pub fn NC_RO_def_var_fill(_: c_int, _: c_int, _: c_int, _: *const c_void) -> c_int;
326    pub fn NC_RO_rename_att(
327        ncid: c_int,
328        varid: c_int,
329        name: *const c_char,
330        newname: *const c_char,
331    ) -> c_int;
332    pub fn NC_RO_del_att(ncid: c_int, varid: c_int, _: *const c_char) -> c_int;
333    pub fn NC_RO_put_att(
334        ncid: c_int,
335        varid: c_int,
336        name: *const c_char,
337        datatype: nc_type,
338        len: usize,
339        value: *const c_void,
340        _: nc_type,
341    ) -> c_int;
342    pub fn NC_RO_def_var(
343        ncid: c_int,
344        name: *const c_char,
345        xtype: nc_type,
346        ndims: c_int,
347        dimidsp: *const c_int,
348        varidp: *mut c_int,
349    ) -> c_int;
350    pub fn NC_RO_rename_var(ncid: c_int, varid: c_int, name: *const c_char) -> c_int;
351    pub fn NC_RO_put_vara(
352        ncid: c_int,
353        varid: c_int,
354        start: *const usize,
355        count: *const usize,
356        value: *const c_void,
357        _: nc_type,
358    ) -> c_int;
359    pub fn NC_RO_def_dim(ncid: c_int, name: *const c_char, len: usize, idp: *mut c_int) -> c_int;
360    pub fn NC_RO_rename_dim(ncid: c_int, dimid: c_int, name: *const c_char) -> c_int;
361    pub fn NC_RO_set_fill(ncid: c_int, fillmode: c_int, old_modep: *mut c_int) -> c_int;
362    pub fn NC_NOTNC4_def_var_filter(
363        _: c_int,
364        _: c_int,
365        _: c_uint,
366        _: usize,
367        _: *const c_uint,
368    ) -> c_int;
369    pub fn NC_NOTNC4_inq_var_filter_ids(
370        ncid: c_int,
371        varid: c_int,
372        nfilters: *mut usize,
373        filterids: *mut c_uint,
374    ) -> c_int;
375    pub fn NC_NOTNC4_inq_var_filter_info(
376        ncid: c_int,
377        varid: c_int,
378        id: c_uint,
379        nparams: *mut usize,
380        params: *mut c_uint,
381    ) -> c_int;
382    pub fn NC_NOOP_inq_var_filter_ids(
383        ncid: c_int,
384        varid: c_int,
385        nfilters: *mut usize,
386        filterids: *mut c_uint,
387    ) -> c_int;
388    pub fn NC_NOOP_inq_var_filter_info(
389        ncid: c_int,
390        varid: c_int,
391        id: c_uint,
392        nparams: *mut usize,
393        params: *mut c_uint,
394    ) -> c_int;
395    pub fn NC_NOOP_inq_filter_avail(ncid: c_int, id: c_uint) -> c_int;
396    pub fn NC_NOTNC4_def_grp(_: c_int, _: *const c_char, _: *mut c_int) -> c_int;
397    pub fn NC_NOTNC4_rename_grp(_: c_int, _: *const c_char) -> c_int;
398    pub fn NC_NOTNC4_def_compound(_: c_int, _: usize, _: *const c_char, _: *mut nc_type) -> c_int;
399    pub fn NC_NOTNC4_insert_compound(
400        _: c_int,
401        _: nc_type,
402        _: *const c_char,
403        _: usize,
404        _: nc_type,
405    ) -> c_int;
406    pub fn NC_NOTNC4_insert_array_compound(
407        _: c_int,
408        _: nc_type,
409        _: *const c_char,
410        _: usize,
411        _: nc_type,
412        _: c_int,
413        _: *const c_int,
414    ) -> c_int;
415    pub fn NC_NOTNC4_inq_typeid(_: c_int, _: *const c_char, _: *mut nc_type) -> c_int;
416    pub fn NC_NOTNC4_inq_compound_field(
417        _: c_int,
418        _: nc_type,
419        _: c_int,
420        _: *mut c_char,
421        _: *mut usize,
422        _: *mut nc_type,
423        _: *mut c_int,
424        _: *mut c_int,
425    ) -> c_int;
426    pub fn NC_NOTNC4_inq_compound_fieldindex(
427        _: c_int,
428        _: nc_type,
429        _: *const c_char,
430        _: *mut c_int,
431    ) -> c_int;
432    pub fn NC_NOTNC4_def_vlen(
433        _: c_int,
434        _: *const c_char,
435        base_typeid: nc_type,
436        _: *mut nc_type,
437    ) -> c_int;
438    pub fn NC_NOTNC4_put_vlen_element(
439        _: c_int,
440        _: c_int,
441        _: *mut c_void,
442        _: usize,
443        _: *const c_void,
444    ) -> c_int;
445    pub fn NC_NOTNC4_get_vlen_element(
446        _: c_int,
447        _: c_int,
448        _: *const c_void,
449        _: *mut usize,
450        _: *mut c_void,
451    ) -> c_int;
452    pub fn NC_NOTNC4_def_enum(_: c_int, _: nc_type, _: *const c_char, _: *mut nc_type) -> c_int;
453    pub fn NC_NOTNC4_insert_enum(_: c_int, _: nc_type, _: *const c_char, _: *const c_void)
454        -> c_int;
455    pub fn NC_NOTNC4_inq_enum_member(
456        _: c_int,
457        _: nc_type,
458        _: c_int,
459        _: *mut c_char,
460        _: *mut c_void,
461    ) -> c_int;
462    pub fn NC_NOTNC4_inq_enum_ident(_: c_int, _: nc_type, _: c_longlong, _: *mut c_char) -> c_int;
463    pub fn NC_NOTNC4_def_opaque(_: c_int, _: usize, _: *const c_char, _: *mut nc_type) -> c_int;
464    pub fn NC_NOTNC4_def_var_deflate(_: c_int, _: c_int, _: c_int, _: c_int, _: c_int) -> c_int;
465    pub fn NC_NOTNC4_def_var_fletcher32(_: c_int, _: c_int, _: c_int) -> c_int;
466    pub fn NC_NOTNC4_def_var_chunking(_: c_int, _: c_int, _: c_int, _: *const usize) -> c_int;
467    pub fn NC_NOTNC4_def_var_endian(_: c_int, _: c_int, _: c_int) -> c_int;
468    pub fn NC_NOTNC4_set_var_chunk_cache(_: c_int, _: c_int, _: usize, _: usize, _: f32) -> c_int;
469    pub fn NC_NOTNC4_get_var_chunk_cache(
470        _: c_int,
471        _: c_int,
472        _: *mut usize,
473        _: *mut usize,
474        _: *mut f32,
475    ) -> c_int;
476    pub fn NC_NOTNC4_var_par_access(_: c_int, _: c_int, _: c_int) -> c_int;
477    pub fn NC_NOTNC4_inq_ncid(_: c_int, _: *const c_char, _: *mut c_int) -> c_int;
478    pub fn NC_NOTNC4_inq_grps(_: c_int, _: *mut c_int, _: *mut c_int) -> c_int;
479    pub fn NC_NOTNC4_inq_grpname(_: c_int, _: *mut c_char) -> c_int;
480    pub fn NC_NOTNC4_inq_grpname_full(_: c_int, _: *mut usize, _: *mut c_char) -> c_int;
481    pub fn NC_NOTNC4_inq_grp_parent(_: c_int, _: *mut c_int) -> c_int;
482    pub fn NC_NOTNC4_inq_grp_full_ncid(_: c_int, _: *const c_char, _: *mut c_int) -> c_int;
483    pub fn NC_NOTNC4_inq_varids(_: c_int, _: *mut c_int, _: *mut c_int) -> c_int;
484    pub fn NC_NOTNC4_inq_dimids(_: c_int, _: *mut c_int, _: *mut c_int, _: c_int) -> c_int;
485    pub fn NC_NOTNC4_inq_typeids(_: c_int, _: *mut c_int, _: *mut c_int) -> c_int;
486    pub fn NC_NOTNC4_inq_user_type(
487        _: c_int,
488        _: nc_type,
489        _: *mut c_char,
490        _: *mut usize,
491        _: *mut nc_type,
492        _: *mut usize,
493        _: *mut c_int,
494    ) -> c_int;
495    pub fn NC_NOTNC4_def_var_quantize(_: c_int, _: c_int, _: c_int, _: c_int) -> c_int;
496    pub fn NC_NOTNC4_inq_var_quantize(_: c_int, _: c_int, _: *mut c_int, _: *mut c_int) -> c_int;
497    pub fn NC_NOTNC3_get_varm(
498        ncid: c_int,
499        varid: c_int,
500        start: *const usize,
501        edges: *const usize,
502        stride: *const isize,
503        imapp: *const isize,
504        value0: *mut c_void,
505        memtype: nc_type,
506    ) -> c_int;
507    pub fn NC_NOTNC3_put_varm(
508        ncid: c_int,
509        varid: c_int,
510        start: *const usize,
511        edges: *const usize,
512        stride: *const isize,
513        imapp: *const isize,
514        value0: *const c_void,
515        memtype: nc_type,
516    ) -> c_int;
517}