From d6571e5a9b8fc2bed416ff4798e3a29136004ff5 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 9 Jan 2014 16:50:51 +0000 Subject: beginnng json output --- NT/src/rotor.h | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'NT/src/rotor.h') diff --git a/NT/src/rotor.h b/NT/src/rotor.h index c83fe63..e64095c 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -50,6 +50,7 @@ namespace Rotor { virtual void init(std::string s)=0; virtual ~Variable(){}; virtual bool connect(Node* target)=0; + virtual std::string get_type()=0; Node* connection; bool connectable; }; @@ -60,6 +61,9 @@ namespace Rotor { std::istringstream cur(s); cur >> value; } + std::string get_type(){ //need this to output node templates + return "unknown"; + } bool connect(Node* target){ if (connectable){ if (dynamic_cast*>(target)){ @@ -77,6 +81,27 @@ namespace Rotor { } T value; }; + template class Variable_array: public Variable_type { + public: + Variable_array(){}; + void add(int num=1){ + for (int i=0;iwhich){ + return values[which].connect(target); + } + return false; + } + const T& get(int which,const Frame_parameters &frame){ + if (values.size()>which){ + return values[which].get(frame); + } + return value; + } + std::vector> values; + T value; + }; //don't forget the dupliicate inlets //it needs to be a property of a var //vars need to be: @@ -104,11 +129,13 @@ namespace Rotor { return false; } virtual Node* clone(std::map &_settings)=0; - std::string type; - std::string type; - std::string type; - std::string type; - protected: + std::string node_type; + std::string node_id; + std::string id; + std::string description; + std::string title; + std::string ui_type; + std::string output_type; std::unordered_map vars; }; template class Node_type : public Node { @@ -130,6 +157,10 @@ namespace Rotor { vars[name]=new Variable_type(false); return (dynamic_cast*>(vars[name])); } + template Variable_array* create_array(std::string name){ + vars[name]=new Variable_array(); + return (dynamic_cast*>(vars[name])); + } }; } -- cgit v1.2.3