das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
cli.h
Go to the documentation of this file.
1
11#ifndef das2_2_cli_H_
12#define das2_2_cli_H_
13
14#include <das3/das1.h>
15
16#include <string.h>
17#include <stdbool.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24#define OP_BEG ".ge."
25#define OP_END ".lt."
26#define OP_EQ ".eq."
27#define OP_NE ".ne."
28#define OP_LT ".lt."
29#define OP_GT ".gt."
30#define OP_LE ".le."
31#define OP_GE ".ge."
32
34enum das_selfmt{bool_t, int_t, real_t, string_t, timept_t};
35
37#define REQUIRED 0x00
38#define OPTIONAL 0x01
39#define ENUM 0x02
40#define INTERVAL 0x04
41#define XLATE_GE_LT 0x08 /* Use .beg. and .end. synonyms for .ge. and .lt.
42 when providing user text for this selector. */
43
44#define SHOW_DEFAULT 0x10 /* Show the default values in the help text */
45
47typedef struct das_selector_t{
48
50 const char* sKey;
51
53 enum das_selfmt nFmt;
54
56 unsigned int nFlags;
57
60 const char** psBounds;
61
62 /* A major design oversight: Should be allowed to place the default
63 values here. Since we can't do that the user ends up re-specifying
64 them all over the place in their programs which invites bugs! */
65 /* const char** psDefaults; */
66
68 const char* sSummary;
69
71 char** psValues;
72
74
75
86const char* das_get_selstr(const DasSelector* pSels, const char* sKey,
87 const char* sOp, const char* sDefault);
88
89const char* das_selstr(const DasSelector* pSel, const char* sOp,
90 const char* sDefault);
91
95int das_get_selint(const DasSelector* pSels, const char* sKey,
96 const char* sOp, int nDefault);
97
98int das_selint(const DasSelector* pSel, const char* sOp, int nDefault);
99
100
104bool das_get_selbool(const DasSelector* pSels, const char* sKey, bool bDefault);
105
106bool das_selbool(const DasSelector* pSel, bool bDefault);
107
108
113double das_get_selreal(const DasSelector* pSels, const char* sKey,
114 const char* sOp, double rDefault);
115
118double das_selreal(const DasSelector* pSel, const char* sOp, double rDefault);
119
120
124void das_get_seltime(const DasSelector* pSels, const char* sKey, const char* sOp,
125 int* yr, int* mon, int* dom, int* doy, int* hr, int* min, double* sec);
126
127void das_seltime(const DasSelector* pSel, const char* sOp, int* yr, int* mon,
128 int* dom, int* doy, int* hr, int* min, double* sec);
129
132 const DasSelector* pSels, const char* sKey, const char* sOp, das_time* pDt
133);
134
136void das_seldastime(const DasSelector* pSel, const char* sOp, das_time* pDt);
137
138
144const char* das_get_selenum(const DasSelector* pSels, const char* sKey,
145 const char* sDefault);
146
147const char* das_selenum(const DasSelector* pSel, const char* sDefault);
148
149
152#define DAS_OUT_DISABLE 0x0200
153
157typedef struct das_output_t{
158
160 const char* sKey;
161
163 const char* sUnits;
164
166 unsigned int nOpts;
167
169 const char** psDepends;
170
172 const char* sSummary;
173
175 char* sInterval;
176
177}DasOutput;
178
179
181bool das_get_outenabled(const DasOutput* pOuts, const char* sKey);
182
184bool das_outenabled(const DasOutput* pOut);
185
187double das_get_outinterval(const DasOutput* pOuts, const char* sKey,
188 double rDefault);
189
191double das_outinterval(const DasOutput* pOut, double rDefault);
192
193
231void das_parsecmdline(int nArgs, char** sArgs, DasSelector* pSels,
232 DasOutput* pOuts, const char* sDesc, const char* sFooter);
233
234
238const char* das_progname();
239
240#define DAS_LL_CRIT 100 /* same as java.util.logging.Level.SEVERE */
241#define DAS_LL_ERROR 80
242#define DAS_LL_WARN 60 /* same as java.util.logging.Level.WARNING */
243#define DAS_LL_INFO 40 /* same as java.util.logging.Level.INFO & CONFIG */
244#define DAS_LL_DEBUG 20 /* same as java.util.logging.Level.FINE */
245#define DAS_LL_TRACE 0 /* same as java.util.logging.Level.FINER & FINEST */
246
254int das_loglevel();
255
256
257#ifdef __cplusplus
258}
259#endif
260
261
262#endif /* das2_2_cli_H_ */
bool das_get_outenabled(const DasOutput *pOuts, const char *sKey)
Search for the enabled status for a named output.
double das_selreal(const DasSelector *pSel, const char *sOp, double rDefault)
Get a selection criteria from a particular selector as a double.
const char * das_progname()
Get the program basename Only works after das_parsecmdline() has been called.
bool das_outenabled(const DasOutput *pOut)
Get the enabled status for a given output.
int das_loglevel()
Get the log level.
void das_get_seldastime(const DasSelector *pSels, const char *sKey, const char *sOp, das_time *pDt)
Equivalent to das_get_seltime but uses the new das_time type from time.h.
void das_seldastime(const DasSelector *pSel, const char *sOp, das_time *pDt)
Equivalent to das_seltime but uses the new das_time type from time.h.
das_selfmt
An enumeration of das selector value types.
Definition cli.h:34
double das_outinterval(const DasOutput *pOut, double rDefault)
Get the interval setting for a given output.
bool das_get_selbool(const DasSelector *pSels, const char *sKey, bool bDefault)
Get a selection criteria as a boolean Only works for BOOLEAN format selectors.
int das_get_selint(const DasSelector *pSels, const char *sKey, const char *sOp, int nDefault)
Get the selection boundary as an integer This function only works for INTEGER parameter types.
void das_get_seltime(const DasSelector *pSels, const char *sKey, const char *sOp, int *yr, int *mon, int *dom, int *doy, int *hr, int *min, double *sec)
Parse the boundary value into a time tuple.
const char * das_get_selstr(const DasSelector *pSels, const char *sKey, const char *sOp, const char *sDefault)
Get the a selection boundary as a raw string.
double das_get_selreal(const DasSelector *pSels, const char *sKey, const char *sOp, double rDefault)
Search for a selection criteria, return boundary value as a double.
void das_parsecmdline(int nArgs, char **sArgs, DasSelector *pSels, DasOutput *pOuts, const char *sDesc, const char *sFooter)
Parse a Das 2.3 style commandline, with Das 2.1 support.
double das_get_outinterval(const DasOutput *pOuts, const char *sKey, double rDefault)
Search for the interval setting for a named output.
const char * das_get_selenum(const DasSelector *pSels, const char *sKey, const char *sDefault)
A short form of das_getstr for enumeration selectors.
Das 1 Compatibility Utilities.
A basic statement of output is needed to help with output resolution reduction.
Definition cli.h:156
Holds a single data selection query parameter.
Definition cli.h:46
Basic date-time structure used throughout the Das1 & Das2 utilities.
Definition time.h:43