From c2b62131b0e6984f8fea7f44e364ae5c886c211a Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 30 Jan 2014 18:13:45 +0000 Subject: making fragmenting exporter --- NT/src/rotor.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'NT/src/rotor.h') diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 1ed02dc..d2d7d00 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -78,11 +78,22 @@ struct TypeName { + + namespace Rotor { class Node; template class Node_type; + class Enum{ + //enumerated string type for menus + public: + Enum(std::initializer_list init) : labels(init){}; + private: + std::vector labels; + int value; + }; + class Audio_frame{ public: Audio_frame(uint16_t *_samples,int _channels,int _numsamples){ @@ -117,9 +128,7 @@ namespace Rotor { }; class Variable { //pure virtual base type for variable pointers public: - Variable(){ - connection=nullptr; - }; + Variable():name(""),description(""),title(""),connection(nullptr){}; virtual ~Variable(){}; virtual Json::Value to_json()=0; virtual void init(Json::Value s)=0; @@ -133,7 +142,7 @@ namespace Rotor { std::string get_connection_id(); std::string get_name(); protected: - std::string name; + std::string name,description,title; Node* connection; bool connectable; std::string input; @@ -300,7 +309,7 @@ namespace Rotor { }; template class Node_type : public Node { public: - virtual const NT& get_output(const Frame_parameters &frame)=0; + virtual const NT& get_output(const Frame_parameters &frame){return value;}; void init(Json::Value settings){ if (!settings["vars"].empty()){ for ( uint32_t i = 0; i < settings["vars"].size(); ++i ) { @@ -316,7 +325,7 @@ namespace Rotor { vars[name]=new Variable_type(name,"",true); return (dynamic_cast*>(vars[name])); } - template Variable_type* create_attribute(std::string name){ + template Variable_type* create_attribute(std::string name="",std::string description="",std::string title="",IT _default=IT()){ vars[name]=new Variable_type(name,"",false); return (dynamic_cast*>(vars[name])); } @@ -324,6 +333,10 @@ namespace Rotor { vars[name]=new Variable_array_type(name); return (dynamic_cast*>(vars[name])); } + //enum will require specialisation + //1st, define the enum data type + protected: + NT value; //every node has a value so it can return a reference }; } -- cgit v1.2.3