From dbaf3eaff06b05fe8901bfe800c76435fc024e3c 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/machina@927 a436a847-0d15-0410-975c-d299462d15a1 --- src/Makefile.am | 4 ++-- src/engine/Action.cpp | 6 +++--- src/engine/Edge.cpp | 6 +++--- src/engine/Loader.cpp | 8 ++++---- src/engine/Machine.cpp | 12 ++++++------ src/engine/Makefile.am | 4 ++-- src/engine/MidiAction.cpp | 11 ++++++----- src/engine/Node.cpp | 8 ++++---- src/engine/machina/Action.hpp | 2 +- src/engine/machina/Edge.hpp | 2 +- src/engine/machina/Engine.hpp | 6 +++--- src/engine/machina/Loader.hpp | 4 ++-- src/engine/machina/Machine.hpp | 2 +- src/engine/machina/MidiAction.hpp | 2 +- src/engine/machina/Node.hpp | 2 +- src/gui/MachinaGUI.cpp | 6 +++--- src/gui/Makefile.am | 39 ++++++++++++++++++++++++++++----------- src/gui/main.cpp | 2 +- src/machina.cpp | 2 +- src/midi2machina.cpp | 4 ++-- 20 files changed, 75 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index f7bc5d0..5334bc2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,7 @@ endif machina_SOURCES = machina.cpp -AM_CXXFLAGS = -I$(top_srcdir)/raul -I$(top_srcdir)/machina/src/engine @JACK_CFLAGS@ @GLIBMM_CFLAGS@ -LDADD = @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ engine/libmachina.la +AM_CXXFLAGS = @REDLANDMM_CFLAGS@ @RAUL_CFLAGS@ @JACK_CFLAGS@ @GLIBMM_CFLAGS@ -I$(top_srcdir)/machina/src/engine +LDADD = @REDLANDMM_LIBS@ @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ engine/libmachina.la midi2machina_SOURCES = midi2machina.cpp diff --git a/src/engine/Action.cpp b/src/engine/Action.cpp index 312bff6..7be3687 100644 --- a/src/engine/Action.cpp +++ b/src/engine/Action.cpp @@ -22,7 +22,7 @@ namespace Machina { void -Action::write_state(Raul::RDF::Model& model) +Action::write_state(Redland::Model& model) { using namespace Raul; @@ -30,8 +30,8 @@ Action::write_state(Raul::RDF::Model& model) set_id(model.world().blank_id()); model.add_statement(_id, - RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Action")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "rdf:type"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Action")); } diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp index 430c746..08e45c0 100644 --- a/src/engine/Edge.cpp +++ b/src/engine/Edge.cpp @@ -24,7 +24,7 @@ namespace Machina { void -Edge::write_state(Raul::RDF::Model& model) +Edge::write_state(Redland::Model& model) { using namespace Raul; @@ -33,7 +33,7 @@ Edge::write_state(Raul::RDF::Model& model) model.add_statement(_id, "rdf:type", - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Edge")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Edge")); SharedPtr tail = _tail.lock(); SharedPtr head = _head; @@ -53,7 +53,7 @@ Edge::write_state(Raul::RDF::Model& model) model.add_statement(_id, "machina:probability", - _probability.get()); + Atom(_probability.get()).to_rdf_node(model.world())); } diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp index 015accf..7180061 100644 --- a/src/engine/Loader.cpp +++ b/src/engine/Loader.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "machina/Loader.hpp" #include "machina/Node.hpp" #include "machina/Edge.hpp" @@ -32,7 +32,7 @@ using std::cerr; using std::cout; using std::endl; namespace Machina { -Loader::Loader(Raul::RDF::World& rdf_world) +Loader::Loader(Redland::World& rdf_world) : _rdf_world(rdf_world) { _rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); @@ -48,7 +48,7 @@ Loader::Loader(Raul::RDF::World& rdf_world) SharedPtr Loader::load(const Glib::ustring& uri) { - using Raul::RDF::Query; + using Redland::Query; SharedPtr machine; Glib::ustring document_uri = uri; @@ -77,7 +77,7 @@ Loader::load(const Glib::ustring& uri) typedef std::map > Created; Created created; - Raul::RDF::Model model(_rdf_world, document_uri); + Redland::Model model(_rdf_world, document_uri); /* Get initial nodes */ diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp index 0ddf61c..11d894c 100644 --- a/src/engine/Machine.cpp +++ b/src/engine/Machine.cpp @@ -299,15 +299,15 @@ Machine::learn(SharedPtr learn) void -Machine::write_state(Raul::RDF::Model& model) +Machine::write_state(Redland::Model& model) { using namespace Raul; model.world().add_prefix("machina", "http://drobilla.net/ns/machina#"); model.add_statement(model.base_uri(), - RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Machine")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "rdf:type"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Machine")); size_t count = 0; @@ -317,11 +317,11 @@ Machine::write_state(Raul::RDF::Model& model) if ((*n)->is_initial()) { model.add_statement(model.base_uri(), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:initialNode"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:initialNode"), (*n)->id()); } else { model.add_statement(model.base_uri(), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:node"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:node"), (*n)->id()); } } @@ -336,7 +336,7 @@ Machine::write_state(Raul::RDF::Model& model) (*e)->write_state(model); model.add_statement(model.base_uri(), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:edge"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:edge"), (*e)->id()); } diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index dad7425..5e291c7 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -2,8 +2,8 @@ SUBDIRS = machina lib_LTLIBRARIES = libmachina.la -libmachina_la_CXXFLAGS = -I$(top_srcdir)/raul @JACK_CFLAGS@ @GLIBMM_CFLAGS@ -libmachina_la_LIBADD = @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ +libmachina_la_CXXFLAGS = @REDLANDMM_CFLAGS@ @RAUL_CFLAGS@ @JACK_CFLAGS@ @GLIBMM_CFLAGS@ +libmachina_la_LIBADD = @REDLANDMM_LIBS@ @RAUL_LIBS@ @JACK_LIBS@ @GLIBMM_LIBS@ libmachina_la_SOURCES = \ Node.cpp \ diff --git a/src/engine/MidiAction.cpp b/src/engine/MidiAction.cpp index f811924..ac96211 100644 --- a/src/engine/MidiAction.cpp +++ b/src/engine/MidiAction.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "machina/MidiAction.hpp" namespace Machina { @@ -91,20 +92,20 @@ MidiAction::execute(SharedPtr sink, Raul::BeatTime time) void -MidiAction::write_state(Raul::RDF::Model& model) +MidiAction::write_state(Redland::Model& model) { using namespace Raul; Action::write_state(model); model.add_statement(_id, - RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"), - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:MidiAction")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "rdf:type"), + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:MidiAction")); // FIXME: Assumes note on/note off model.add_statement(_id, - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:midiNote"), - (int)(_event.get()[1])); + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:midiNote"), + Atom((int)(_event.get()[1])).to_rdf_node(model.world())); } diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp index 6869798..cb1a8eb 100644 --- a/src/engine/Node.cpp +++ b/src/engine/Node.cpp @@ -135,7 +135,7 @@ Node::remove_outgoing_edges_to(SharedPtr node) void -Node::write_state(Raul::RDF::Model& model) +Node::write_state(Redland::Model& model) { using namespace Raul; @@ -145,15 +145,15 @@ Node::write_state(Raul::RDF::Model& model) if (_is_selector) model.add_statement(_id, "rdf:type", - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:SelectorNode")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:SelectorNode")); else model.add_statement(_id, "rdf:type", - RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Node")); + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Node")); model.add_statement(_id, "machina:duration", - Raul::Atom((float)_duration)); + Raul::Atom((float)_duration).to_rdf_node(model.world())); if (_enter_action) { _enter_action->write_state(model); diff --git a/src/engine/machina/Action.hpp b/src/engine/machina/Action.hpp index cf6bf58..3cab3ee 100644 --- a/src/engine/machina/Action.hpp +++ b/src/engine/machina/Action.hpp @@ -34,7 +34,7 @@ namespace Machina { struct Action : public Raul::Deletable, public Raul::Stateful { virtual void execute(SharedPtr sink, Raul::BeatTime time) = 0; - virtual void write_state(Raul::RDF::Model& model); + virtual void write_state(Redland::Model& model); }; diff --git a/src/engine/machina/Edge.hpp b/src/engine/machina/Edge.hpp index f82f1ae..3f564ef 100644 --- a/src/engine/machina/Edge.hpp +++ b/src/engine/machina/Edge.hpp @@ -40,7 +40,7 @@ public: , _head(head) {} - void write_state(Raul::RDF::Model& model); + void write_state(Redland::Model& model); WeakPtr tail() { return _tail; } SharedPtr head() { return _head; } diff --git a/src/engine/machina/Engine.hpp b/src/engine/machina/Engine.hpp index d429df2..d8d16d9 100644 --- a/src/engine/machina/Engine.hpp +++ b/src/engine/machina/Engine.hpp @@ -31,13 +31,13 @@ class Machine; class Engine { public: - Engine(SharedPtr driver, Raul::RDF::World& rdf_world) + Engine(SharedPtr driver, Redland::World& rdf_world) : _driver(driver) , _rdf_world(rdf_world) , _loader(_rdf_world) { } - Raul::RDF::World& rdf_world() { return _rdf_world; } + Redland::World& rdf_world() { return _rdf_world; } SharedPtr driver() { return _driver; } SharedPtr machine() { return _driver->machine(); } @@ -51,7 +51,7 @@ public: private: SharedPtr _driver; - Raul::RDF::World& _rdf_world; + Redland::World& _rdf_world; Loader _loader; }; diff --git a/src/engine/machina/Loader.hpp b/src/engine/machina/Loader.hpp index 9c351a0..914df24 100644 --- a/src/engine/machina/Loader.hpp +++ b/src/engine/machina/Loader.hpp @@ -32,12 +32,12 @@ class Machine; class Loader { public: - Loader(Raul::RDF::World& rdf_world); + Loader(Redland::World& rdf_world); SharedPtr load(const Glib::ustring& filename); private: - Raul::RDF::World& _rdf_world; + Redland::World& _rdf_world; }; diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp index 946eaca..c6f8796 100644 --- a/src/engine/machina/Machine.hpp +++ b/src/engine/machina/Machine.hpp @@ -47,7 +47,7 @@ public: void remove_node(SharedPtr node); void learn(SharedPtr learn); - void write_state(Raul::RDF::Model& model); + void write_state(Redland::Model& model); // Audio context void reset(); diff --git a/src/engine/machina/MidiAction.hpp b/src/engine/machina/MidiAction.hpp index 09986fd..5639532 100644 --- a/src/engine/machina/MidiAction.hpp +++ b/src/engine/machina/MidiAction.hpp @@ -53,7 +53,7 @@ public: void execute(SharedPtr driver, Raul::BeatTime time); - virtual void write_state(Raul::RDF::Model& model); + virtual void write_state(Redland::Model& model); private: diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp index 1834207..2e26f0a 100644 --- a/src/engine/machina/Node.hpp +++ b/src/engine/machina/Node.hpp @@ -62,7 +62,7 @@ public: void remove_outgoing_edge(SharedPtr edge); void remove_outgoing_edges_to(SharedPtr node); - void write_state(Raul::RDF::Model& model); + void write_state(Redland::Model& model); bool is_initial() const { return _is_initial; } void set_initial(bool i) { _is_initial = i; } diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 8472d5f..6f8881e 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include "GladeXml.hpp" @@ -270,7 +270,7 @@ MachinaGUI::menu_file_save() if (!raptor_uri_uri_string_is_file_uri((const unsigned char*)_save_uri.c_str())) menu_file_save_as(); - Raul::RDF::Model model(_engine->rdf_world()); + Redland::Model model(_engine->rdf_world()); model.set_base_uri(_save_uri); machine()->write_state(model); model.serialise_to_file(_save_uri); @@ -322,7 +322,7 @@ MachinaGUI::menu_file_save_as() fin.close(); if (confirm) { - Raul::RDF::Model model(_engine->rdf_world()); + Redland::Model model(_engine->rdf_world()); _save_uri = uri; model.set_base_uri(_save_uri); _engine->machine()->write_state(model); diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index f6a2ef2..9458e89 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -1,4 +1,14 @@ -AM_CXXFLAGS = -I$(top_srcdir)/flowcanvas -I$(top_srcdir)/raul -I$(top_srcdir)/machina/src/engine -DPKGDATADIR=\"$(pkgdatadir)\" @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @JACK_CFLAGS@ @GTHREAD_CFLAGS@ +AM_CXXFLAGS = \ + -DPKGDATADIR=\"$(pkgdatadir)\" \ + -I$(top_srcdir)/flowcanvas \ + -I$(top_srcdir)/machina/src/engine \ + -I$(top_srcdir)/raul \ + @GNOMECANVASMM_CFLAGS@ \ + @GTHREAD_CFLAGS@ \ + @JACK_CFLAGS@ \ + @LIBGLADEMM_CFLAGS@ \ + @RAUL_CFLAGS@ \ + @REDLANDMM_CFLAGS@ EXTRA_DIST = machina.gladep @@ -9,22 +19,29 @@ globalpixmapsdir = $(datadir)/pixmaps dist_globalpixmaps_DATA = machina.svg machina_gui_SOURCES = \ - main.cpp \ + EdgeView.cpp \ + EdgeView.hpp \ GladeXml.hpp \ - MachinaGUI.hpp \ - MachinaGUI.cpp \ - MachinaCanvas.hpp \ MachinaCanvas.cpp \ - NodeView.hpp \ - NodeView.cpp \ - EdgeView.hpp \ - EdgeView.cpp \ + MachinaCanvas.hpp \ + MachinaGUI.cpp \ + MachinaGUI.hpp \ + NodePropertiesWindow.cpp \ NodePropertiesWindow.hpp \ - NodePropertiesWindow.cpp + NodeView.cpp \ + NodeView.hpp \ + main.cpp if WITH_MACHINA_GUI -machina_gui_LDADD = ../engine/libmachina.la @RAUL_LIBS@ @FLOWCANVAS_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @JACK_LIBS@ +machina_gui_LDADD = \ + ../engine/libmachina.la \ + @FLOWCANVAS_LIBS@ \ + @GNOMECANVASMM_LIBS@ \ + @JACK_LIBS@ \ + @LIBGLADEMM_LIBS@ \ + @RAUL_LIBS@ \ + @REDLANDMM_LIBS@ bin_PROGRAMS = machina_gui diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 527986b..680ec68 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -40,7 +40,7 @@ main(int argc, char** argv) if ( ! Glib::thread_supported()) Glib::thread_init(); - Raul::RDF::World rdf_world; + Redland::World rdf_world; SharedPtr machine; diff --git a/src/machina.cpp b/src/machina.cpp index edbd884..1a5ecb8 100644 --- a/src/machina.cpp +++ b/src/machina.cpp @@ -54,7 +54,7 @@ main(int argc, char** argv) SharedPtr driver(new JackDriver()); - Raul::RDF::World rdf_world; + Redland::World rdf_world; Engine engine(driver, rdf_world); /*// FIXME: Would be nice if this could take URIs on the cmd line diff --git a/src/midi2machina.cpp b/src/midi2machina.cpp index 75a6795..b715691 100644 --- a/src/midi2machina.cpp +++ b/src/midi2machina.cpp @@ -76,8 +76,8 @@ main(int argc, char** argv) cout << "Writing output to " << out_filename << endl; */ - Raul::RDF::World world; - Raul::RDF::Model model(world); + Redland::World world; + Redland::Model model(world); machine->write_state(model); model.serialise_to_file_handle(stdout); -- cgit v1.2.1