diff options
Diffstat (limited to 'NT/src/rotor.h')
| -rw-r--r-- | NT/src/rotor.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 0a016a2..96a89ef 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -89,7 +89,9 @@ namespace Rotor { }; class Variable { //pure virtual base type for variable pointers public: - Variable(){connection=nullptr;}; + Variable(){ + connection=nullptr; + }; virtual ~Variable(){}; virtual Json::Value to_json()=0; virtual void init(Json::Value s)=0; @@ -109,7 +111,11 @@ namespace Rotor { }; template <class T> class Variable_type : public Variable { public: - Variable_type(std::string _name="",std::string _input="",bool _connectable=true){name=_name;input=_input;connectable=_connectable;}; + Variable_type(std::string _name="",std::string _input="",bool _connectable=true){ + name=_name; + input=_input; + connectable=_connectable; + }; void init(Json::Value s){ std::istringstream cur(s["value"].asString()); cur >> value; @@ -131,7 +137,7 @@ namespace Rotor { return TypeName<T>::Get(); } //have to cast connect and get_output to use templated return types - bool connect(Node* target){ + bool connect(Node* target){ if (connectable){ if (dynamic_cast<Node_type<T>*>(target)){ connection=target; @@ -143,7 +149,7 @@ namespace Rotor { const T& get(const Frame_parameters &frame){ if (connection){ return (dynamic_cast<Node_type<T>*>(connection))->get_output(frame); - } + } return value; } protected: @@ -175,13 +181,8 @@ namespace Rotor { std::string get_type(){ return TypeName<T>::Get(); } - bool connect(Node* target){ - if (connectable){ - if (dynamic_cast<Node_type<T>*>(target)){ - connection=target; - return true; - } - } + bool connect(Node* target){ + //array does not connect this way return false; } void add(std::string _name,std::string _input,bool _connectable=true){ |
