summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-18 03:30:02 +0000
committerDavid Robillard <d@drobilla.net>2011-04-18 03:30:02 +0000
commit1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c (patch)
tree16f09c2b731d2968a9b2390cf938d164d2920541 /src/shared
parentad02810bb505e823ed7222c785649f668baaa404 (diff)
downloadingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.tar.gz
ingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.tar.bz2
ingen-1776fe75458a11eeaa5ed0c26c6c9aa0e93f6f2c.zip
Saner module loading API.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3157 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/Configuration.cpp1
-rw-r--r--src/shared/World.cpp22
-rw-r--r--src/shared/World.hpp16
-rw-r--r--src/shared/runtime_paths.cpp2
4 files changed, 22 insertions, 19 deletions
diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp
index e5def43b..3cf07a14 100644
--- a/src/shared/Configuration.cpp
+++ b/src/shared/Configuration.cpp
@@ -17,6 +17,7 @@
#include "raul/Atom.hpp"
+#include "ingen-config.h"
#include "Configuration.hpp"
using namespace Raul;
diff --git a/src/shared/World.cpp b/src/shared/World.cpp
index 38c08340..e53bcf4f 100644
--- a/src/shared/World.cpp
+++ b/src/shared/World.cpp
@@ -49,7 +49,7 @@ namespace Shared {
* \param name The base name of the module, e.g. "ingen_serialisation"
*/
static SharedPtr<Glib::Module>
-load_module(const string& name)
+ingen_load_module(const string& name)
{
Glib::Module* module = NULL;
@@ -95,9 +95,9 @@ load_module(const string& name)
}
}
-class WorldImpl : public boost::noncopyable {
+class World::Pimpl {
public:
- WorldImpl(Raul::Configuration* conf, int& a_argc, char**& a_argv)
+ Pimpl(Raul::Configuration* conf, int& a_argc, char**& a_argv)
: argc(a_argc)
, argv(a_argv)
, conf(conf)
@@ -134,7 +134,7 @@ public:
rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
}
- virtual ~WorldImpl()
+ virtual ~Pimpl()
{
local_engine.reset();
@@ -182,13 +182,13 @@ public:
};
World::World(Raul::Configuration* conf, int& argc, char**& argv)
- : _impl(new WorldImpl(conf, argc, argv))
+ : _impl(new Pimpl(conf, argc, argv))
{
}
World::~World()
{
- unload_all();
+ unload_modules();
delete _impl;
}
@@ -219,9 +219,9 @@ SharedPtr<LV2URIMap> World::uris() { return _impl->uris; }
* @return true on success, false on failure
*/
bool
-World::load(const char* name)
+World::load_module(const char* name)
{
- SharedPtr<Glib::Module> lib = load_module(name);
+ SharedPtr<Glib::Module> lib = ingen_load_module(name);
Ingen::Shared::Module* (*module_load)() = NULL;
if (lib && lib->get_symbol("ingen_module_load", (void*&)module_load)) {
Module* module = module_load();
@@ -238,7 +238,7 @@ World::load(const char* name)
/** Unload all loaded Ingen modules.
*/
void
-World::unload_all()
+World::unload_modules()
{
_impl->modules.clear();
}
@@ -249,7 +249,7 @@ SharedPtr<Ingen::Shared::EngineInterface>
World::interface(const std::string& url)
{
const string scheme = url.substr(0, url.find(":"));
- const WorldImpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme);
+ const Pimpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme);
if (i == _impl->interface_factories.end()) {
warn << "Unknown URI scheme `" << scheme << "'" << endl;
return SharedPtr<Ingen::Shared::EngineInterface>();
@@ -262,7 +262,7 @@ World::interface(const std::string& url)
bool
World::run(const std::string& mime_type, const std::string& filename)
{
- const WorldImpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type);
+ const Pimpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type);
if (i == _impl->script_runners.end()) {
warn << "Unknown script MIME type `" << mime_type << "'" << endl;
return false;
diff --git a/src/shared/World.hpp b/src/shared/World.hpp
index 4a07d4f6..189e2bbe 100644
--- a/src/shared/World.hpp
+++ b/src/shared/World.hpp
@@ -45,7 +45,6 @@ class EngineInterface;
class LV2Features;
class LV2URIMap;
class Store;
-class WorldImpl;
/** The "world" all Ingen modules may share.
*
@@ -61,16 +60,17 @@ public:
World(Raul::Configuration* conf, int& argc, char**& argv);
virtual ~World();
- virtual bool load(const char* name);
- virtual void unload_all();
+ virtual bool load_module(const char* name);
+ virtual void unload_modules();
- typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)(
- World* world, const std::string& engine_url);
+ typedef SharedPtr<Shared::EngineInterface> (*InterfaceFactory)(
+ World* world,
+ const std::string& engine_url);
virtual void add_interface_factory(const std::string& scheme,
InterfaceFactory factory);
- virtual SharedPtr<Ingen::Shared::EngineInterface> interface(
+ virtual SharedPtr<Shared::EngineInterface> interface(
const std::string& engine_url);
virtual bool run(const std::string& mime_type,
@@ -105,7 +105,9 @@ public:
virtual std::string jack_uuid();
private:
- WorldImpl* _impl;
+ class Pimpl;
+
+ Pimpl* _impl;
};
} // namespace Shared
diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp
index e177bc65..d533c883 100644
--- a/src/shared/runtime_paths.cpp
+++ b/src/shared/runtime_paths.cpp
@@ -99,7 +99,7 @@ module_path(const std::string& name, std::string dir)
#endif
}
- ret = Glib::Module::build_path(dir, name);
+ ret = Glib::Module::build_path(dir, string("ingen_") + name);
#ifdef __APPLE__
// MacPorts glib doesnt seem to do portable path building correctly...