From 820b73f2abdf51bd59cb5b74739fb6f264b7c54e Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 31 Dec 2013 12:41:42 +0000 Subject: factory not working with templates --- NT/src/nodes.h | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'NT/src/nodes.h') diff --git a/NT/src/nodes.h b/NT/src/nodes.h index 5bb8830..8ce7cdd 100644 --- a/NT/src/nodes.h +++ b/NT/src/nodes.h @@ -1,45 +1,51 @@ +#ifndef ROTOR_NODES_H +#define ROTOR_NODES_H + #include "rotor.h" -namespace Rotor { - class time: public Node_type { + +using namespace std; + +namespace Rotor{ + class Time: public Node_type { public: - time(){}; - time(map &settings):time() { + Time(){}; + Time(map &settings):Time() { init(settings); }; const double &get_output(const Frame_parameters &frame){ value=frame.time; return value; } - time* clone(map &_settings) { return new time(_settings);}; + Time* clone(map &_settings) { return new Time(_settings);}; private: double value; }; - class multiply: public Node_type { + class Multiply: public Node_type { public: - multiply(){ + Multiply(){ inlet=create_inlet("inlet"); value=create_inlet("value"); } - multiply(map &settings):multiply() { + Multiply(map &settings):Multiply() { init(settings); }; const double &get_output(const Frame_parameters &frame){ result=inlet->get(frame)*value->get(frame); return result; } - multiply* clone(map &_settings) { return new multiply(_settings);}; + Multiply* clone(map &_settings) { return new Multiply(_settings);}; private: Variable_type *inlet; Variable_type *value; double result; }; - class print: public Node_type { + class Print: public Node_type { public: - print(){ + Print(){ inlet=create_inlet("inlet"); } - print(map &settings):print() { + Print(map &settings):Print() { init(settings); }; const std::string &get_output(const Frame_parameters &frame){ @@ -48,9 +54,12 @@ namespace Rotor { result=out.str(); return result; } - print* clone(map &_settings) { return new print(_settings);}; + Print* clone(map &_settings) { return new Print(_settings);}; private: Variable_type *inlet; std::string result; }; } + + +#endif //ROTOR_NODES_H -- cgit v1.2.3