blob: ca1542333d8a5a53f287e628550e0926283a0ab6 (
plain)
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
|
#include <stdio.h>
#include "rotor.h"
using namespace std;
using namespace Rotor;
template <class T>
void Rotor::Variable_type<T>::init(std::string s){
std::istringstream cur(s);
cur >> value;
//std::cout<<s<<" "<<value<<std::endl;
}
template <class T>
bool Rotor::Variable_type<T>::connect(Node* target){
if (connectable){
if (dynamic_cast<Node_type<T>*>(target)){
connection=target;
return true;
}
}
return false;
}
template <class T>
const T& Rotor::Variable_type<T>::get(const Frame_parameters &frame){
if (connection){
return (dynamic_cast<Node_type<T>*>(connection))->get_output(frame);
}
return value;
}
int main(){
Rotor::time t;
multiply m;
map<string,string> settings={{"value","2"}};
m.init(settings);
if (!m.connect("inlet",&t)) printf("not connected...\n");
Rotor::print p;
if (!p.connect("inlet",&m)) printf("not connected...\n");
for (double t=0;t<10.0;t+=0.765){
Frame_parameters f=Frame_parameters(t,25.0,10.0,640,360);
printf("%04f %s\n",t,p.get_output(f).c_str());
}
}
|