libdsdb3  3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups
dbog_retriever.h
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * COPYRIGHT (C) 2010 Battelle Memorial Institute. All Rights Reserved.
4 *
5 ********************************************************************************
6 *
7 * Author:
8 * name: Krista Gaustad
9 * phone: (509) 375-5950
10 * email: krista.gaustad@pnl.gov
11 *
12 ********************************************************************************
13 *
14 * REPOSITORY INFORMATION:
15 * $Revision: 12610 $
16 * $Author: ermold $
17 * $Date: 2012-02-08 06:22:32 +0000 (Wed, 08 Feb 2012) $
18 *
19 *******************************************************************************/
20 
21 /** @file dbog_retriever.h
22  * Header file for Retriever object group functions.
23  */
24 
25 #ifndef _DBOG_RETRIEVER_H_
26 #define _DBOG_RETRIEVER_H_ 1
27 
28 #define MAXSTRING 1024
29 
30 #include "dbconn.h"
31 
32 /*@{*/
33 /** @privatesection */
34 
35 /*******************************************************************************
36 * Get all coordinate system dimensions defined for a process.
37 */
38 
39 DBStatus retog_get_coord_dims(
40  DBConn *dbconn,
41  const char *proc_type,
42  const char *proc_name,
43  DBResult **result);
44 
45 #define RetCoordDim_SystemID(dbres,row) DB_RESULT(dbres,row,0)
46 #define RetCoordDim_Order(dbres,row) DB_RESULT(dbres,row,1)
47 #define RetCoordDim_Name(dbres,row) DB_RESULT(dbres,row,2)
48 #define RetCoordDim_Interval(dbres,row) DB_RESULT(dbres,row,3)
49 #define RetCoordDim_Units(dbres,row) DB_RESULT(dbres,row,4)
50 #define RetCoordDim_SubGroupID(dbres,row) DB_RESULT(dbres,row,5)
51 #define RetCoordDim_ID(dbres,row) DB_RESULT(dbres,row,6)
52 #define RetCoordDim_DataType(dbres,row) DB_RESULT(dbres,row,7)
53 #define RetCoordDim_TransType(dbres,row) DB_RESULT(dbres,row,8)
54 #define RetCoordDim_TransRange(dbres,row) DB_RESULT(dbres,row,9)
55 #define RetCoordDim_TransAlign(dbres,row) DB_RESULT(dbres,row,10)
56 #define RetCoordDim_Start(dbres,row) DB_RESULT(dbres,row,11)
57 #define RetCoordDim_Length(dbres,row) DB_RESULT(dbres,row,12)
58 
59 /*******************************************************************************
60 * Get all coordinate systems defined for a process.
61 */
62 
63 DBStatus retog_get_coord_systems(
64  DBConn *dbconn,
65  const char *proc_type,
66  const char *proc_name,
67  DBResult **result);
68 
69 #define RetCoordSystem_ID(dbres,row) DB_RESULT(dbres,row,0)
70 #define RetCoordSystem_Name(dbres,row) DB_RESULT(dbres,row,1)
71 
72 /*******************************************************************************
73 * Get all coordinate variable names for all coordinate system dimensions
74 * defined for a process.
75 */
76 
77 DBStatus retog_get_coord_var_names(
78  DBConn *dbconn,
79  const char *proc_type,
80  const char *proc_name,
81  DBResult **result);
82 
83 #define RetCoordDimVar_CoordDimID(dbres,row) DB_RESULT(dbres,row,0)
84 #define RetCoordDimVar_DsID(dbres,row) DB_RESULT(dbres,row,1)
85 #define RetCoordDimVar_Priority(dbres,row) DB_RESULT(dbres,row,2)
86 #define RetCoordDimVar_Name(dbres,row) DB_RESULT(dbres,row,3)
87 
88 /*******************************************************************************
89 * Get all retriever datastreams defined for a process.
90 */
91 
92 DBStatus retog_get_datastreams(
93  DBConn *dbconn,
94  const char *proc_type,
95  const char *proc_name,
96  DBResult **result);
97 
98 #define RetDs_SubGroupID(dbres,row) DB_RESULT(dbres,row,0)
99 #define RetDs_SubGroupPriority(dbres,row) DB_RESULT(dbres,row,1)
100 #define RetDs_DsID(dbres,row) DB_RESULT(dbres,row,2)
101 #define RetDs_Name(dbres,row) DB_RESULT(dbres,row,3)
102 #define RetDs_Level(dbres,row) DB_RESULT(dbres,row,4)
103 #define RetDs_Site(dbres,row) DB_RESULT(dbres,row,5)
104 #define RetDs_Fac(dbres,row) DB_RESULT(dbres,row,6)
105 #define RetDs_SiteDep(dbres,row) DB_RESULT(dbres,row,7)
106 #define RetDs_FacDep(dbres,row) DB_RESULT(dbres,row,8)
107 #define RetDs_BegDateDep(dbres,row) DB_RESULT(dbres,row,9)
108 #define RetDs_EndDateDep(dbres,row) DB_RESULT(dbres,row,10)
109 
110 /*******************************************************************************
111 * Get all retriever groups and subgroups defined for a process.
112 */
113 
114 DBStatus retog_get_groups(
115  DBConn *dbconn,
116  const char *proc_type,
117  const char *proc_name,
118  DBResult **result);
119 
120 #define Ret_GroupID(dbres,row) DB_RESULT(dbres,row,0)
121 #define Ret_SubGroupOrder(dbres,row) DB_RESULT(dbres,row,1)
122 #define Ret_SubGroupID(dbres,row) DB_RESULT(dbres,row,2)
123 #define Ret_GroupName(dbres,row) DB_RESULT(dbres,row,3)
124 #define Ret_SubGroupName(dbres,row) DB_RESULT(dbres,row,4)
125 
126 /*******************************************************************************
127 * Get all retriever variables defined for a process.
128 */
129 
130 DBStatus retog_get_variables(
131  DBConn *dbconn,
132  const char *proc_type,
133  const char *proc_name,
134  DBResult **result);
135 
136 #define RetVar_GroupID(dbres,row) DB_RESULT(dbres,row,0)
137 #define RetVar_VarID(dbres,row) DB_RESULT(dbres,row,1)
138 #define RetVar_Name(dbres,row) DB_RESULT(dbres,row,2)
139 #define RetVar_CoordSystemID(dbres,row) DB_RESULT(dbres,row,3)
140 #define RetVar_Units(dbres,row) DB_RESULT(dbres,row,4)
141 #define RetVar_DataType(dbres,row) DB_RESULT(dbres,row,5)
142 #define RetVar_StartOffset(dbres,row) DB_RESULT(dbres,row,6)
143 #define RetVar_EndOffset(dbres,row) DB_RESULT(dbres,row,7)
144 #define RetVar_Max(dbres,row) DB_RESULT(dbres,row,8)
145 #define RetVar_Min(dbres,row) DB_RESULT(dbres,row,9)
146 #define RetVar_Delta(dbres,row) DB_RESULT(dbres,row,10)
147 #define RetVar_ReqToRun(dbres,row) DB_RESULT(dbres,row,11)
148 #define RetVar_QCFlag(dbres,row) DB_RESULT(dbres,row,12)
149 #define RetVar_QCReqToRun(dbres,row) DB_RESULT(dbres,row,13)
150 
151 /*******************************************************************************
152 * Get all dimension names names defined for all retriever variables.
153 */
154 
155 DBStatus retog_get_var_dims(
156  DBConn *dbconn,
157  const char *proc_type,
158  const char *proc_name,
159  DBResult **result);
160 
161 #define RetVarDim_VarID(dbres,row) DB_RESULT(dbres,row,0)
162 #define RetVarDim_Order(dbres,row) DB_RESULT(dbres,row,1)
163 #define RetVarDim_Name(dbres,row) DB_RESULT(dbres,row,2)
164 
165 /*******************************************************************************
166 * Get all input variable names defined for all retriever variables.
167 */
168 
169 DBStatus retog_get_var_names(
170  DBConn *dbconn,
171  const char *proc_type,
172  const char *proc_name,
173  DBResult **result);
174 
175 #define RetVarName_VarID(dbres,row) DB_RESULT(dbres,row,0)
176 #define RetVarName_DsID(dbres,row) DB_RESULT(dbres,row,1)
177 #define RetVarName_Priority(dbres,row) DB_RESULT(dbres,row,2)
178 #define RetVarName_Name(dbres,row) DB_RESULT(dbres,row,3)
179 
180 /*******************************************************************************
181 * Get all output datastreams and variables defined for all retriever variables.
182 */
183 
184 DBStatus retog_get_var_outputs(
185  DBConn *dbconn,
186  const char *proc_type,
187  const char *proc_name,
188  DBResult **result);
189 
190 #define RetVarOut_VarID(dbres,row) DB_RESULT(dbres,row,0)
191 #define RetVarOut_DsName(dbres,row) DB_RESULT(dbres,row,1)
192 #define RetVarOut_DsLevel(dbres,row) DB_RESULT(dbres,row,2)
193 #define RetVarOut_VarName(dbres,row) DB_RESULT(dbres,row,3)
194 
195 
196 /*******************************************************************************
197 * Old database calls.
198 */
199 
200 DBStatus retrieverog_get_varnames(
201  DBConn *dbconn,
202  const char *proc_type,
203  const char *proc_name,
204  const char *datastream_name,
205  const char *datastream_level,
206  const char *subgroup_name,
207  const char *site,
208  const char *facility,
209  const char *site_dependency,
210  const char *facility_dependency,
211  time_t begin_date_dependency,
212  const char *group_name,
213  const char *vargroup_name,
214  DBResult **result);
215 
216 DBStatus retrieverog_get_vardimnames(
217  DBConn *dbconn,
218  const char *proc_type,
219  const char *proc_name,
220  const char *datastream_name,
221  const char *datastream_level,
222  const char *subgroup_name,
223  const char *site,
224  const char *facility,
225  const char *site_dependency,
226  const char *facility_dependency,
227  time_t begin_date_dependency,
228  const char *coord_system_name,
229  const char *dimname,
230  DBResult **result);
231 
232 DBStatus retrieverog_get_coord_dims(
233  DBConn *dbconn,
234  const char *proc_type,
235  const char *proc_name,
236  const char *ret_coord_system_name,
237  DBResult **result);
238 
239 DBStatus retrieverog_get_vargroups(
240  DBConn *dbconn,
241  const char *ds_group_name,
242  const char *proc_type,
243  const char *proc_name,
244  DBResult **result);
245 
246 DBStatus retrieverog_get_datastreams(
247  DBConn *dbconn,
248  const char *proc_type,
249  const char *proc_name,
250  const char *ds_subgroup_name,
251  DBResult **result);
252 
253 DBStatus retrieverog_select_ds_subgroup_name(
254  DBConn *dbconn,
255  const char *proc_type,
256  const char *proc_name,
257  int subgroup_id,
258  char **result);
259 
260 DBStatus retrieverog_get_ds_subgroups(
261  DBConn *dbconn,
262  const char *proc_type,
263  const char *proc_name,
264  DBResult **result);
265 
266 DBStatus retrieverog_get_ds_groups(
267  DBConn *dbconn,
268  const char *proc_type,
269  const char *proc_name,
270  DBResult **result);
271 
272 DBStatus retrieverog_get_ds_subgroups_by_group(
273  DBConn *dbconn,
274  const char *proc_type,
275  const char *proc_name,
276  const char *group_name,
277  DBResult **result);
278 
279 /* inquire_ds_groups returns, proc type, proc name, group name) */
280 #define DsGroupPtype(dbres,row) DB_RESULT(dbres,row,0)
281 #define DsGroupPname(dbres,row) DB_RESULT(dbres,row,1)
282 #define DsGroupGname(dbres,row) DB_RESULT(dbres,row,2)
283 
284 /* inquire_ds_subgroups returns, proc type, proc name, group name, subgroup name) */
285 #define DsGroupSubGname(dbres,row) DB_RESULT(dbres,row,3)
286 #define DsGroupSubGorder(dbres,row) DB_RESULT(dbres,row,4)
287 
288 /* get_datastreams returns, datastream name, datastream level, site, facility, */
289 /* datastream subgroup priority, site dependency, facility dependency, begin date */
290 /* dependency, end date dependency */
291 #define DstreamName(dbres,row) DB_RESULT(dbres,row,2)
292 #define DstreamLevel(dbres,row) DB_RESULT(dbres,row,3)
293 #define DstreamSite(dbres,row) DB_RESULT(dbres,row,5)
294 #define DstreamFac(dbres,row) DB_RESULT(dbres,row,6)
295 #define DstreamSubPriority(dbres,row) DB_RESULT(dbres,row,7)
296 #define DstreamSiteDep(dbres,row) DB_RESULT(dbres,row,8)
297 #define DstreamFacDep(dbres,row) DB_RESULT(dbres,row,9)
298 #define DstreamBegDateDep(dbres,row) DB_RESULT(dbres,row,10)
299 #define DstreamEndDateDep(dbres,row) DB_RESULT(dbres,row,11)
300 
301 /* get_vargroups returns: vargroup name, vargroup data type, var group units, */
302 /* sample period, start offset, end offset, max, min, delta, ndims, dims, */
303 /* number of variable names for the group, flag indicating whether field is */
304 /* required for the vap to run, flag indicating whehter the qc field should be */
305 /* retrieved, and a flag indicating whether the qc fields is required for the */
306 /* vap to run. */
307 #define VGgroupName(dbres,row) DB_RESULT(dbres,row,0)
308 #define VGvargroupName(dbres,row) DB_RESULT(dbres,row,3)
309 #define VGCoordSystemName(dbres,row) DB_RESULT(dbres,row,4)
310 #define VGgroupUnits(dbres,row) DB_RESULT(dbres,row,5)
311 #define VGgroupDataType(dbres,row) DB_RESULT(dbres,row,6)
312 #define VGgroupStartOffset(dbres,row) DB_RESULT(dbres,row,7)
313 #define VGgroupEndOffset(dbres,row) DB_RESULT(dbres,row,8)
314 #define VGgroupMax(dbres,row) DB_RESULT(dbres,row,9)
315 #define VGgroupMin(dbres,row) DB_RESULT(dbres,row,10)
316 #define VGgroupDelta(dbres,row) DB_RESULT(dbres,row,11)
317 #define VGgroupReqRunFlg(dbres,row) DB_RESULT(dbres,row,12)
318 #define VGgroupQCFlg(dbres,row) DB_RESULT(dbres,row,13)
319 #define VGgroupQCReqRunFlag(dbres,row) DB_RESULT(dbres,row,14)
320 
321 /* get_varnames returns: process type, process name, datastream class */
322 /* datastream level, datastream group name, datastream subgroup name, */
323 /* site,facility,variable group name,variable name and variable priority */
324 #define RetVname(dbres,row) DB_RESULT(dbres,row,12)
325 #define RetVpriority(dbres,row) DB_RESULT(dbres,row,13)
326 
327 /* get_vardimnames returns: process type, process name, datastream class */
328 /* datastream level, datastream subgroup name, */
329 /* site,facility,coordinate system name,,dimension name and dimension priority */
330 #define RetVarDname(dbres,row) DB_RESULT(dbres,row,12)
331 #define RetVarDpriority(dbres,row) DB_RESULT(dbres,row,13)
332 
333 /* get_coord_dims returns: process type, process name, ret_coord_system_name */
334 /* dim_name level, ret_dim_order, subgroup name,dim_interval, and dim_unts */
335 #define RetCDimDimName(dbres,row) DB_RESULT(dbres,row,3)
336 #define RetCDimDimOrder(dbres,row) DB_RESULT(dbres,row,4)
337 #define RetCDimSubgroupName(dbres,row) DB_RESULT(dbres,row,5)
338 #define RetCDimInterval(dbres,row) DB_RESULT(dbres,row,6)
339 #define RetCDimUnits(dbres,row) DB_RESULT(dbres,row,7)
340 /*@}*/
341 
342 #endif /* _DBOG_RETRIEVER_H_ */