diff options
author | David Robillard <d@drobilla.net> | 2006-12-12 12:45:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-12-12 12:45:33 +0000 |
commit | 71f632d459471c2e75ed04b808df9671539a182c (patch) | |
tree | 2fe3c25243e7b915656c02dd46bca5a0d317b599 /src/libs/client | |
parent | 9e2a757e026abf79d0cdcf12a18796fa89973356 (diff) | |
download | ingen-71f632d459471c2e75ed04b808df9671539a182c.tar.gz ingen-71f632d459471c2e75ed04b808df9671539a182c.tar.bz2 ingen-71f632d459471c2e75ed04b808df9671539a182c.zip |
Connection loading.
Command line parameter for server to allow connecting to specific JACK server.
git-svn-id: http://svn.drobilla.net/lad/ingen@217 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/Loader.cpp | 44 | ||||
-rw-r--r-- | src/libs/client/RDFQuery.cpp | 8 |
2 files changed, 48 insertions, 4 deletions
diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp index fe1af795..e1590540 100644 --- a/src/libs/client/Loader.cpp +++ b/src/libs/client/Loader.cpp @@ -52,7 +52,7 @@ Loader::load(const Glib::ustring& filename, /* Load nodes */ RDFQuery query(Glib::ustring( - "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval FROM <") + filename + "> WHERE {\n" + "SELECT DISTINCT ?patch ?name ?plugin ?floatkey ?floatval FROM <") + filename + "> WHERE {\n" "?patch ingen:node ?node .\n" "?node ingen:name ?name ;\n" " ingen:plugin ?plugin ;\n" @@ -63,8 +63,12 @@ Loader::load(const Glib::ustring& filename, RDFQuery::Results nodes = query.run(filename); for (RDFQuery::Results::iterator i = nodes.begin(); i != nodes.end(); ++i) { + + const Glib::ustring& patch = (*i)["patch"]; const Glib::ustring& name = (*i)["name"]; const Glib::ustring& plugin = (*i)["plugin"]; + + cerr << "LOADING NODE IN PATCH : " << patch << endl; if (created.find(name) == created.end()) { _engine->create_node(parent.base() + name, plugin, false); @@ -103,7 +107,7 @@ Loader::load(const Glib::ustring& filename, const Glib::ustring& datatype = (*i)["datatype"]; if (created.find(name) == created.end()) { - cerr << "TYPE: " << type << endl; + //cerr << "TYPE: " << type << endl; bool is_output = (type == "ingen:OutputPort"); // FIXME: check validity _engine->create_port(parent.base() + name, datatype, is_output); created[name] = true; @@ -117,6 +121,42 @@ Loader::load(const Glib::ustring& filename, _engine->set_metadata(parent.base() + name, floatkey, Atom(val)); } } + + /* Load connections */ + + query = RDFQuery(Glib::ustring( + "SELECT DISTINCT ?srcnode ?src ?dstnode ?dst FROM <") + filename + "> WHERE {\n" + "?srcnoderef ingen:port ?srcref .\n" + "?dstnoderef ingen:port ?dstref .\n" + "?dstref ingen:connectedTo ?srcref .\n" + "?srcref ingen:name ?src .\n" + "?dstref ingen:name ?dst .\n" + "OPTIONAL { ?srcnoderef ingen:name ?srcnode } .\n" + "OPTIONAL { ?dstnoderef ingen:name ?dstnode }\n" + "}\n"); + + cerr << "*************\n" << query.string() << "*****************\n"; + + RDFQuery::Results connections = query.run(filename); + + for (RDFQuery::Results::iterator i = connections.begin(); i != connections.end(); ++i) { + // FIXME: kludge + Path src_node = string("/"); + if ((*i).find("srcnode") != (*i).end()) + src_node += string((*i)["srcnode"]); + Path src_port = src_node.base() + string((*i)["src"]); + + Path dst_node = string("/"); + if ((*i).find("dstnode") != (*i).end()) + dst_node += string((*i)["dstnode"]); + Path dst_port = dst_node.base() + string((*i)["dst"]); + + cerr << "CONNECTION: " << src_port << " -> " << dst_port << endl; + + _engine->connect(src_port, dst_port); + } + + } diff --git a/src/libs/client/RDFQuery.cpp b/src/libs/client/RDFQuery.cpp index 02a491bb..3993de20 100644 --- a/src/libs/client/RDFQuery.cpp +++ b/src/libs/client/RDFQuery.cpp @@ -48,8 +48,12 @@ RDFQuery::run(const Glib::ustring filename) const rasqal_literal* rvalue = rasqal_query_results_get_binding_value(results, i); Glib::ustring name((const char*)rname); - Glib::ustring value((const char*)rasqal_literal_as_string(rvalue)); - bindings.insert(std::make_pair(name, value)); + const unsigned char* str = rasqal_literal_as_string(rvalue); + + if (str) { + Glib::ustring value((const char*)str); + bindings.insert(std::make_pair(name, value)); + } } result.push_back(bindings); |