summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-08 17:13:34 +0000
committerDavid Robillard <d@drobilla.net>2007-10-08 17:13:34 +0000
commitec9540a559c40046123a2ac4be83faf90b79fbb0 (patch)
tree214f8463bc6c9ef12ac715f65db41427152a7710 /src/libs
parentbade64c9aca86225fa37950c17aabc02a3f4a041 (diff)
downloadingen-ec9540a559c40046123a2ac4be83faf90b79fbb0.tar.gz
ingen-ec9540a559c40046123a2ac4be83faf90b79fbb0.tar.bz2
ingen-ec9540a559c40046123a2ac4be83faf90b79fbb0.zip
Dynamically load Serialiser from serialisation module, make it actually work, etc.
git-svn-id: http://svn.drobilla.net/lad/ingen@850 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/gui/App.cpp25
-rw-r--r--src/libs/gui/App.hpp21
-rw-r--r--src/libs/gui/ThreadedLoader.cpp17
-rw-r--r--src/libs/gui/ThreadedLoader.hpp3
-rw-r--r--src/libs/module/Module.cpp2
-rw-r--r--src/libs/serialisation/Loader.hpp3
-rw-r--r--src/libs/serialisation/Makefile.am7
-rw-r--r--src/libs/serialisation/Serialiser.hpp2
-rw-r--r--src/libs/serialisation/serialisation.cpp12
-rw-r--r--src/libs/serialisation/serialisation.hpp7
10 files changed, 72 insertions, 27 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index 255af745..ef81b0cc 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -65,12 +65,27 @@ App* App::_instance = 0;
App::App(Ingen::Shared::World* world)
-: _configuration(new Configuration()),
- _about_dialog(NULL),
- _window_factory(new WindowFactory()),
- _world(world),
- _enable_signal(true)
+ : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation"))
+ , _configuration(new Configuration())
+ , _about_dialog(NULL)
+ , _window_factory(new WindowFactory())
+ , _world(world)
+ , _enable_signal(true)
{
+ if (_serialisation_module) {
+ Serialiser* (*new_serialiser)(Ingen::Shared::World*) = NULL;
+
+ bool found = _serialisation_module->get_symbol("new_serialiser", (void*&)new_serialiser);
+
+ if (found)
+ _serialiser = SharedPtr<Serialiser>(new_serialiser(world));
+ }
+
+ if ( ! _serialiser) {
+ cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl;
+ cerr << "(If you are running from the source tree, source set_dev_environment.sh)" << endl;
+ }
+
Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference();
glade_xml->get_widget_derived("connect_win", _connect_window);
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 7629cd0e..196bdd96 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -43,9 +43,14 @@ namespace Ingen {
class Store;
class SigClientInterface;
}
+ namespace Serialisation {
+ class Serialiser;
+ }
}
+
+using namespace Ingen::Shared;
+using namespace Ingen::Serialisation;
using namespace Ingen::Client;
-using Ingen::Shared::EngineInterface;
/** \defgroup GUI GTK GUI
*/
@@ -94,10 +99,13 @@ public:
Configuration* configuration() const { return _configuration; }
WindowFactory* window_factory() const { return _window_factory; }
- const SharedPtr<EngineInterface>& engine() const { return _engine; }
- const SharedPtr<SigClientInterface>& client() const { return _client; }
- const SharedPtr<Store>& store() const { return _store; }
- const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
+ const SharedPtr<EngineInterface>& engine() const { return _engine; }
+ const SharedPtr<SigClientInterface>& client() const { return _client; }
+ const SharedPtr<Store>& store() const { return _store; }
+ const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
+ const SharedPtr<Serialiser>& serialiser() const { return _serialiser; }
+
+ SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; }
static inline App& instance() { assert(_instance); return *_instance; }
@@ -115,10 +123,13 @@ protected:
static App* _instance;
+ SharedPtr<Glib::Module> _serialisation_module;
+
SharedPtr<EngineInterface> _engine;
SharedPtr<SigClientInterface> _client;
SharedPtr<Store> _store;
SharedPtr<ThreadedLoader> _loader;
+ SharedPtr<Serialiser> _serialiser;
Configuration* _configuration;
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index a1c28acf..11a2bcd7 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -29,17 +29,18 @@ namespace GUI {
ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
- : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation"))
- , _engine(engine)
+ : _engine(engine)
, _deprecated_loader(engine)
- , _serializer(*App::instance().world()->rdf_world)
{
set_name("Loader");
// FIXME: rework this so the thread is only present when it's doing something (save mem)
- if (_serialisation_module) {
+ if (App::instance().serialisation_module()) {
Loader* (*new_loader)() = NULL;
- bool found = _serialisation_module->get_symbol("new_loader", (void*&)new_loader);
+
+ bool found = App::instance().serialisation_module()->get_symbol(
+ "new_loader", (void*&)new_loader);
+
if (found)
_loader = SharedPtr<Loader>(new_loader());
}
@@ -47,8 +48,8 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
if (_loader) {
start();
} else {
- cerr << "WARNING: Failed to load ingen_serialisation module, unable to load patches." << endl;;
- cerr << "If you are running from the source tree, run ingenuity_dev." << endl;
+ cerr << "WARNING: Failed to load ingen_serialisation module, load disabled." << endl;
+ cerr << "(If you are running from the source tree, source set_dev_environment.sh)" << endl;
}
}
@@ -126,7 +127,7 @@ ThreadedLoader::save_patch(SharedPtr<PatchModel> model, const string& filename)
void
ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& filename)
{
- _serializer.to_file(model, filename);
+ App::instance().serialiser()->to_file(model, filename);
}
diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp
index d0f171af..2e03c2a1 100644
--- a/src/libs/gui/ThreadedLoader.hpp
+++ b/src/libs/gui/ThreadedLoader.hpp
@@ -79,13 +79,10 @@ private:
void _whipped();
- SharedPtr<Glib::Module> _serialisation_module;
-
SharedPtr<EngineInterface> _engine;
SharedPtr<Loader> _loader;
DeprecatedLoader _deprecated_loader;
- Serialiser _serializer;
Glib::Mutex _mutex;
list<Closure> _events;
};
diff --git a/src/libs/module/Module.cpp b/src/libs/module/Module.cpp
index 8f445340..83064548 100644
--- a/src/libs/module/Module.cpp
+++ b/src/libs/module/Module.cpp
@@ -56,7 +56,7 @@ load_module(const string& name)
string filename = Glib::Module::build_path(dir, name);
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY|Glib::MODULE_BIND_LOCAL);
+ module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY);
if (*module) {
return SharedPtr<Glib::Module>(module);
diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp
index 158831cb..d363bf28 100644
--- a/src/libs/serialisation/Loader.hpp
+++ b/src/libs/serialisation/Loader.hpp
@@ -23,11 +23,10 @@
#include <boost/optional.hpp>
#include <raul/SharedPtr.hpp>
#include <raul/Path.hpp>
-#include <raul/Atom.hpp>
#include <raul/Table.hpp>
#include "interface/GraphObject.hpp"
-namespace Raul { class Atom; namespace RDF { class World; } }
+namespace Raul { namespace RDF { class World; } }
namespace Ingen { namespace Shared { class EngineInterface; } }
using namespace Ingen::Shared;
diff --git a/src/libs/serialisation/Makefile.am b/src/libs/serialisation/Makefile.am
index 0a914222..579da448 100644
--- a/src/libs/serialisation/Makefile.am
+++ b/src/libs/serialisation/Makefile.am
@@ -4,7 +4,12 @@ moduledir = $(libdir)/ingen
module_LTLIBRARIES = libingen_serialisation.la
-libingen_serialisation_la_CXXFLAGS = -I$(top_srcdir)/ingen/src/common @RAUL_CFLAGS@ @GLIBMM_CFLAGS@
+libingen_serialisation_la_CXXFLAGS = \
+ -I$(top_srcdir)/ingen/src/common \
+ -I$(top_srcdir)/ingen/src/libs \
+ @RAUL_CFLAGS@ \
+ @GLIBMM_CFLAGS@
+
libingen_serialisation_la_LDFLAGS = -no-undefined -module -avoid-version
libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@
diff --git a/src/libs/serialisation/Serialiser.hpp b/src/libs/serialisation/Serialiser.hpp
index 23d10c82..fb1df5d0 100644
--- a/src/libs/serialisation/Serialiser.hpp
+++ b/src/libs/serialisation/Serialiser.hpp
@@ -46,7 +46,7 @@ namespace Shared {
namespace Serialisation {
-/** Serializes Ingen objects (patches, nodes, etc) to RDF.
+/** Serialises Ingen objects (patches, nodes, etc) to RDF.
*
* \ingroup IngenClient
*/
diff --git a/src/libs/serialisation/serialisation.cpp b/src/libs/serialisation/serialisation.cpp
index 969cf9f2..5da28529 100644
--- a/src/libs/serialisation/serialisation.cpp
+++ b/src/libs/serialisation/serialisation.cpp
@@ -15,8 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include CONFIG_H_PATH
+#include "module/World.hpp"
#include "serialisation.hpp"
#include "Loader.hpp"
+#include "Serialiser.hpp"
namespace Ingen {
namespace Serialisation {
@@ -28,6 +31,15 @@ new_loader()
return new Loader();
}
+
+Ingen::Serialisation::Serialiser*
+new_serialiser(Ingen::Shared::World* world)
+{
+ assert(world->rdf_world);
+ return new Serialiser(*world->rdf_world);
+}
+
+
} // namespace Serialisation
} // namespace Ingen
diff --git a/src/libs/serialisation/serialisation.hpp b/src/libs/serialisation/serialisation.hpp
index f65b9c2e..8f6e8291 100644
--- a/src/libs/serialisation/serialisation.hpp
+++ b/src/libs/serialisation/serialisation.hpp
@@ -19,14 +19,19 @@
#define INGEN_SERIALISATION_H
namespace Ingen {
+
+namespace Shared { class World; }
+
namespace Serialisation {
class Loader;
+class Serialiser;
extern "C" {
- extern Loader* new_loader();
+ extern Loader* new_loader();
+ extern Serialiser* new_serialiser(Ingen::Shared::World* world);
}