summaryrefslogtreecommitdiff
path: root/NT/src/rotor.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-01-21 16:34:54 +0000
committerTim Redfern <tim@eclectronics.org>2014-01-21 16:34:54 +0000
commitc10e756720fe30ad2ffdcb54d83737aaad77190b (patch)
treeb28db9063b80bccbb9d4e5fa8d1bee3fc1d77931 /NT/src/rotor.h
parentdc2c81dd14933b21e0f4bdad8cdd662c8596a6c2 (diff)
variable_array_type connection wrong
Diffstat (limited to 'NT/src/rotor.h')
-rw-r--r--NT/src/rotor.h23
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){