summaryrefslogtreecommitdiff
path: root/NT/src/nodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'NT/src/nodes.h')
-rw-r--r--NT/src/nodes.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/NT/src/nodes.h b/NT/src/nodes.h
new file mode 100644
index 0000000..5bb8830
--- /dev/null
+++ b/NT/src/nodes.h
@@ -0,0 +1,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;
+ };
+}