UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
trselect.h
1 /* trselect.h */
2 /* $Id: trselect.h,v 1.6 2003/02/19 14:39:49 ibadm Exp $ */
3 #ifndef __trselect_h
4 #define __trselect_h
5 
6 /***********************************************************************
7  *
8  * Tools to 'select' traces in SQL-like manner.
9  *
10  ***********************************************************************/
11 
12 #include <stdarg.h>
13 #include <mix/trset.h>
14 #include <mix/vsp_trace.h>
15 #include <mix/ErrCodes.h>
16 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21 
22  /*
23  * DATA TYPES AND DEFINITIONS
24  */
25 
29  typedef enum
30  {
31  TsMopEQ,
32  TsMopNE,
33  TsMopMultiEQ,
34  TsMopGT,
35  TsMopLT,
36  TsMopRANGE,
38  __TsMopNumber__
39 
40  } TsMatchOp;
41 
45  typedef enum
46  {
47  TsVaUnique = (int)__TsMopNumber__,
48  TsVaAscentOrder,
49  TsVaDescentOrder,
50 #if 0
51  TsVaMopGE, /* greater or equal to <arg> */
52  TsVaMopLE, /* less or equal to <arg> */
53 #endif
54  TsVaEnd = (-1)
56  } TsVarArgOp;
57 
61  typedef union
62  {
63  Int4 i;
64  Real4 r;
65  Char c;
66  Int4 *pi;
67  Real4 *pr;
68  Char *pc;
69 
70  } TsMatchArg;
71 
76  typedef struct
77  {
78  TraceAttrId taid; /* name of trace header field */
79  TsMatchOp mop; /* matching operation */
80  TsMatchArg marg; /* matching argument */
81  unsigned arg_dim; /* argument's dimension for TsMopMultiEQ */
82 
83  } TsInclRule;
84 
88  typedef struct
89  {
90  TraceAttrId taid; /* name of trace header field */
91 
92  } TsUniqRule;
93 
97  typedef struct
98  {
99  TraceAttrId taid;
100  Compar order;
101 
102  } TsSortRule;
103 
109  typedef struct
110  {
112  unsigned incl_rules_n;
113  TsInclRule *incl_rules;
114 
116  unsigned uniq_rules_n;
117  TsUniqRule *uniq_rules;
118 
120  unsigned sort_rules_n;
121  TsSortRule *sort_rules;
122 
123  } TsExpr;
124 
125 
131  typedef struct
132  {
133  unsigned fetch_rules_n;
134  TsSortRule *fetch_rules;
135 
136  void *map_rules2index;
137 
138  } TsFetcher;
139 
140 
143 #define TsMargStdSize 20
144 
146 #define TsDefaultMatchingPrecision 0.001
147 
148 
149  /*
150  * PROCEDURES
151  */
152 
154  ErrCode TsSelect (TrSet* ts, TrIndexTable* it, const TsExpr* expr);
155 
157  ErrCode TsVaSelect (TrSet* ts, TrIndexTable* it, ...);
158 
160  ErrCode TsBuildExpr (TsExpr* expr, va_list val);
161 
163  ErrCode TsExprToString (const TsExpr* expr, char** str);
164 
166  ErrCode TsStringToExpr (const char* str, TsExpr* expr);
167 
169  char* TsExplainExpr (const TsExpr* expr);
170 
172  ErrCode TsInvertIndexTable (TrSet* ts, const TrIndexTable* dit,
173  TrIndexTable* rit);
174 
176  Logic* TsPresenceTable (TrSet* ts, const TrIndexTable* it);
177 
179  void TsFreeExpr (TsExpr* expr);
180 
181  /*
182  * SERVICE PROCEDURES
183  */
184 
188  Logic Ts_MatchTrace (TrHeader* pHdr,
189  unsigned rules_n,
190  const TsInclRule* rules);
191 
193  Compar Ts_CompareTracesByRules (TrHeader* pHdr1,
194  TrHeader* pHdr2,
195  unsigned rules_n,
196  const TsSortRule* rules);
197 
198  /*
199  * DATA
200  */
201 
202 #ifndef __trselect_vars
203 
207  extern Real4 TsMatchingPrecision;
208 
209 #endif /* __trselect_vars */
210 
211 
212 #ifdef __cplusplus
213 };
214 #endif /* __cplusplus */
215 
216 #endif /* trselect.h */
Definition: trselect.h:76
Definition: trselect.h:88
unsigned sort_rules_n
Definition: trselect.h:120
unsigned incl_rules_n
Definition: trselect.h:112
Definition: trace_file.h:15
Definition: trselect.h:97
Definition: trset.h:56
Definition: trselect.h:109
unsigned uniq_rules_n
Definition: trselect.h:116
Definition: trselect.h:61
Definition: trset.h:96
Definition: trselect.h:131