ECF 1.5
FunctionSet.cpp
1#include "FunctionSet.h"
2namespace cartesian{
3 FunctionSet::FunctionSet()
4 {
5
6 }
7
8 bool FunctionSet::initialize(StateP state)
9 {
10 this->state_ = state;
11 //+,-,*,/,ln,sqrt,sin,cos,step,neg,max,min
12
13 FunctionP_basic function = (FunctionP_basic) (new Add<std::vector<double>,double>);
14 mAllFunctions_.insert(std::make_pair(function->getName(), function));
15
16 function = (FunctionP_basic) (new Sub<std::vector<double>,double>);
17 mAllFunctions_.insert(std::make_pair(function->getName(), function));
18
19 function = (FunctionP_basic) (new Mul<std::vector<double>,double>);
20 mAllFunctions_.insert(std::make_pair(function->getName(), function));
21
22 function = (FunctionP_basic) (new Div<std::vector<double>,double>);
23 mAllFunctions_.insert(std::make_pair(function->getName(), function));
24
25 function = (FunctionP_basic) (new Nlog<std::vector<double>,double>);
26 mAllFunctions_.insert(std::make_pair(function->getName(), function));
27
28 function = (FunctionP_basic) (new Sqrt<std::vector<double>,double>);
29 mAllFunctions_.insert(std::make_pair(function->getName(), function));
30
31 function = (FunctionP_basic) (new Step<std::vector<double>,double>);
32 mAllFunctions_.insert(std::make_pair(function->getName(), function));
33
34 function = (FunctionP_basic) (new Neg<std::vector<double>,double>);
35 mAllFunctions_.insert(std::make_pair(function->getName(), function));
36
37 function = (FunctionP_basic) (new Sin<std::vector<double>,double>);
38 mAllFunctions_.insert(std::make_pair(function->getName(), function));
39
40 function = (FunctionP_basic) (new Cos<std::vector<double>,double>);
41 mAllFunctions_.insert(std::make_pair(function->getName(), function));
42
43 function = (FunctionP_basic) (new Max<std::vector<double>,double>);
44 mAllFunctions_.insert(std::make_pair(function->getName(), function));
45
46 function = (FunctionP_basic) (new Min<std::vector<double>,double>);
47 mAllFunctions_.insert(std::make_pair(function->getName(), function));
48
49 function = (FunctionP_basic) (new Sq_exp<std::vector<double>,double>);
50 mAllFunctions_.insert(std::make_pair(function->getName(), function));
51 return true;
52 }
53
54 bool FunctionSet::addFunction(const std::string &name)
55 {
56
57 std::map<std::string,FunctionP_basic>::iterator result = mAllFunctions_.find(name);
58 if(result == mAllFunctions_.end()) {
59 return false;
60 }
61 vActiveFunctions_.push_back(result->second);
62 mActiveFunctions_.insert(std::make_pair(name,result->second));
63 return true;
64 }
65}
Definition: main.cpp:120