core filter, lttvwindow, batchanalysis
[lttv.git] / ltt / branches / poly / lttv / lttv / filter.h
index 29ff2a40dae81c9626aad0f6221c8bf69998d50a..8a01769019d5067b7781f3eb82da84850eb58ffc 100644 (file)
@@ -76,7 +76,7 @@ extern GQuark
 /**
  *     @enum lttv_expression_op
  */
-typedef enum _lttv_expression_op
+typedef enum _LttvExpressionOp
 { 
   LTTV_FIELD_EQ,       /** equal */
   LTTV_FIELD_NE,       /** not equal */
@@ -84,80 +84,116 @@ typedef enum _lttv_expression_op
   LTTV_FIELD_LE,       /** lower or equal */
   LTTV_FIELD_GT,       /** greater than */
   LTTV_FIELD_GE                /** greater or equal */
-} lttv_expression_op;
+} LttvExpressionOp;
 
-typedef enum _lttv_expression_type
+/*
+ * FIXME: Unused enum ?
+ */
+typedef enum _LttvExpressionType
 { 
   LTTV_EXPRESSION,
-  LTTV_SIMPLE_EXPRESSION
-} lttv_expression_type;
-
-typedef struct _lttv_simple_expression
+  LTTV_SIMPLE_EXPRESSION,
+  LTTV_EXPRESSION_OP,
+  LTTV_UNDEFINED_EXPRESSION
+} LttvExpressionType;
+
+typedef enum _LttvTreeElement {
+  LTTV_TREE_IDLE,
+  LTTV_TREE_NODE,
+  LTTV_TREE_LEAF
+} LttvTreeElement;
+
+typedef struct _LttvSimpleExpression
 { 
-  lttv_expression_op op;
   char *field_name;
+  LttvExpressionOp op;
   char *value;
-} lttv_simple_expression;
-
-typedef enum _lttv_logical_op {
-    OR = 1,         /* 1 */
-    AND = 1<<1,     /* 2 */
-    NOT = 1<<2,     /* 4 */
-    XOR = 1<<3      /* 8 */
-} lttv_logical_op;
+} LttvSimpleExpression;
+
+typedef enum _LttvLogicalOp {
+    LTTV_LOGICAL_OR = 1,         /* 1 */
+    LTTV_LOGICAL_AND = 1<<1,     /* 2 */
+    LTTV_LOGICAL_NOT = 1<<2,     /* 4 */
+    LTTV_LOGICAL_XOR = 1<<3      /* 8 */
+} LttvLogicalOp;
     
 /*
  * Ah .. that's my tree
  */
-typedef struct _lttv_expression 
-{ 
+//typedef struct _lttv_expression 
+//
 //  gboolean simple_expression;
-  int op;
-  lttv_expression_type type;
-  union {
-    struct lttv_expression *e;
+//  int op;
+//  lttv_expression_type type;
+//  union {
+//    struct lttv_expression *e;
  //   lttv_field_relation *se;  /* --> simple expression */
-  } e;
-} lttv_expression;
-
-
-//typedef union _lttv_expression {
-//  lttv_simple_expression se;
-//  
+//  } e;
 //} lttv_expression;
 
-typedef struct _lttv_filter_tree {
-       lttv_expression* node;
-       struct lttv_filter_tree* r_child;
-       struct lttv_filter_tree* l_child;
-} lttv_filter_tree;
+/*
+ * FIXME: Unused struct
+ */
+typedef struct _LttvExpression {
+  LttvExpressionType type;
+  union {
+    LttvSimpleExpression *se;
+    int op;
+  } e;
+} LttvExpression;
+
+typedef struct _LttvFilter {
+//     lttv_expression* node;
+  int node;                         /** value of LttvLogicalOp */
+  LttvTreeElement left;
+  LttvTreeElement right;
+  union {
+    struct LttvFilter* t;
+    LttvSimpleExpression* leaf;
+  } l_child;
+  union {
+    struct LttvFilter* t;
+    LttvSimpleExpression* leaf;
+  } r_child;
+} LttvFilter;
 
 /**
  * @struct lttv_filter
  * ( will later contain a binary tree of filtering options )
  */
-typedef struct _lttv_filter_t {
-       lttv_filter_tree* tree; 
-} lttv_filter_t;
+//typedef struct _lttv_filter_t {
+//     lttv_filter_tree* tree; 
+//} lttv_filter_t;
 
-/* Parse field path contained in list */
-gboolean parse_field_path(GList* fp);
 
+LttvSimpleExpression* lttv_simple_expression_new();
+
+LttvFilter* lttv_filter_tree_new();
+
+void lttv_filter_tree_destroy(LttvFilter* tree);
+
+LttvFilter* lttv_filter_clone(LttvFilter* tree);
+
+void lttv_filter_tree_add_node(GPtrArray* stack, LttvFilter* subtree, LttvLogicalOp op);
+
+/* Parse field path contained in list */
+gboolean parse_field_path(GPtrArray* fp);
 
 gboolean parse_simple_expression(GString* expression);
 
 /* Compile the filter expression into an efficient data structure */
-lttv_filter_t *lttv_filter_new(char *expression, LttvTraceState *tfs);
+LttvFilter *lttv_filter_new(char *expression, LttvTraceState *tfs);
 
+void lttv_filter_destroy(LttvFilter* filter);
 
 /* Check if the tracefile or event satisfies the filter. The arguments are
    declared as void * to allow these functions to be used as hooks. */
 
-gboolean lttv_filter_tracefile(lttv_filter_t *filter, LttTracefile *tracefile);
+gboolean lttv_filter_tracefile(LttvFilter *filter, LttTracefile *tracefile);
 
-gboolean lttv_filter_tracestate(lttv_filter_t *filter, LttvTraceState *tracestate);
+gboolean lttv_filter_tracestate(LttvFilter *filter, LttvTraceState *tracestate);
 
-gboolean lttv_filter_event(lttv_filter_t *filter, LttEvent *event);
+gboolean lttv_filter_event(LttvFilter *filter, LttEvent *event);
 
 #endif // FILTER_H
 
This page took 0.027292 seconds and 4 git commands to generate.