diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-01-21 16:34:54 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-01-21 16:34:54 +0000 |
| commit | c10e756720fe30ad2ffdcb54d83737aaad77190b (patch) | |
| tree | b28db9063b80bccbb9d4e5fa8d1bee3fc1d77931 /NT/src/graph.cpp | |
| parent | dc2c81dd14933b21e0f4bdad8cdd662c8596a6c2 (diff) | |
variable_array_type connection wrong
Diffstat (limited to 'NT/src/graph.cpp')
| -rw-r--r-- | NT/src/graph.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/NT/src/graph.cpp b/NT/src/graph.cpp index 87a7b87..65bd6c8 100644 --- a/NT/src/graph.cpp +++ b/NT/src/graph.cpp @@ -29,6 +29,12 @@ bool Graph::load_file(std::string filename,std::string media_path){ cerr<<"Rotor: graph "<<filename<<" not found"<<endl; return false; } +Node* Graph::find_node(const string &type){ + for (std::unordered_map<string,Node*>::iterator it=nodes.begin();it!=nodes.end();++it) { + if (it->second->get_type()==type) return it->second; + } + return nullptr; +}; bool Graph::parse_json(string &data,string &media_path){ Json::Value root; // will contain the root value after parsing. Json::Reader reader; @@ -62,8 +68,9 @@ bool Graph::parse_json(string &data,string &media_path){ // //node.create_links(nodes) //will allow the nodes to be passed into each member of a variable array - node->create_connections(nodes); nodes[node_id]=node; + nodes[node_id]->create_connections(nodes); + } else cerr << "ERROR: duplicate node '"<<node_id<<"' "<< endl; } @@ -74,3 +81,6 @@ bool Graph::parse_json(string &data,string &media_path){ } return true; } + +//should nodes be identified by uuid rather than name? +//array inlets can be identified by number as this is all they usually are |
