// sattool - visual satellite tracking and prediction tool.
// Copyright 2000 Tom Rothamel <tom-idbg@onegeek.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  

#ifndef FILTER_H
#define FILTER_H

class Step {
 public:
	virtual int eval(Thing *) = 0;
};

class CompareStep : public Step {
 public:
	int i;
	double d;
	char *str;

	char cmp;
	int (*func)(Thing *, CompareStep *, char);

	int eval(Thing *);

	CompareStep(int(*)(Thing *, CompareStep *, char), char, char *);
	~CompareStep();
};	

class MergeStep : public Step {
 public:
	Step *as;
	Step *bs;
		
	int (*func)(int, int);

	int eval(Thing *);
	MergeStep(Step *, Step *, int(*)(int, int));
};

int compared(double, CompareStep *, char);
int comparei(int, CompareStep *, char);

int merge_and(int, int);
int merge_or(int, int);

Step *GetCompareStep(char *, char, char *);
void filter_scan(char *);
int filter_parse(void *);
Step *filter_setup(int, int, char **);


struct compare_tab {
	char *name;
	int (*func)(Thing *, CompareStep *, char);
};

extern compare_tab compare_func_table[];

#endif
