ECF 1.5
Evaluator.h
1#ifndef Evaluator_h
2#define Evaluator_h
3
4#include<vector>
5#include<string>
6#include<iostream>
7#define MAX_SUBTREES 5
8typedef unsigned int uint;
9using namespace std;
10
12{
13public:
14 std::vector< std::vector<double> > data;
15 std::vector<double> values;
16 std::vector<bool> valueFlags;
17 uint nSamples;
18 uint nVariables;
19
20 // enumerated functions; names are defined in initFunctionNames()
21 enum Functions {ADD, SUB, MUL, DIV, SIN, COS};
22 static const uint TERMINALS = 1000;
23 static const uint SUBTREES = 10000;
24
25 std::vector<string> funcNames, termNames;
26 std::vector< std::vector<uint> > parsedExpression;
27 int position;
28 uint iExpression;
29 uint iSample;
30
31 bool initialize();
32 void initFunctionNames();
33 double executeParsedExpression(uint sample, uint iTree = 0);
34 double execute();
35};
36
37#endif // Evaluator_h