summaryrefslogtreecommitdiff
path: root/NT/src/nodes.h
blob: 5bb8830a7119fb32848d4aba8e3c9a7ee79f2479 (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
48
49
50
51
52
53
54
55
56
#include "rotor.h"

namespace Rotor {
	class time: public Node_type<double> {
		public:
			time(){};
			time(map<string,string> &settings):time() {
				init(settings);
			};
			const double &get_output(const Frame_parameters &frame){
				value=frame.time;
				return value;
			}
			time* clone(map<string,string> &_settings) { return new time(_settings);};
		private:
			double value;
	};
	class multiply: public Node_type<double> {
		public:
			multiply(){
				inlet=create_inlet<double>("inlet");
				value=create_inlet<double>("value");
			}
			multiply(map<string,string> &settings):multiply() {
				init(settings);
			};
			const double &get_output(const Frame_parameters &frame){
				result=inlet->get(frame)*value->get(frame);
				return result;
			}
			multiply* clone(map<string,string> &_settings) { return new multiply(_settings);};
		private:
			Variable_type<double> *inlet;
			Variable_type<double> *value;
			double result;
	};
	class print: public Node_type<std::string> {
		public:
			print(){
				inlet=create_inlet<double>("inlet"); 
			}
			print(map<string,string> &settings):print() {
				init(settings);
			};
			const std::string &get_output(const Frame_parameters &frame){
				std::ostringstream out;
				out << inlet->get(frame);
				result=out.str();
				return result;
			}
			print* clone(map<string,string> &_settings) { return new print(_settings);};
		private:
			Variable_type<double> *inlet;
			std::string result;
	};
}