From 58af61933fe938c404b8fcd916b3939257663cdd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 30 Nov 2007 07:38:42 +0000 Subject: Split redland C++ wrappers out from Raul. git-svn-id: http://svn.drobilla.net/lad/ingen@927 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/Makefile.am | 24 +++++++--- src/libs/client/PluginModel.cpp | 2 +- src/libs/client/PluginModel.hpp | 6 +-- src/libs/engine/Makefile.am | 19 ++++++-- src/libs/gui/App.cpp | 2 +- src/libs/gui/LoadRemotePatchWindow.cpp | 10 ++--- src/libs/gui/Makefile.am | 28 +++++++++--- src/libs/module/Makefile.am | 4 +- src/libs/module/World.hpp | 4 +- src/libs/module/global.cpp | 2 +- src/libs/serialisation/Loader.cpp | 76 +++++++++++++++---------------- src/libs/serialisation/Loader.hpp | 6 +-- src/libs/serialisation/Makefile.am | 3 +- src/libs/serialisation/Serialiser.cpp | 82 +++++++++++++++++----------------- src/libs/serialisation/Serialiser.hpp | 22 ++++----- src/progs/ingen/Makefile.am | 4 +- src/progs/ingen/main.cpp | 2 +- 17 files changed, 169 insertions(+), 127 deletions(-) (limited to 'src') diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 72134359..e9314c55 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -8,15 +8,27 @@ module_LTLIBRARIES = libingen_client.la libingen_client_la_CXXFLAGS = \ -DPKGDATADIR=\"$(pkgdatadir)\" \ @INGEN_CFLAGS@ \ - @RAUL_CFLAGS@ \ + @GLIBMM_CFLAGS@ \ @LIBLO_CFLAGS@ \ - @LXML2_CFLAGS@ @RASQAL_CFLAGS@ @RAPTOR_CFLAGS@ \ - @LSIGCPP_CFLAGS@ @GLIBMM_CFLAGS@ + @LSIGCPP_CFLAGS@ \ + @GLIBMM_CFLAGS@ \ + @LXML2_CFLAGS@ \ + @RAPTOR_CFLAGS@ \ + @RASQAL_CFLAGS@ \ + @RAUL_CFLAGS@ \ + @REDLANDMM_CFLAGS@ \ + @SLV2_CFLAGS@ libingen_client_la_LIBADD = \ - @RAUL_LIBS@ @SLV2_LIBS@ @LIBLO_LIBS@ \ - @LXML2_LIBS@ @RASQAL_LIBS@ @RAPTOR_LIBS@ \ - @LSIGCPP_LIBS@ @GLIBMM_LIBS@ + @GLIBMM_LIBS@ \ + @LIBLO_LIBS@ \ + @LSIGCPP_LIBS@ \ + @LXML2_LIBS@ \ + @RAPTOR_LIBS@ \ + @RASQAL_LIBS@ \ + @RAUL_LIBS@ \ + @REDLANDMM_LIBS@ \ + @SLV2_LIBS@ libingen_client_la_SOURCES = \ $(top_srcdir)/ingen/src/common/interface/ClientInterface.hpp \ diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index 069c0157..868af34d 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -32,7 +32,7 @@ SLV2World PluginModel::_slv2_world = NULL; SLV2Plugins PluginModel::_slv2_plugins = NULL; #endif -Raul::RDF::World* PluginModel::_rdf_world = NULL; +Redland::World* PluginModel::_rdf_world = NULL; string diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp index 75cf70f5..95a68dbe 100644 --- a/src/libs/client/PluginModel.hpp +++ b/src/libs/client/PluginModel.hpp @@ -95,11 +95,11 @@ public: static string get_lv2_icon_path(SLV2Plugin plugin); #endif - static void set_rdf_world(Raul::RDF::World& world) { + static void set_rdf_world(Redland::World& world) { _rdf_world = &world; } - static Raul::RDF::World* rdf_world() { return _rdf_world; } + static Redland::World* rdf_world() { return _rdf_world; } private: const Type _type; @@ -115,7 +115,7 @@ private: mutable string _icon_path; #endif - static Raul::RDF::World* _rdf_world; + static Redland::World* _rdf_world; }; diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 950bce9c..7bb904b3 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -6,11 +6,24 @@ moduledir = $(libdir)/ingen module_LTLIBRARIES = libingen_engine.la libingen_engine_la_CXXFLAGS = \ - @SLV2_CFLAGS@ @RAUL_CFLAGS@ @INGEN_CFLAGS@ \ - @JACK_CFLAGS@ @LIBLO_CFLAGS@ @LASH_CFLAGS@ @GLIBMM_CFLAGS@ + @GLIBMM_CFLAGS@ \ + @INGEN_CFLAGS@ \ + @JACK_CFLAGS@ \ + @LASH_CFLAGS@ \ + @LIBLO_CFLAGS@ \ + @RAUL_CFLAGS@ \ + @REDLANDMM_CFLAGS@ \ + @SLV2_CFLAGS@ libingen_engine_la_LDFLAGS = -no-undefined -module -avoid-version -libingen_engine_la_LIBADD = @RAUL_LIBS@ @JACK_LIBS@ @LIBLO_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ @GLIBMM_LIBS@ +libingen_engine_la_LIBADD = \ + @GLIBMM_LIBS@ \ + @JACK_LIBS@ \ + @LASH_LIBS@ \ + @LIBLO_LIBS@ \ + @RAUL_LIBS@ \ + @REDLANDMM_LIBS@ \ + @SLV2_LIBS@ AM_CFLAGS=-std=c99 diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index 78f9e6e8..bc9148ed 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -97,7 +97,7 @@ App::App(Ingen::Shared::World* world) glade_xml->get_widget_derived("patch_tree_win", _patch_tree_window); glade_xml->get_widget("about_win", _about_dialog); - Raul::RDF::World& rdf_world = *world->rdf_world; + Redland::World& rdf_world = *world->rdf_world; rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#"); diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp index 4c529d40..d4a9329f 100644 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ b/src/libs/gui/LoadRemotePatchWindow.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "client/PatchModel.hpp" #include "interface/EngineInterface.hpp" #include "module/World.hpp" @@ -67,19 +67,19 @@ LoadRemotePatchWindow::present(SharedPtr patch, GraphObject::Variabl set_patch(patch); _initial_data = data; - RDF::Model model(*App::instance().world()->rdf_world, + Redland::Model model(*App::instance().world()->rdf_world, "http://rdf.drobilla.net/ingen_patches/index.ttl", "http://rdf.drobilla.net/ingen_patches/"); - RDF::Query query(*App::instance().world()->rdf_world, Glib::ustring( + Redland::Query query(*App::instance().world()->rdf_world, Glib::ustring( "SELECT DISTINCT ?name ?uri WHERE {" " ?uri a ingen:Patch ;" " doap:name ?name ." "}")); - RDF::Query::Results results = query.run(*App::instance().world()->rdf_world, model); + Redland::Query::Results results = query.run(*App::instance().world()->rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Gtk::TreeModel::iterator iter = _liststore->append(); (*iter)[_columns._col_name] = (*i)["name"].to_string(); (*iter)[_columns._col_uri] = (*i)["uri"].to_string(); diff --git a/src/libs/gui/Makefile.am b/src/libs/gui/Makefile.am index e45b095a..9e55afab 100644 --- a/src/libs/gui/Makefile.am +++ b/src/libs/gui/Makefile.am @@ -12,20 +12,34 @@ moduledir = $(libdir)/ingen module_LTLIBRARIES = libingen_gui.la libingen_gui_la_CXXFLAGS = \ + -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" \ -DPKGDATADIR=\"$(pkgdatadir)\" \ - @SLV2_CFLAGS@ @RAUL_CFLAGS@ @FLOWCANVAS_CFLAGS@ \ + @CURL_CFLAGS@ \ + @FLOWCANVAS_CFLAGS@ \ + @GNOMECANVASMM_CFLAGS@ \ + @GTKMM_CFLAGS@ \ @INGEN_CFLAGS@ \ - -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" \ - @LIBLO_CFLAGS@ @CURL_CFLAGS@ \ - @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ + @LIBGLADEMM_CFLAGS@ \ + @LIBLO_CFLAGS@ \ + @REDLANDMM_CFLAGS@ \ + @RAUL_CFLAGS@ \ + @SLV2_CFLAGS@ + libingen_gui_la_LDFLAGS = -no-undefined -module -avoid-version libingen_gui_la_LIBADD = \ - @RAUL_LIBS@ @LIBLO_LIBS@ @SLV2_LIBS@ @CURL_LIBS@ \ - @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @FLOWCANVAS_LIBS@ @GNOMECANVASMM_LIBS@ \ + ../client/libingen_client.la \ ../module/libingen_module.la \ - ../client/libingen_client.la + @CURL_LIBS@ \ + @FLOWCANVAS_LIBS@ \ + @GNOMECANVASMM_LIBS@ \ + @GTKMM_LIBS@ \ + @LIBGLADEMM_LIBS@ \ + @LIBLO_LIBS@ \ + @REDLANDMM_LIBS@ \ + @RAUL_LIBS@ \ + @SLV2_LIBS@ libingen_gui_la_SOURCES = \ gui.hpp \ diff --git a/src/libs/module/Makefile.am b/src/libs/module/Makefile.am index 0d52e635..a4b22986 100644 --- a/src/libs/module/Makefile.am +++ b/src/libs/module/Makefile.am @@ -1,8 +1,8 @@ noinst_LTLIBRARIES = libingen_module.la -libingen_module_la_CXXFLAGS = @GLIBMM_CFLAGS@ @RAUL_CFLAGS@ @SLV2_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" +libingen_module_la_CXXFLAGS = @GLIBMM_CFLAGS@ @REDLANDMM_CFLAGS@ @RAUL_CFLAGS@ @SLV2_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" -libingen_module_la_LIBADD = @GLIBMM_LIBS@ @RAUL_LIBS@ @SLV2_LIBS@ +libingen_module_la_LIBADD = @GLIBMM_LIBS@ @REDLANDMM_LIBS@ @RAUL_LIBS@ @SLV2_LIBS@ libingen_module_la_SOURCES = \ global.hpp \ diff --git a/src/libs/module/World.hpp b/src/libs/module/World.hpp index ca8f7b14..b61fe2af 100644 --- a/src/libs/module/World.hpp +++ b/src/libs/module/World.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifdef HAVE_SLV2 #include @@ -52,7 +52,7 @@ struct World { #ifdef HAVE_SLV2 SLV2World slv2_world; #endif - Raul::RDF::World* rdf_world; + Redland::World* rdf_world; EngineInterface* engine; diff --git a/src/libs/module/global.cpp b/src/libs/module/global.cpp index 15e844c1..6cd54685 100644 --- a/src/libs/module/global.cpp +++ b/src/libs/module/global.cpp @@ -44,7 +44,7 @@ get_world() if (!world) { world = new World(); - world->rdf_world = new Raul::RDF::World(); + world->rdf_world = new Redland::World(); #ifdef HAVE_SLV2 world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world->world()); slv2_world_load_all(world->slv2_world); diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp index 1e2497fb..0aa9bb74 100644 --- a/src/libs/serialisation/Loader.cpp +++ b/src/libs/serialisation/Loader.cpp @@ -19,10 +19,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include "interface/EngineInterface.hpp" #include "Loader.hpp" @@ -42,7 +42,7 @@ namespace Serialisation { */ bool Loader::load(SharedPtr engine, - Raul::RDF::World* rdf_world, + Redland::World* rdf_world, const Glib::ustring& document_uri, boost::optional parent, string patch_name, @@ -55,7 +55,7 @@ Loader::load(SharedPtr engine, std::set created; - RDF::Model model(*rdf_world, document_uri); + Redland::Model model(*rdf_world, document_uri); if (patch_uri == "") patch_uri = string("<") + document_uri + ">"; @@ -74,18 +74,18 @@ Loader::load(SharedPtr engine, /* Get polyphony from file (mandatory if not specified in parameters) */ } else { // FIXME: polyphony datatype? - RDF::Query query(*rdf_world, Glib::ustring( + Redland::Query query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?poly WHERE {\n") + patch_uri + " ingen:polyphony ?poly\n }"); - RDF::Query::Results results = query.run(*rdf_world, model); + Redland::Query::Results results = query.run(*rdf_world, model); if (results.size() == 0) { cerr << "[Loader] ERROR: No polyphony found!" << endl; return false; } - const RDF::Node& poly_node = (*results.begin())["poly"]; + const Redland::Node& poly_node = (*results.begin())["poly"]; assert(poly_node.is_int()); patch_poly = static_cast(poly_node.to_int()); } @@ -97,11 +97,11 @@ Loader::load(SharedPtr engine, if (patch_name.substr(patch_name.length()-10) == ".ingen.ttl") patch_name = patch_name.substr(0, patch_name.length()-10); - RDF::Query query(*rdf_world, Glib::ustring( + Redland::Query query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?name WHERE {\n") + patch_uri + " ingen:name ?name\n}"); - RDF::Query::Results results = query.run(*rdf_world, model); + Redland::Query::Results results = query.run(*rdf_world, model); if (results.size() > 0) patch_name = (*results.begin())["name"].to_string(); @@ -115,7 +115,7 @@ Loader::load(SharedPtr engine, /* Load (plugin) nodes */ - RDF::Query query(*rdf_world, Glib::ustring( + Redland::Query query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?name ?plugin ?varkey ?varval ?poly WHERE {\n") + patch_uri + " ingen:node ?node .\n" "?node ingen:name ?name ;\n" @@ -127,13 +127,13 @@ Loader::load(SharedPtr engine, " }" "}"); - RDF::Query::Results results = query.run(*rdf_world, model); + Redland::Query::Results results = query.run(*rdf_world, model); map variable; rdf_world->mutex().lock(); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string node_name = (*i)["name"].to_string(); const Path node_path = patch_path.base() + node_name; @@ -142,7 +142,7 @@ Loader::load(SharedPtr engine, const string node_plugin = rdf_world->qualify((*i)["plugin"].to_string()); bool node_polyphonic = false; - RDF::Node poly_node = (*i)["poly"]; + Redland::Node poly_node = (*i)["poly"]; if (poly_node.is_bool() && poly_node.to_bool() == true) node_polyphonic = true; @@ -151,10 +151,10 @@ Loader::load(SharedPtr engine, } const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string()); - RDF::Node val_node = (*i)["varval"]; + Redland::Node val_node = (*i)["varval"]; if (key != "") - engine->set_variable(node_path, key, AtomRedland::rdf_node_to_atom(val_node)); + engine->set_variable(node_path, key, Atom(val_node)); } rdf_world->mutex().unlock(); @@ -162,7 +162,7 @@ Loader::load(SharedPtr engine, /* Load subpatches */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?patch ?name WHERE {\n") + patch_uri + " ingen:node ?patch .\n" "?patch a ingen:Patch ;\n" @@ -171,7 +171,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string name = (*i)["name"].to_string(); const string patch = (*i)["patch"].to_string(); @@ -189,7 +189,7 @@ Loader::load(SharedPtr engine, /* Set node port control values */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") + patch_uri + " ingen:node ?node .\n" "?node ingen:name ?nodename ;\n" @@ -201,7 +201,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string node_name = (*i)["nodename"].to_string(); const string port_name = (*i)["portname"].to_string(); @@ -215,7 +215,7 @@ Loader::load(SharedPtr engine, /* Load this patch's ports */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?port ?type ?name ?datatype ?varkey ?varval ?portval WHERE {\n") + patch_uri + " ingen:port ?port .\n" "?port a ?type ;\n" @@ -232,7 +232,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string name = (*i)["name"].to_string(); const string type = rdf_world->qualify((*i)["type"].to_string()); const string datatype = rdf_world->qualify((*i)["datatype"].to_string()); @@ -245,17 +245,17 @@ Loader::load(SharedPtr engine, created.insert(port_path); } - const RDF::Node val_node = (*i)["portval"]; + const Redland::Node val_node = (*i)["portval"]; if (val_node.is_float()) { const float val = val_node.to_float(); engine->set_port_value(patch_path.base() + name, "ingen:control", sizeof(float), &val); } const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string()); - const RDF::Node var_val_node = (*i)["varval"]; + const Redland::Node var_val_node = (*i)["varval"]; if (key != "") - engine->set_variable(patch_path.base() + name, key, AtomRedland::rdf_node_to_atom(var_val_node)); + engine->set_variable(patch_path.base() + name, key, Atom(var_val_node)); } created.clear(); @@ -263,7 +263,7 @@ Loader::load(SharedPtr engine, /* Node -> Node connections */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?srcnodename ?srcname ?dstnodename ?dstname WHERE {\n") + patch_uri + "ingen:node ?srcnode ;\n" " ingen:node ?dstnode .\n" @@ -278,7 +278,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); Path src_port = src_node.base() + (*i)["srcname"].to_string(); Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); @@ -292,7 +292,7 @@ Loader::load(SharedPtr engine, /* This Patch -> Node connections */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?srcname ?dstnodename ?dstname WHERE {\n") + patch_uri + " ingen:port ?src ;\n" " ingen:node ?dstnode .\n" @@ -305,7 +305,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Path src_port = patch_path.base() + (*i)["srcname"].to_string(); Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string(); Path dst_port = dst_node.base() + (*i)["dstname"].to_string(); @@ -318,7 +318,7 @@ Loader::load(SharedPtr engine, /* Node -> This Patch connections */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?srcnodename ?srcname ?dstname WHERE {\n") + patch_uri + " ingen:port ?dst ;\n" " ingen:node ?srcnode .\n" @@ -331,7 +331,7 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Path dst_port = patch_path.base() + (*i)["dstname"].to_string(); Path src_node = patch_path.base() + (*i)["srcnodename"].to_string(); Path src_port = src_node.base() + (*i)["srcname"].to_string(); @@ -344,7 +344,7 @@ Loader::load(SharedPtr engine, /* Load variables */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?varkey ?varval WHERE {\n") + patch_uri + " ingen:variable ?variable .\n" "?variable ingen:key ?varkey ;\n" @@ -353,13 +353,13 @@ Loader::load(SharedPtr engine, results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string()); - RDF::Node val_node = (*i)["varval"]; + Redland::Node val_node = (*i)["varval"]; if (key != "") - engine->set_variable(patch_path, key, AtomRedland::rdf_node_to_atom(val_node)); + engine->set_variable(patch_path, key, Atom(val_node)); } @@ -370,16 +370,16 @@ Loader::load(SharedPtr engine, /* Enable */ - query = RDF::Query(*rdf_world, Glib::ustring( + query = Redland::Query(*rdf_world, Glib::ustring( "SELECT DISTINCT ?enabled WHERE {\n") + patch_uri + " ingen:enabled ?enabled .\n" "}"); results = query.run(*rdf_world, model); - for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { + for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - RDF::Node enabled_node = (*i)["enabled"]; + Redland::Node enabled_node = (*i)["enabled"]; if (enabled_node.is_bool() && enabled_node.to_bool()) { engine->enable_patch(patch_path); diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp index e81fba4c..a1d4e302 100644 --- a/src/libs/serialisation/Loader.hpp +++ b/src/libs/serialisation/Loader.hpp @@ -26,7 +26,7 @@ #include #include "interface/GraphObject.hpp" -namespace Raul { namespace RDF { class World; } } +namespace Redland { class World; } namespace Ingen { namespace Shared { class EngineInterface; } } using namespace Ingen::Shared; @@ -41,12 +41,12 @@ public: virtual bool load(SharedPtr engine, - Raul::RDF::World* world, + Redland::World* world, const Glib::ustring& uri, boost::optional parent, std::string patch_name, Glib::ustring patch_uri = "", - GraphObject::Variables data = GraphObject::Variables()); + GraphObject::Variables data = GraphObject::Variables()); }; diff --git a/src/libs/serialisation/Makefile.am b/src/libs/serialisation/Makefile.am index 0f5df646..3121cec3 100644 --- a/src/libs/serialisation/Makefile.am +++ b/src/libs/serialisation/Makefile.am @@ -6,12 +6,13 @@ module_LTLIBRARIES = libingen_serialisation.la libingen_serialisation_la_CXXFLAGS = \ @INGEN_CFLAGS@ \ + @REDLANDMM_CFLAGS@ \ @RAUL_CFLAGS@ \ @GLIBMM_CFLAGS@ \ @SLV2_CFLAGS@ libingen_serialisation_la_LDFLAGS = -no-undefined -module -avoid-version -libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ @SLV2_LIBS@ +libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @REDLANDMM_LIBS@ @GLIBMM_LIBS@ @SLV2_LIBS@ libingen_serialisation_la_SOURCES = \ Loader.cpp \ diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp index 223093a0..b8195d34 100644 --- a/src/libs/serialisation/Serialiser.cpp +++ b/src/libs/serialisation/Serialiser.cpp @@ -44,7 +44,7 @@ using namespace std; using namespace Raul; -using namespace Raul::RDF; +using namespace Redland; using namespace Ingen; using namespace Ingen::Shared; @@ -52,7 +52,7 @@ namespace Ingen { namespace Serialisation { -Serialiser::Serialiser(Raul::RDF::World& world) +Serialiser::Serialiser(Redland::World& world) : _world(world) { } @@ -77,10 +77,10 @@ Serialiser::to_string(SharedPtr object, start_to_string(base_uri); serialise(object); - RDF::Node base_rdf_node(_model->world(), RDF::Node::RESOURCE, base_uri); + Redland::Node base_rdf_node(_model->world(), Redland::Node::RESOURCE, base_uri); for (GraphObject::Variables::const_iterator v = extra_rdf.begin(); v != extra_rdf.end(); ++v) { if (v->first.find(":") != string::npos) { - _model->add_statement(base_rdf_node, v->first, v->second); + _model->add_statement(base_rdf_node, v->first, v->second.to_rdf_node(_model->world())); } else { cerr << "Warning: not serialising extra RDF with key '" << v->first << "'" << endl; } @@ -100,7 +100,7 @@ Serialiser::start_to_filename(const string& filename) setlocale(LC_NUMERIC, "C"); _base_uri = "file://" + filename; - _model = new RDF::Model(_world); + _model = new Redland::Model(_world); _mode = TO_FILE; } @@ -118,7 +118,7 @@ Serialiser::start_to_string(const string& base_uri) setlocale(LC_NUMERIC, "C"); _base_uri = base_uri; - _model = new RDF::Model(_world); + _model = new Redland::Model(_world); _mode = TO_STRING; } @@ -147,7 +147,7 @@ Serialiser::finish() /** Convert a path to an RDF blank node ID for serializing. */ -RDF::Node +Redland::Node Serialiser::path_to_node_id(const Path& path) { assert(_model); @@ -158,7 +158,7 @@ Serialiser::path_to_node_id(const Path& path) ret[i] = '_'; } - return RDF::Node(Node::BLANK, ret); + return Redland::Node(Node::BLANK, ret); */ NodeMap::iterator i = _node_map.find(path); @@ -167,7 +167,7 @@ Serialiser::path_to_node_id(const Path& path) assert(i->second.get_node()); return i->second; } else { - RDF::Node id = _world.blank_id(path.name()); + Redland::Node id = _world.blank_id(path.name()); assert(id); _node_map[path] = id; return id; @@ -255,14 +255,14 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_error) } -RDF::Node +Redland::Node Serialiser::patch_path_to_rdf_id(const Path& path) { if (path == _root_object->path()) { - return RDF::Node(_model->world(), RDF::Node::RESOURCE, _base_uri); + return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri); } else { assert(path.length() > _root_object->path().length()); - return RDF::Node(_model->world(), RDF::Node::RESOURCE, + return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri + string("#") + path.substr(_root_object->path().length())); } } @@ -273,28 +273,28 @@ Serialiser::serialise_patch(SharedPtr patch) { assert(_model); - const RDF::Node patch_id = patch_path_to_rdf_id(patch->path()); + const Redland::Node patch_id = patch_path_to_rdf_id(patch->path()); _model->add_statement( patch_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch")); if (patch->path().name().length() > 0) { _model->add_statement( patch_id, "ingen:name", - Atom(patch->path().name().c_str())); + Redland::Node(_model->world(), Redland::Node::LITERAL, patch->path().name())); } _model->add_statement( patch_id, "ingen:polyphony", - Atom((int)patch->internal_polyphony())); + Atom((int)patch->internal_polyphony()).to_rdf_node(_model->world())); _model->add_statement( patch_id, "ingen:enabled", - Atom(patch->enabled())); + Atom(patch->enabled()).to_rdf_node(_model->world())); serialise_variables(patch_id, patch->variables()); @@ -309,7 +309,7 @@ Serialiser::serialise_patch(SharedPtr patch) _model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_id(patch->path())); serialise_patch(patch); } else if (node) { - const RDF::Node node_id = path_to_node_id(n->second->path()); + const Redland::Node node_id = path_to_node_id(n->second->path()); _model->add_statement(patch_id, "ingen:node", node_id); serialise_node(node, node_id); } @@ -317,7 +317,7 @@ Serialiser::serialise_patch(SharedPtr patch) for (uint32_t i=0; i < patch->num_ports(); ++i) { Port* p = patch->port(i); - const RDF::Node port_id = path_to_node_id(p->path()); + const Redland::Node port_id = path_to_node_id(p->path()); _model->add_statement(patch_id, "ingen:port", port_id); serialise_port(p, port_id); } @@ -334,30 +334,30 @@ Serialiser::serialise_plugin(SharedPtr plugin) { assert(_model); - const RDF::Node plugin_id = RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->uri()); + const Redland::Node plugin_id = Redland::Node(_model->world(), Redland::Node::RESOURCE, plugin->uri()); _model->add_statement( plugin_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->type_uri())); + Redland::Node(_model->world(), Redland::Node::RESOURCE, plugin->type_uri())); } void -Serialiser::serialise_node(SharedPtr node, const RDF::Node& node_id) +Serialiser::serialise_node(SharedPtr node, const Redland::Node& node_id) { - const RDF::Node plugin_id - = RDF::Node(_model->world(), RDF::Node::RESOURCE, node->plugin()->uri()); + const Redland::Node plugin_id + = Redland::Node(_model->world(), Redland::Node::RESOURCE, node->plugin()->uri()); _model->add_statement( node_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:Node")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:Node")); _model->add_statement( node_id, "ingen:name", - node->path().name()); + Atom(node->path().name()).to_rdf_node(_model->world())); _model->add_statement( node_id, @@ -367,14 +367,14 @@ Serialiser::serialise_node(SharedPtr node, const RDF::Node& node_i _model->add_statement( node_id, "ingen:polyphonic", - node->polyphonic()); + Atom(node->polyphonic()).to_rdf_node(_model->world())); //serialise_plugin(node->plugin()); for (uint32_t i=0; i < node->num_ports(); ++i) { Port* p = node->port(i); assert(p); - const RDF::Node port_id = path_to_node_id(p->path()); + const Redland::Node port_id = path_to_node_id(p->path()); serialise_port(p, port_id); _model->add_statement(node_id, "ingen:port", port_id); } @@ -388,22 +388,24 @@ Serialiser::serialise_node(SharedPtr node, const RDF::Node& node_i * Audio output ports with no variable will not be written, for example. */ void -Serialiser::serialise_port(const Port* port, const RDF::Node& port_id) +Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) { if (port->is_input()) _model->add_statement(port_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:InputPort")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:InputPort")); else _model->add_statement(port_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:OutputPort")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:OutputPort")); - _model->add_statement(port_id, "ingen:name", Atom(port->path().name().c_str())); + _model->add_statement(port_id, "ingen:name", + Atom(port->path().name().c_str()).to_rdf_node(_model->world())); _model->add_statement(port_id, "rdf:type", - RDF::Node(_model->world(), RDF::Node::RESOURCE, port->type().uri())); + Redland::Node(_model->world(), Redland::Node::RESOURCE, port->type().uri())); if (port->type() == DataType::CONTROL && port->is_input()) - _model->add_statement(port_id, "ingen:value", port->value()); + _model->add_statement(port_id, "ingen:value", + Atom(port->value()).to_rdf_node(_model->world())); serialise_variables(port_id, port->variables()); } @@ -415,23 +417,23 @@ Serialiser::serialise_connection(SharedPtr connection) throw (std::l if (!_model) throw std::logic_error("serialise_connection called without serialization in progress"); - const RDF::Node src_node = path_to_node_id(connection->src_port_path()); - const RDF::Node dst_node = path_to_node_id(connection->dst_port_path()); + const Redland::Node src_node = path_to_node_id(connection->src_port_path()); + const Redland::Node dst_node = path_to_node_id(connection->dst_port_path()); _model->add_statement(dst_node, "ingen:connectedTo", src_node); } void -Serialiser::serialise_variables(RDF::Node subject, const GraphObject::Variables& variables) +Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variables& variables) { for (GraphObject::Variables::const_iterator v = variables.begin(); v != variables.end(); ++v) { if (v->first.find(":") != string::npos) { - const RDF::Node var_id = _world.blank_id(); - const RDF::Node key(_model->world(), RDF::Node::RESOURCE, v->first); + const Redland::Node var_id = _world.blank_id(); + const Redland::Node key(_model->world(), Redland::Node::RESOURCE, v->first); _model->add_statement(subject, "ingen:variable", var_id); _model->add_statement(var_id, "ingen:key", key); - _model->add_statement(var_id, "ingen:value", v->second); + _model->add_statement(var_id, "ingen:value", v->second.to_rdf_node(_model->world())); } else { cerr << "Warning: not serialising variable with key '" << v->first << "'" << endl; } diff --git a/src/libs/serialisation/Serialiser.hpp b/src/libs/serialisation/Serialiser.hpp index fc15cd1a..e14560b7 100644 --- a/src/libs/serialisation/Serialiser.hpp +++ b/src/libs/serialisation/Serialiser.hpp @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include "interface/GraphObject.hpp" using namespace Raul; @@ -54,7 +54,7 @@ namespace Serialisation { class Serialiser { public: - Serialiser(Raul::RDF::World& world); + Serialiser(Redland::World& world); void to_file(SharedPtr object, const string& filename); @@ -77,22 +77,22 @@ private: void serialise_plugin(SharedPtr p); void serialise_patch(SharedPtr p); - void serialise_node(SharedPtr n, const Raul::RDF::Node& id); - void serialise_port(const Shared::Port* p, const Raul::RDF::Node& id); + void serialise_node(SharedPtr n, const Redland::Node& id); + void serialise_port(const Shared::Port* p, const Redland::Node& id); - void serialise_variables(RDF::Node subject, const GraphObject::Variables& variables); + void serialise_variables(Redland::Node subject, const GraphObject::Variables& variables); - Raul::RDF::Node path_to_node_id(const Path& path); - Raul::RDF::Node patch_path_to_rdf_id(const Path& path); + Redland::Node path_to_node_id(const Path& path); + Redland::Node patch_path_to_rdf_id(const Path& path); - typedef std::map NodeMap; + typedef std::map NodeMap; SharedPtr _root_object; Mode _mode; NodeMap _node_map; string _base_uri; - Raul::RDF::World& _world; - Raul::RDF::Model* _model; + Redland::World& _world; + Redland::Model* _model; }; diff --git a/src/progs/ingen/Makefile.am b/src/progs/ingen/Makefile.am index 9705fd9f..0e265eca 100644 --- a/src/progs/ingen/Makefile.am +++ b/src/progs/ingen/Makefile.am @@ -1,4 +1,4 @@ -AM_CXXFLAGS = @GTHREAD_CFLAGS@ @GLIBMM_CFLAGS@ @RAUL_CFLAGS@ @SLV2_CFLAGS@ @INGEN_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" +AM_CXXFLAGS = @GTHREAD_CFLAGS@ @GLIBMM_CFLAGS@ @REDLANDMM_CFLAGS@ @RAUL_CFLAGS@ @SLV2_CFLAGS@ @INGEN_CFLAGS@ -DINGEN_MODULE_DIR=\"$(libdir)/ingen\" MAINTAINERCLEANFILES = Makefile.in @@ -6,7 +6,7 @@ desktopfilesdir = $(datadir)/applications dist_desktopfiles_DATA = ingen.desktop bin_PROGRAMS = ingen -ingen_LDADD = @SLV2_LIBS@ @RAUL_LIBS@ @GTHREAD_LIBS@ @GLIBMM_LIBS@ ../../libs/module/libingen_module.la +ingen_LDADD = @SLV2_LIBS@ @REDLANDMM_LIBS@ @RAUL_LIBS@ @GTHREAD_LIBS@ @GLIBMM_LIBS@ ../../libs/module/libingen_module.la ingen_DEPENDENCIES = ../../libs/module/libingen_module.la ingen_SOURCES = \ diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp index f6400e2e..4e4753c6 100644 --- a/src/progs/ingen/main.cpp +++ b/src/progs/ingen/main.cpp @@ -147,7 +147,7 @@ main(int argc, char** argv) /* Load a patch */ if (args.load_given && engine_interface) { - Raul::RDF::World rdf_world; + Redland::World rdf_world; rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#"); rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#"); -- cgit v1.2.1