NetCDF  4.6.2
nc4dispatch.c
1 /*********************************************************************
2  * Copyright 1993, UCAR/Unidata
3  * See netcdf/COPYRIGHT file for copying and redistribution conditions.
4  * $Header: /upc/share/CVS/netcdf-3/libsrc4/nc4dispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $
5  *********************************************************************/
6 
7 #include "config.h"
8 #include <stdlib.h>
9 #include "nc4internal.h"
10 #include "nc4dispatch.h"
11 #include "nc.h"
12 
13 /* If user-defined formats are in use, we need to declare their
14  * dispatch tables. */
15 #ifdef USE_UDF0
16 extern NC_Dispatch UDF0_DISPATCH;
17 #endif /* USE_UDF0 */
18 #ifdef USE_UDF1
19 extern NC_Dispatch UDF1_DISPATCH;
20 #endif /* USE_UDF1 */
21 
22 #ifdef USE_NETCDF4
23 /* Pointers to dispatch tables for user-defined formats. */
24 extern NC_Dispatch *UDF0_dispatch_table;
25 extern NC_Dispatch *UDF1_dispatch_table;
26 #endif /* USE_NETCDF4 */
27 
28 static NC_Dispatch NC4_dispatcher = {
29 
31 
32 NC4_create,
33 NC4_open,
34 
35 NC4_redef,
36 NC4__enddef,
37 NC4_sync,
38 NC4_abort,
39 NC4_close,
40 NC4_set_fill,
41 NC_NOTNC3_inq_base_pe,
42 NC_NOTNC3_set_base_pe,
43 NC4_inq_format,
44 NC4_inq_format_extended,
45 
46 NC4_inq,
47 NC4_inq_type,
48 
49 NC4_def_dim,
50 NC4_inq_dimid,
51 NC4_inq_dim,
52 NC4_inq_unlimdim,
53 NC4_rename_dim,
54 
55 NC4_inq_att,
56 NC4_inq_attid,
57 NC4_inq_attname,
58 NC4_rename_att,
59 NC4_del_att,
60 NC4_get_att,
61 NC4_put_att,
62 
63 NC4_def_var,
64 NC4_inq_varid,
65 NC4_rename_var,
66 NC4_get_vara,
67 NC4_put_vara,
68 NC4_get_vars,
69 NC4_put_vars,
70 NCDEFAULT_get_varm,
71 NCDEFAULT_put_varm,
72 
73 NC4_inq_var_all,
74 
75 NC4_var_par_access,
76 NC4_def_var_fill,
77 
78 #ifdef USE_NETCDF4
79 NC4_show_metadata,
80 NC4_inq_unlimdims,
81 
82 NC4_inq_ncid,
83 NC4_inq_grps,
84 NC4_inq_grpname,
85 NC4_inq_grpname_full,
86 NC4_inq_grp_parent,
87 NC4_inq_grp_full_ncid,
88 NC4_inq_varids,
89 NC4_inq_dimids,
90 NC4_inq_typeids,
91 NC4_inq_type_equal,
92 NC4_def_grp,
93 NC4_rename_grp,
94 NC4_inq_user_type,
95 NC4_inq_typeid,
96 
97 NC4_def_compound,
98 NC4_insert_compound,
99 NC4_insert_array_compound,
100 NC4_inq_compound_field,
101 NC4_inq_compound_fieldindex,
102 NC4_def_vlen,
103 NC4_put_vlen_element,
104 NC4_get_vlen_element,
105 NC4_def_enum,
106 NC4_insert_enum,
107 NC4_inq_enum_member,
108 NC4_inq_enum_ident,
109 NC4_def_opaque,
110 NC4_def_var_deflate,
111 NC4_def_var_fletcher32,
112 NC4_def_var_chunking,
113 NC4_def_var_endian,
114 NC4_def_var_filter,
115 NC4_set_var_chunk_cache,
116 NC4_get_var_chunk_cache,
117 #endif
118 
119 };
120 
121 NC_Dispatch* NC4_dispatch_table = NULL; /* moved here from ddispatch.c */
122 
130 int
131 NC4_initialize(void)
132 {
133  int ret = NC_NOERR;
134 
135  NC4_dispatch_table = &NC4_dispatcher;
136 
137  /* This needs some kind of conditional on if libhdf5 is enabled */
138  if(!nc4_hdf5_initialized)
139  nc4_hdf5_initialize();
140 
141 #ifdef USE_UDF0
142  /* If user-defined format 0 was specified during configure, set up
143  * it's dispatch table. */
144  if ((ret = nc_def_user_format(NC_UDF0, UDF0_DISPATCH_FUNC, NULL)))
145  return ret;
146 #endif /* USE_UDF0 */
147 
148 #ifdef USE_UDF1
149  /* If user-defined format 0 was specified during configure, set up
150  * it's dispatch table. */
151  if ((ret = nc_def_user_format(NC_UDF1F, &UDF1_DISPATCH_FUNC, NULL)))
152  return ret;
153 #endif /* USE_UDF0 */
154 
155 #ifdef LOGGING
156  if(getenv(NCLOGLEVELENV) != NULL) {
157  char* slevel = getenv(NCLOGLEVELENV);
158  long level = atol(slevel);
159  if(level >= 0)
160  nc_set_log_level((int)level);
161 }
162 #endif
163  return ret;
164 }
165 
172 int
173 NC4_finalize(void)
174 {
175  nc4_hdf5_finalize();
176  return NC_NOERR;
177 }
EXTERNL int nc_def_user_format(int mode_flag, NC_Dispatch *dispatch_table, char *magic_number)
Add handling of user-defined format.
Definition: dfile.c:128
#define NC_FORMATX_NC4
alias
Definition: netcdf.h:210
#define NC_UDF0
User-defined format 0.
Definition: netcdf.h:134
#define NC_NOERR
No Error.
Definition: netcdf.h:322

Return to the Main Unidata NetCDF page.
Generated on Wed Mar 4 2020 06:29:56 for NetCDF. NetCDF is a Unidata library.