-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExprHelper.cpp
More file actions
40 lines (36 loc) · 1.25 KB
/
ExprHelper.cpp
File metadata and controls
40 lines (36 loc) · 1.25 KB
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
#include "ExprHelper.h"
const std::map<std::string, ExprHelper::expr_op> ExprHelper::string_to_op = {
{"ALIAS", ExprHelper::OP_ALIAS}, /* Parser-use only */
{"PATH", ExprHelper::OP_PATH}, /* Parser-use only */
{"NUM", ExprHelper::OP_NUM}, /* Parser-use only */
{"INDEX", ExprHelper::OP_INDEX},
{"+", ExprHelper::OP_ADD},
{"add", ExprHelper::OP_ADD},
{"ADD", ExprHelper::OP_ADD},
{"sqrt", ExprHelper::OP_SQRT},
{"POW", ExprHelper::OP_POW},
{"^", ExprHelper::OP_POW},
{"MAGNITUDE", ExprHelper::OP_MAGN},
{"magnitude", ExprHelper::OP_MAGN},
{"pdf", ExprHelper::OP_PDF}
};
const std::map<ExprHelper::expr_op, std::string> ExprHelper::op_to_string = {
{ExprHelper::OP_NULL, "NULL"},
{ExprHelper::OP_ALIAS, "ALIAS"}, /* Parser-use only */
{ExprHelper::OP_PATH, "PATH"}, /* Parser-use only */
{ExprHelper::OP_NUM, "NUM"}, /* Parser-use only */
{ExprHelper::OP_INDEX, "INDEX"},
{ExprHelper::OP_ADD, "ADD"},
{ExprHelper::OP_SQRT, "SQRT"},
{ExprHelper::OP_POW, "POW"},
{ExprHelper::OP_MAGN, "MAGNITUDE"},
{ExprHelper::OP_PDF, "PDF"}
};
std::string ExprHelper::get_op_name(ExprHelper::expr_op op)
{
return ExprHelper::op_to_string.at(op);
}
ExprHelper::expr_op ExprHelper::get_op(std::string op)
{
return ExprHelper::string_to_op.at(op);
}