-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModule.cpp
executable file
·112 lines (96 loc) · 2 KB
/
Module.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
100
101
102
103
104
105
106
107
108
109
110
111
112
#include "Module.h"
#include "Link.h"
Module::Module()
{
}
Module::~Module()
{
}
void Module::addInput(int at, Link* newlink)
{
if (at <= getMaxInputs()) {
if (at >= inputs.size()) {
inputs.resize(inputs.size() * 2, (Link*)0);
}
inputs.insert(inputs.begin() + at, newlink);
}
newlink->setOutput(this);
}
void Module::addInput(Link* newlink)
{
if (inputs.size() < getMaxInputs()) {
inputs.push_back(newlink);
}
newlink->setOutput(this);
}
void Module::addOutput(Link* newlink)
{
if (outputs.size() < getMaxOutputs()) {
outputs.push_back(newlink);
}
newlink->setInput(this);
}
void Module::addOutput(int at, Link* newlink)
{
if (at <= getMaxOutputs()) {
if (at >= outputs.size()) {
outputs.resize(outputs.size() * 2, (Link*)0);
}
outputs.insert(outputs.begin() + at, newlink);
}
newlink->setInput(this);
}
void Module::processOneSample()
{
}
void Module::processOneControlEvent()
{
}
double Module::getLinkParameter(string pname)
{
return linkparameters[pname]->getData();
}
void Module::addLinkParameter(string pname, Link* pval)
{
linkparameters[pname] = pval;
pval->setOutput(this);
}
bool Module::isLinked(string pname)
{
return (linkparameters.find(pname) != linkparameters.end());
}
void Module::setStringParameter(string pname, string val)
{
}
string Module::fullDebug()
{
string s;
s = "";
s += "::" + nameDebug() + "::\n";
for (int i = 0 ; i < inputs.size() ; i++) {
s += inputs[i]->getInput()->nameDebug() + ">>\n";
}
for (int i = 0 ; i < outputs.size() ; i++) {
s += ">>" + inputs[i]->getOutput()->nameDebug() + "\n";
}
return s;
}
void Module::trace()
{
TRACE("modprint", string("this mod:") + getInfo());
TRACE("modprint", "outputs:");
for (int i = 0 ; i < outputs.size() ; i++) {
TRACE("modprint", string("links to ") + outputs[i]->id);
}
TRACE("modprint", "inputs:");
for (int i = 0 ; i < inputs.size() ; i++) {
TRACE("modprint", string("links to ") + inputs[i]->id);
}
}
string Module::getInfo()
{
return string("unknown module");
}
void Module::finalize()
{
}