diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-01-30 18:13:45 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-01-30 18:13:45 +0000 |
| commit | c2b62131b0e6984f8fea7f44e364ae5c886c211a (patch) | |
| tree | 0e6e1502d95a8c9e99fea979f92d2ee12518ecbe /NT/src/rotor.h | |
| parent | 5858a7f89d844e3577f6400681bdd47a7bdd8e2c (diff) | |
making fragmenting exporter
Diffstat (limited to 'NT/src/rotor.h')
| -rw-r--r-- | NT/src/rotor.h | 25 |
1 files changed, 19 insertions, 6 deletions
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<std::string> { + + namespace Rotor { class Node; template <class NT> class Node_type; + class Enum{ + //enumerated string type for menus + public: + Enum(std::initializer_list<std::string> init) : labels(init){}; + private: + std::vector<std::string> 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 NT> 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<IT>(name,"",true); return (dynamic_cast<Variable_type<IT>*>(vars[name])); } - template <class IT> Variable_type<IT>* create_attribute(std::string name){ + template <class IT> Variable_type<IT>* create_attribute(std::string name="",std::string description="",std::string title="",IT _default=IT()){ vars[name]=new Variable_type<IT>(name,"",false); return (dynamic_cast<Variable_type<IT>*>(vars[name])); } @@ -324,6 +333,10 @@ namespace Rotor { vars[name]=new Variable_array_type<IT>(name); return (dynamic_cast<Variable_array_type<IT>*>(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 }; } |
