ECF 1.7
FunctionSet.cpp
1#include "FunctionSet.h"
2#include "Cartesian.h"
3
4namespace Cartesian {
5
6FunctionSet::FunctionSet()
7{ }
8
9
10bool FunctionSet::initialize(StateP state)
11{
12 state_ = state;
13 vFunctions.clear();
14 mFunctionSet.clear();
15 mAllFunctions.clear();
16
17 // register existing functions
18 FunctionP func = (FunctionP) (new Add);
19 mAllFunctions[func->getName()] = func;
20
21 func = (FunctionP) (new Sub);
22 mAllFunctions[func->getName()] = func;
23
24 func = (FunctionP) (new Mul);
25 mAllFunctions[func->getName()] = func;
26
27 func = (FunctionP) (new Div);
28 mAllFunctions[func->getName()] = func;
29
30 func = (FunctionP) (new Sqrt);
31 mAllFunctions[func->getName()] = func;
32
33 func = (FunctionP) (new Exp);
34 mAllFunctions[func->getName()] = func;
35
36 func = (FunctionP) (new Ln);
37 mAllFunctions[func->getName()] = func;
38
39 func = (FunctionP) (new Sin);
40 mAllFunctions[func->getName()] = func;
41
42 func = (FunctionP) (new Cos);
43 mAllFunctions[func->getName()] = func;
44
45 func = (FunctionP) (new Step);
46 mAllFunctions[func->getName()] = func;
47
48 func = (FunctionP)(new Pos);
49 mAllFunctions[func->getName()] = func;
50
51 func = (FunctionP)(new Min);
52 mAllFunctions[func->getName()] = func;
53
54 func = (FunctionP)(new Max);
55 mAllFunctions[func->getName()] = func;
56
57 return true;
58
59}
60
61
62bool FunctionSet::addFunction(std::string name)
63{
64 func_iter iter = mAllFunctions.find(name);
65 // if not found, return false
66 if(iter == mAllFunctions.end())
67 return false;
68
69 vFunctions.push_back(iter->second);
70 mFunctionSet[iter->first] = (uint) vFunctions.size() - 1;
71
72 return true;
73}
74
75
76}
std::map< std::string, unsigned int > mFunctionSet
map of indexes of active (actual used) functions
Definition FunctionSet.h:29
bool addFunction(std::string name)