1 | /********************************************************************* |
---|
2 | * Copyright 1993, UCAR/Unidata |
---|
3 | * See netcdf/COPYRIGHT file for copying and redistribution conditions. |
---|
4 | * $Header: /upc/share/CVS/netcdf-3/libncdap3/ncd3dispatch.c,v 1.7 2010/05/27 21:34:09 dmh Exp $ |
---|
5 | *********************************************************************/ |
---|
6 | |
---|
7 | #include "config.h" |
---|
8 | #include <stdlib.h> |
---|
9 | #include <string.h> |
---|
10 | |
---|
11 | #include "nc.h" |
---|
12 | #include "ncdap3.h" |
---|
13 | #include "ncdispatch.h" |
---|
14 | #include "ncd3dispatch.h" |
---|
15 | |
---|
16 | static int |
---|
17 | NCD3_create(const char *path, int cmode, |
---|
18 | size_t initialsz, int basepe, size_t *chunksizehintp, |
---|
19 | int use_parallel, void* mpidata, |
---|
20 | NC_Dispatch*,NC** ncp); |
---|
21 | |
---|
22 | static int NCD3_redef(int ncid); |
---|
23 | static int NCD3__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align); |
---|
24 | static int NCD3_sync(int ncid); |
---|
25 | static int NCD3_abort(int ncid); |
---|
26 | |
---|
27 | static int NCD3_put_vara(int ncid, int varid, |
---|
28 | const size_t *start, const size_t *edges0, |
---|
29 | const void *value0, |
---|
30 | nc_type memtype); |
---|
31 | |
---|
32 | static int NCD3_get_vara(int ncid, int varid, |
---|
33 | const size_t *start, const size_t *edges, |
---|
34 | void *value, |
---|
35 | nc_type memtype); |
---|
36 | |
---|
37 | static int NCD3_put_vars(int ncid, int varid, |
---|
38 | const size_t *start, const size_t *edges, const ptrdiff_t* stride, |
---|
39 | const void *value0, nc_type memtype); |
---|
40 | |
---|
41 | static int NCD3_get_vars(int ncid, int varid, |
---|
42 | const size_t *start, const size_t *edges, const ptrdiff_t* stride, |
---|
43 | void *value, nc_type memtype); |
---|
44 | |
---|
45 | NC_Dispatch NCD3_dispatch_base = { |
---|
46 | |
---|
47 | NC_DISPATCH_NC3 | NC_DISPATCH_NCD, |
---|
48 | |
---|
49 | /* Note: we are using the standard substrate struct NC creator */ |
---|
50 | NULL, |
---|
51 | |
---|
52 | NCD3_create, |
---|
53 | NCD3_open, |
---|
54 | |
---|
55 | NCD3_redef, |
---|
56 | NCD3__enddef, |
---|
57 | NCD3_sync, |
---|
58 | NCD3_abort, |
---|
59 | NCD3_close, |
---|
60 | NULL, /*set_fill*/ |
---|
61 | NULL, /*inq_base_pe*/ |
---|
62 | NULL, /*set_base_pe*/ |
---|
63 | NULL, /*inq_format*/ |
---|
64 | |
---|
65 | NULL, /*inq*/ |
---|
66 | NULL, /*inq_type*/ |
---|
67 | |
---|
68 | NULL, /*def_dim*/ |
---|
69 | NULL, /*inq_dimid*/ |
---|
70 | NULL, /*inq_dim*/ |
---|
71 | NULL, /*inq_unlimdim*/ |
---|
72 | NULL, /*rename_dim*/ |
---|
73 | |
---|
74 | NULL, /*inq_att*/ |
---|
75 | NULL, /*inq_attid*/ |
---|
76 | NULL, /*inq_attname*/ |
---|
77 | NULL, /*rename_att*/ |
---|
78 | NULL, /*del_att*/ |
---|
79 | NULL, /*get_att*/ |
---|
80 | NULL, /*put_att*/ |
---|
81 | |
---|
82 | NULL, /*def_var*/ |
---|
83 | NULL, /*inq_varid*/ |
---|
84 | NULL, /*rename_var*/ |
---|
85 | NCD3_get_vara, |
---|
86 | NCD3_put_vara, |
---|
87 | NCD3_get_vars, |
---|
88 | NCD3_put_vars, |
---|
89 | NCDEFAULT_get_varm, |
---|
90 | NCDEFAULT_put_varm, |
---|
91 | |
---|
92 | NULL, /*inq_var_all*/ |
---|
93 | |
---|
94 | #ifdef USE_NETCDF4 |
---|
95 | NULL, /*show_metadata*/ |
---|
96 | NULL, /*inq_unlimdims*/ |
---|
97 | NULL, /*var_par_access*/ |
---|
98 | NULL, /*inq_ncid*/ |
---|
99 | NULL, /*inq_grps*/ |
---|
100 | NULL, /*inq_grpname*/ |
---|
101 | NULL, /*inq_grpname_full*/ |
---|
102 | NULL, /*inq_grp_parent*/ |
---|
103 | NULL, /*inq_grp_full_ncid*/ |
---|
104 | NULL, /*inq_varids*/ |
---|
105 | NULL, /*inq_dimids*/ |
---|
106 | NULL, /*inq_typeids*/ |
---|
107 | NULL, /*inq_type_equal*/ |
---|
108 | NULL, /*def_grp*/ |
---|
109 | NULL, /*inq_user_type*/ |
---|
110 | NULL, /*inq_typeid*/ |
---|
111 | |
---|
112 | NULL, /*def_compound*/ |
---|
113 | NULL, /*insert_compound*/ |
---|
114 | NULL, /*insert_array_compound*/ |
---|
115 | NULL, /*inq_compound_field*/ |
---|
116 | NULL, /*inq_compound_fieldindex*/ |
---|
117 | NULL, /*def_vlen*/ |
---|
118 | NULL, /*put_vlen_element*/ |
---|
119 | NULL, /*get_vlen_element*/ |
---|
120 | NULL, /*def_enum*/ |
---|
121 | NULL, /*insert_enum*/ |
---|
122 | NULL, /*inq_enum_member*/ |
---|
123 | NULL, /*inq_enum_ident*/ |
---|
124 | NULL, /*def_opaque*/ |
---|
125 | NULL, /*def_var_deflate*/ |
---|
126 | NULL, /*def_var_fletcher32*/ |
---|
127 | NULL, /*def_var_chunking*/ |
---|
128 | NULL, /*def_var_fill*/ |
---|
129 | NULL, /*def_var_endian*/ |
---|
130 | NULL, /*set_var_chunk_cache*/ |
---|
131 | NULL, /*get_var_chunk_cache*/ |
---|
132 | |
---|
133 | #endif /*USE_NETCDF4*/ |
---|
134 | |
---|
135 | }; |
---|
136 | |
---|
137 | NC_Dispatch* NCD3_dispatch_table = NULL; /* moved here from ddispatch.c */ |
---|
138 | |
---|
139 | NC_Dispatch NCD3_dispatcher; /* overlay result */ |
---|
140 | |
---|
141 | int |
---|
142 | NCD3_initialize(void) |
---|
143 | { |
---|
144 | /* Create our dispatch table as the merge of NCD3 table and NCSUBSTRATE */ |
---|
145 | /* watch the order because we want NCD3 to overwrite NCSUBSTRATE */ |
---|
146 | NC_dispatch_overlay(&NCD3_dispatch_base, NCSUBSTRATE_dispatch_table, &NCD3_dispatcher); |
---|
147 | NCD3_dispatch_table = &NCD3_dispatcher; |
---|
148 | return NC_NOERR; |
---|
149 | } |
---|
150 | |
---|
151 | static int |
---|
152 | NCD3_redef(int ncid) |
---|
153 | { |
---|
154 | return (NC_EPERM); |
---|
155 | } |
---|
156 | |
---|
157 | static int |
---|
158 | NCD3__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align) |
---|
159 | { |
---|
160 | return (NC_EPERM); |
---|
161 | } |
---|
162 | |
---|
163 | static int |
---|
164 | NCD3_sync(int ncid) |
---|
165 | { |
---|
166 | return (NC_EINVAL); |
---|
167 | } |
---|
168 | |
---|
169 | static int |
---|
170 | NCD3_abort(int ncid) |
---|
171 | { |
---|
172 | return NCD3_close(ncid); |
---|
173 | } |
---|
174 | |
---|
175 | static int |
---|
176 | NCD3_create(const char *path, int cmode, |
---|
177 | size_t initialsz, int basepe, size_t *chunksizehintp, |
---|
178 | int use_parallel, void* mpidata, |
---|
179 | NC_Dispatch* dispatch, NC** ncp) |
---|
180 | { |
---|
181 | return NC_EPERM; |
---|
182 | } |
---|
183 | |
---|
184 | static int |
---|
185 | NCD3_put_vara(int ncid, int varid, |
---|
186 | const size_t *start, const size_t *edges, |
---|
187 | const void *value, |
---|
188 | nc_type memtype) |
---|
189 | { |
---|
190 | return NC_EPERM; |
---|
191 | } |
---|
192 | |
---|
193 | static int |
---|
194 | NCD3_get_vara(int ncid, int varid, |
---|
195 | const size_t *start, const size_t *edges, |
---|
196 | void *value, |
---|
197 | nc_type memtype) |
---|
198 | { |
---|
199 | int stat = nc3d_getvarx(ncid, varid, start, edges, nc_ptrdiffvector1, value,memtype); |
---|
200 | return stat; |
---|
201 | } |
---|
202 | |
---|
203 | static int |
---|
204 | NCD3_put_vars(int ncid, int varid, |
---|
205 | const size_t *start, const size_t *edges, const ptrdiff_t* stride, |
---|
206 | const void *value0, nc_type memtype) |
---|
207 | { |
---|
208 | return NC_EPERM; |
---|
209 | } |
---|
210 | |
---|
211 | static int |
---|
212 | NCD3_get_vars(int ncid, int varid, |
---|
213 | const size_t *start, const size_t *edges, const ptrdiff_t* stride, |
---|
214 | void *value, nc_type memtype) |
---|
215 | { |
---|
216 | int stat = nc3d_getvarx(ncid, varid, start, edges, stride, value, memtype); |
---|
217 | return stat; |
---|
218 | } |
---|