diff options
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 |
