diff options
Diffstat (limited to 'src/module')
-rw-r--r-- | src/module/World.cpp | 7 | ||||
-rw-r--r-- | src/module/World.hpp | 17 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/module/World.cpp b/src/module/World.cpp index 0bc87459..c4b1a88e 100644 --- a/src/module/World.cpp +++ b/src/module/World.cpp @@ -141,6 +141,13 @@ World::run(const std::string& mime_type, const std::string& filename) return i->second(this, filename.c_str()); } +void +World::add_interface_factory(const std::string& scheme, InterfaceFactory factory) +{ + interface_factories.insert(make_pair(scheme, factory)); +} + + } // namespace Shared } // namespace Ingen diff --git a/src/module/World.hpp b/src/module/World.hpp index e12ce5b2..59500c3e 100644 --- a/src/module/World.hpp +++ b/src/module/World.hpp @@ -44,13 +44,12 @@ class LV2Features; /** The "world" all Ingen modules may share. * - * This is required for shared access to things like Redland, so locking can - * take place centrally and the engine/gui using the same library won't - * explode horribly. + * All loaded components of Ingen, as well as things requiring shared access + * and/or locking (e.g. Redland, SLV2). * - * Hopefully at some point in the future it can allow some fun things like - * scripting bindings that play with all loaded components of - * The Ingen System(TM) and whatnot. + * Ingen modules are shared libraries which modify the World when loaded + * using World::load, e.g. loading the "ingen_serialisation" module will + * set World::serialiser and World::parser to valid objects. */ struct World { World() : conf(0) {} @@ -58,6 +57,10 @@ struct World { bool load(const char* name); void unload_all(); + typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)( + World* world, const std::string& engine_url); + + void add_interface_factory(const std::string& scheme, InterfaceFactory factory); SharedPtr<Ingen::Shared::EngineInterface> interface(const std::string& engine_url); bool run(const std::string& mime_type, const std::string& filename); @@ -80,8 +83,6 @@ private: typedef std::map< const std::string, boost::shared_ptr<Module> > Modules; Modules modules; - typedef SharedPtr<Ingen::Shared::EngineInterface> (*InterfaceFactory)( - World* world, const std::string& url); typedef std::map<const std::string, InterfaceFactory> InterfaceFactories; InterfaceFactories interface_factories; |