forked from icshwi/exprtk-ess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exprtkIF.h
73 lines (68 loc) · 3.42 KB
/
exprtkIF.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* exprtkIF.h
*
* Created on: May 8, 2018
* Author: anderssandstrom
*/
#ifndef M_EPICS_EXPRTK_EXPRTKIF_H_
#define M_EPICS_EXPRTK_EXPRTKIF_H_
#include <string>
#include <vector>
typedef double (*ff00_functor)();
typedef double (*ff01_functor)(double);
typedef double (*ff02_functor)(double,double);
typedef double (*ff03_functor)(double,double,double);
typedef double (*ff04_functor)(double,double,double,double);
typedef double (*ff05_functor)(double,double,double,double,double);
typedef double (*ff06_functor)(double,double,double,double,double,double);
typedef double (*ff07_functor)(double,double,double,double,double,double,double);
typedef double (*ff08_functor)(double,double,double,double,double,double,double,double);
typedef double (*ff09_functor)(double,double,double,double,double,double,double,double,double);
typedef double (*ff10_functor)(double,double,double,double,double,double,double,double,double,double);
typedef double (*ff11_functor)(double,double,double,double,double,double,double,double,double,double,double);
typedef double (*ff12_functor)(double,double,double,double,double,double,double,double,double,double,double,double);
typedef double (*ff13_functor)(double,double,double,double,double,double,double,double,double,double,double,double,double);
typedef double (*ff14_functor)(double,double,double,double,double,double,double,double,double,double,double,double,double,double);
typedef double (*ff15_functor)(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
#define generate_add_function_if_h(NN) \
virtual int addFunction(const std::string& function_name, ff##NN##_functor function)=0; \
class exprtkIF
{
public:
exprtkIF ();
virtual ~exprtkIF ();
virtual int addVariable(const std::string& variableName, double& d)=0;
generate_add_function_if_h(00)
generate_add_function_if_h(01)
generate_add_function_if_h(02)
generate_add_function_if_h(03)
generate_add_function_if_h(04)
generate_add_function_if_h(05)
generate_add_function_if_h(06)
generate_add_function_if_h(07)
generate_add_function_if_h(08)
generate_add_function_if_h(09)
generate_add_function_if_h(10)
generate_add_function_if_h(11)
generate_add_function_if_h(12)
generate_add_function_if_h(13)
generate_add_function_if_h(14)
generate_add_function_if_h(15)
// interface for inline bool add_function(const std::string& function_name, generic_function_t& function)
virtual int addFunction(const std::string& function_name, void* function)=0;
virtual int addVector(const std::string& vectorName, double* v, const std::size_t& size)=0;
virtual int addConstants()=0;
virtual int addConstant(const std::string& constantName,double& d)=0;
virtual int addStringvar(const std::string& stringvarName, std::string& s, const bool isConstant)=0;
virtual int addFileIO()=0;
virtual int compile(std::string expressionString)=0;
virtual int compile()=0;
virtual int setExpression(std::string expressionString)=0;
virtual std::string getExpression()=0;
virtual void refresh()=0;
virtual int collectVariables(std::vector<std::string> &varList)=0;
virtual int collectFunctions(std::vector<std::string> &funcList)=0;
virtual std::string getParserError()=0;
virtual int addCompositionFunction(const std::string& function_name,const std::string& functionExpression, std::vector<std::string> &varList) = 0;
};
#endif /* M_EPICS_EXPRTK_EXPRTKIF_H_ */