summaryrefslogtreecommitdiffstats
path: root/src/libs/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-19 20:21:12 +0000
committerDavid Robillard <d@drobilla.net>2007-09-19 20:21:12 +0000
commita054212abbdb26e03ca42c91d0c86819d445bc5f (patch)
treee141854bfdd44729f66b6a29a3b81936daac0edf /src/libs/serialisation
parent3cec9fedc575aab5a3d625fc1de7649551b9531e (diff)
downloadingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.tar.gz
ingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.tar.bz2
ingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.zip
Fix various serialization problems.
git-svn-id: http://svn.drobilla.net/lad/ingen@731 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/serialisation')
-rw-r--r--src/libs/serialisation/Loader.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp
index e34b5503..1602ed6f 100644
--- a/src/libs/serialisation/Loader.cpp
+++ b/src/libs/serialisation/Loader.cpp
@@ -119,40 +119,58 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Load (plugin) nodes */
RDF::Query query(*rdf_world, Glib::ustring(
- "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval WHERE {\n") +
+ "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval ?poly WHERE {\n") +
patch_uri + " ingen:node ?node .\n"
"?node ingen:name ?name ;\n"
" ingen:plugin ?plugin .\n"
"OPTIONAL { ?node ?floatkey ?floatval . \n"
" FILTER ( datatype(?floatval) = xsd:decimal ) }\n"
+ "OPTIONAL { ?node ?polyphonic ?poly }\n"
"}");
RDF::Query::Results results = query.run(*rdf_world, model);
+ string node_name;
+ string node_plugin;
+ bool node_polyphonic = false;
+ map<const string, const Atom> metadata;
+
+ /* Get all node information */
for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
- const string name = (*i)["name"].to_string();
- const string plugin = (*i)["plugin"].to_string();
+ if (node_name.length() == 0)
+ node_name = (*i)["name"].to_string();
- const Path node_path = patch_path.base() + (string)name;
+ if (node_plugin.length() == 0)
+ node_plugin = rdf_world->qualify((*i)["plugin"].to_string());
- if (created.find(node_path) == created.end()) {
- engine->create_node(node_path, plugin, false);
- created.insert(node_path);
- }
+ RDF::Node poly_node = (*i)["poly"];
+ if (poly_node.is_bool() && poly_node.to_bool() == true)
+ node_polyphonic = true;
- string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string());
+ const string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string());
RDF::Node val_node = (*i)["floatval"];
if (floatkey != "" && val_node.is_float())
- engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float()));
+ metadata.insert(make_pair(floatkey, Atom(val_node.to_float())));
+ }
+
+ const Path node_path = patch_path.base() + node_name;
+
+ /* Create node */
+ if (created.find(node_path) == created.end()) {
+ engine->create_node(node_path, node_plugin, node_polyphonic);
+ created.insert(node_path);
}
+ /* Set node metadata */
+ for (map<const string, const Atom>::const_iterator i = metadata.begin(); i != metadata.end(); ++i)
+ engine->set_metadata(patch_path.base() + node_name, i->first, i->second);
/* Load subpatches */
query = RDF::Query(*rdf_world, Glib::ustring(
- "SELECT DISTINCT ?patch ?name WHERE {\n") +
+ "SELECT DISTINCT ?patch ?name WHERE {\n") +
patch_uri + " ingen:node ?patch .\n"
"?patch a ingen:Patch ;\n"
" ingen:name ?name .\n"