diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-27 15:47:10 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-27 15:47:10 +0000 |
| commit | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (patch) | |
| tree | 79d7313dd863ab9715be64dba1468be946cdbea8 /NT/src/rotor.h | |
| parent | ea8d3b6fa7ac59d064e86755fae8f25f7ed8a0d2 (diff) | |
making template connection logic
Diffstat (limited to 'NT/src/rotor.h')
| -rw-r--r-- | NT/src/rotor.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 93b6865..1451a1b 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -39,7 +39,7 @@ namespace Rotor { double duration; Audio_frame *audio; }; - class Variable { //base type for variable pointers + class Variable { //pure virtual base type for variable pointers public: virtual void init(std::string s)=0; virtual ~Variable(){}; @@ -49,6 +49,7 @@ namespace Rotor { }; template <class T> class Variable_type : public Variable { public: + Variable_type(bool _c){connectable=_c;}; void init(std::string s){ std::istringstream cur(s); cur >> value; @@ -108,7 +109,11 @@ namespace Rotor { return false; } template <class IT> IT* create_inlet(std::string name){ - vars[name]=new Variable_type<IT>(); + vars[name]=new Variable_type<IT>(true); + return &((dynamic_cast<Variable_type<IT>*>(vars[name]))->value); + } + template <class IT> IT* create_attribute(std::string name){ + vars[name]=new Variable_type<IT>(false); return &((dynamic_cast<Variable_type<IT>*>(vars[name]))->value); } }; |
