-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOrchFunction.cpp
executable file
·100 lines (89 loc) · 1.84 KB
/
OrchFunction.cpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "OrchFunction.h"
#include "OrchExpression.h"
OrchFunction::OrchFunction()
{
}
void OrchFunction::setName(string n)
{
name = n;
}
string OrchFunction::dump()
{
string r;
r += "OrchFunction {\n";
{
r += " inparams: {\n";
vector<string>::iterator i;
for (i = input_params.begin() ; i != input_params.end() ; i++) {
r += " ";
r += (*i);
r += "\n";
}
r += " }\n";
} {
r += " outparams: {\n";
vector<string>::iterator i;
for (i = output_params.begin() ; i != output_params.end() ; i++) {
r += " ";
r += (*i);
r += "\n";
}
r += " }\n";
} {
r += " attributeparams: {\n";
map<string, string>::iterator i;
for (i = attribute_params.begin() ; i != attribute_params.end() ; i++) {
r += " ";
r += (*i).first;
r += " -> ";
r += (*i).second;
r += "\n";
}
r += " }\n";
} {
r += "expressions: {\n";
vector<OrchExpression*>::iterator i;
for (i = expressions.begin() ; i != expressions.end() ; i++) {
r += (*i)->dump();
}
r += "}\n";
}
r += "}\n";
return r;
}
void OrchFunction::addInputParam(string in)
{
input_params.push_back(in);
}
void OrchFunction::addOutputParam(string in)
{
output_params.push_back(in);
}
void OrchFunction::addAttributeParam(string nm, string val)
{
attribute_params[nm] = val;
}
void OrchFunction::addExpression(OrchExpression* e)
{
expressions.push_back(e);
}
string OrchFunction::getName()
{
return name;
}
string OrchFunction::getAttributeParam(string nm)
{
// find whether it is in the map.
// if it is not in the map, and you use the braces to look for it,
// you will insert a new value into the map, even if the braces
// are used in an rval.
if (attribute_params.find(nm) != attribute_params.end()) {
return attribute_params[nm];
} else {
return string("");
}
}
vector<OrchExpression*> OrchFunction::getExpressions()
{
return expressions;
}