* MA 02111-1307, USA.
*/
-
+/*
consist in AND, OR and NOT nested expressions, forming a tree with
simple relations as leaves. The simple relations test is a field
in an event is equal, not equal, smaller, smaller or equal, larger, or
larger or equal to a specified value. */
+#include <lttv/filter.h>
+
typedef enum _lttv_expression_op
{ LTTV_FIELD_EQ,
LTTV_FIELD_NE,
LTTV_FIELD_GE
} lttv_expression_op;
-typedef _lttv_simple_expression
-{ lttv_expression_op op;
+typedef enum _lttv_expression_type
+{
+ LTTV_EXPRESSION,
+ LTTV_SIMPLE_EXPRESSION
+} lttv_expression_type;
+
+typedef struct _lttv_simple_expression
+{
+ lttv_expression_op op;
char *field_name;
char *value;
} lttv_simple_expression;
-typedef _lttv_expression_type
-{ LTTV_EXPRESSION,
- LTTV_SIMPLE_EXPRESSION
-
-}
typedef struct _lttv_expression
-{ bool or;
- bool not;
- bool simple_expression;
- union
- { lttv_expression *e;
- lttv_field_relation *se;
- } e;
+{
+ gboolean or;
+ gboolean not;
+ gboolean simple_expression;
+// union e
+// {
+// lttv_expression *e;
+// lttv_field_relation *se;
+// };
} lttv_expression;
-read_token
+/*
+ read_token
-read_expression
- ( read expr )
- simple expr [ op expr ]
+ read_expression
+ ( read expr )
+ simple expr [ op expr ]
-read_simple_expression
- read_field_path [ rel value ]
+ read_simple_expression
+ read_field_path [ rel value ]
-read_field_path
- read_field_component [. field path]
+ read_field_path
+ read_field_component [. field path]
-read_field_component
- name [ \[ value \] ]
+ read_field_component
+ name [ \[ value \] ]
-data struct:
-and/or(left/right)
-not(child)
-op(left/right)
-path(component...) -> field
+ data struct:
+ and/or(left/right)
+ not(child)
+ op(left/right)
+ path(component...) -> field
+*/
+
+/**
+ * create a new lttv_filter
+ * @param expression filtering options string
+ * @param t pointer to the current LttvTrace
+ * @return the current lttv_filter
+ */
+lttv_filter*
+lttv_filter_new(char *expression, LttvTrace *t) {
+ g_print("filter::lttv_filter_new()\n"); /* debug */
+ /*
+ * 1. parse expression
+ * 2. construct binary tree
+ * 3. return corresponding filter
+ */
+
+
+}
+
+gboolean
+lttv_filter_tracefile(lttv_filter *filter, void *tracefile) {
+
+}
+
+gboolean
+lttv_filter_event(lttv_filter *filter, void *event) {
+
+}
#ifndef FILTER_H
#define FILTER_H
+#include <lttv/traceset.h>
+
/* A filter expression consists in nested AND, OR and NOT expressions
involving boolean relation (>, >=, =, !=, <, <=) between event fields and
specific values. It is compiled into an efficient data structure which
*/
-
+/**
+ * @struct lttv_filter
+ * ( will later contain a binary tree of filtering options )
+ */
typedef struct _lttv_filter lttv_filter;
-
/* Compile the filter expression into an efficient data structure */
-lttv_filter *lttv_filter_new(char *expression, lttv_trace *t);
+lttv_filter *lttv_filter_new(char *expression, LttvTrace *t);
/* Check if the tracefile or event satisfies the filter. The arguments are
declared as void * to allow these functions to be used as hooks. */
-bool lttv_filter_tracefile(void *filter, void *tracefile);
+gboolean lttv_filter_tracefile(lttv_filter *filter, void *tracefile);
-bool lttv_filter_event(void *filter, void *event);
+gboolean lttv_filter_event(lttv_filter *filter, void *event);
#endif // FILTER_H
libdir = ${lttvplugindir}
-lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la
+lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la libtextFilter.la
libtextDump_la_LDFLAGS = -module
libtextDump_la_SOURCES = textDump.c
libbatchAnalysis_la_LDFLAGS = -module
libbatchAnalysis_la_SOURCES = batchAnalysis.c
+libtextFilter_la_LDFLAGS = -module
+libtextFilter_la_SOURCES = textFilter.c
noinst_HEADERS = \
batchanalysis.h