~ubuntu-branches/ubuntu/trusty/picviz/trusty

« back to all changes in this revision

Viewing changes to src/libpicviz/include/filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2009-03-30 10:42:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090330104208-j095obwkp574t1lm
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Picviz - Parallel coordinates ploter
 
3
 * Copyright (C) 2008 Sebastien Tricaud <toady@gscore.org>
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation version 3.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 *
 
17
 * $Id: filter.h 318 2008-11-12 19:30:30Z toady $
 
18
 */
 
19
 
 
20
#ifndef _FILTER_H_
 
21
#define _FILTER_H_
 
22
 
 
23
#ifdef __cplusplus
 
24
 extern "C" {
 
25
#endif
 
26
 
 
27
#include "linuxlist.h"
 
28
#include "types.h"
 
29
#include "pcimage.h"
 
30
 
 
31
typedef enum picviz_filter_options_t {
 
32
        PF_OPTIONS_NONE,
 
33
        PF_OPTIONS_PLOTPERCENT /* We have plot > 90% */
 
34
} picviz_filter_options_t;
 
35
typedef enum picviz_filter_options_t PicvizFilterOptions;
 
36
 
 
37
typedef enum picviz_filter_display_t {
 
38
        PF_DISPLAY_ERROR,
 
39
        PF_SHOW,
 
40
        PF_HIDE
 
41
} picviz_filter_display_t;
 
42
typedef enum picviz_filter_display_t PicvizFilterDisplay;
 
43
 
 
44
typedef enum picviz_filter_type_t {
 
45
        PF_TYPE_ERROR       = 0,
 
46
        /* filter data as they are */
 
47
        PF_VALUE_FILTER     = 1,
 
48
        /* rendering engine filter */
 
49
        PF_PLOT_FILTER      = 2,
 
50
        /* filter on color */
 
51
        PF_COLOR_FILTER     = 4,
 
52
        /* what we can filter when there is no relation
 
53
         * among axes and should not wait for other lines
 
54
         * to be applied first */
 
55
        PF_PRE_LINE_FILTER  = 8,
 
56
        /* most cpu consuming filter, we first add lines
 
57
         * to then remove them */
 
58
        PF_POST_LINE_FILTER = 16,
 
59
        /* Filter a line frequency */
 
60
        PF_FREQ_FILTER      = 32
 
61
} picviz_filter_type_t;
 
62
typedef enum picviz_filter_type_t PicvizFilterType;
 
63
 
 
64
typedef enum picviz_filter_relation_t {
 
65
        PF_RELATION_ERROR,
 
66
        PF_RELATION_EQUAL,
 
67
        PF_RELATION_NOTEQUAL,
 
68
        PF_RELATION_GREATER,
 
69
        PF_RELATION_LESS,
 
70
        PF_RELATION_LESS_OR_EQUAL,
 
71
        PF_RELATION_GREATER_OR_EQUAL
 
72
} picviz_filter_relation_t;
 
73
typedef enum picviz_filter_relation_t PicvizFilterRelation;
 
74
 
 
75
struct picviz_filter_plot_t {
 
76
        unsigned char active; /* Set to one if the axis is concerned by the filter (-1 on unsigned long long does not work ;))*/
 
77
        PcvString data;
 
78
        PcvHeight plot;
 
79
} picviz_filter_plot_t;
 
80
 
 
81
/*
 
82
typedef struct picviz_filter {
 
83
        PicvizFilterDisplay display;
 
84
 
 
85
        PicvizFilterType type;
 
86
        struct picviz_filter_plot_t plot[PICVIZ_MAX_AXES];
 
87
        PicvizFilterRelation relation;
 
88
        PicvizFilterOptions options;
 
89
 
 
90
        struct picviz_filter *and;
 
91
} picviz_filter_t;
 
92
*/
 
93
 
 
94
typedef struct picviz_filter_criterion {
 
95
        PicvizFilterType type;
 
96
        PicvizFilterRelation relation;
 
97
        PicvizFilterOptions options;
 
98
        int axis;
 
99
 
 
100
        union {
 
101
                PcvString data;
 
102
                PcvHeight plot;
 
103
        } value;
 
104
 
 
105
        struct picviz_filter_criterion *and, *or;
 
106
} picviz_filter_criterion_t;
 
107
 
 
108
 
 
109
typedef struct picviz_filter {
 
110
        PicvizFilterDisplay display;
 
111
        picviz_filter_criterion_t *criterion;
 
112
} picviz_filter_t;
 
113
 
 
114
typedef struct picviz_filter PicvizFilter;
 
115
 
 
116
PicvizFilter *picviz_filter_new(void);
 
117
picviz_filter_criterion_t *picviz_filter_criterion_new(void);
 
118
PicvizFilterType picviz_filter_validate(PcvString string);
 
119
 
 
120
picviz_filter_criterion_t *picviz_filter_and_criterion(picviz_filter_criterion_t *c1, picviz_filter_criterion_t *c2);
 
121
picviz_filter_criterion_t *picviz_filter_or_criterion(picviz_filter_criterion_t *c1, picviz_filter_criterion_t *c2);
 
122
 
 
123
 
 
124
void picviz_filter_set_string(PicvizFilter *filter, char *string);
 
125
 
 
126
/* defined in filter/filter.yac.y */
 
127
PicvizFilter *picviz_filter_build(char *filter);
 
128
 
 
129
int picviz_filter_display(picviz_filter_t *filter, pcimage_t *image, struct axisplot_t **axisplot, int axis_max);
 
130
 
 
131
#ifdef __cplusplus
 
132
 }
 
133
#endif
 
134
 
 
135
#endif /* _FILTER_H_ */
 
136