ncd3dispatch.c 5.0 KB

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