diff options
38 files changed, 219 insertions, 214 deletions
diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 72133e34..c212afcb 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -55,7 +55,7 @@ class ClientStore : public Shared::Store , public INGEN_TRACKABLE { public: ClientStore( - SharedPtr<Shared::URIs> uris, + Shared::URIs& uris, SharedPtr<Interface> engine = SharedPtr<Interface>(), SharedPtr<SigClientInterface> emitter = SharedPtr<SigClientInterface>()); @@ -72,7 +72,7 @@ public: SharedPtr<Plugins> plugins() { return _plugins; } void set_plugins(SharedPtr<Plugins> p) { _plugins = p; } - Shared::URIs& uris() { return *_uris.get(); } + Shared::URIs& uris() { return _uris; } void put(const Raul::URI& uri, const Resource::Properties& properties, @@ -130,7 +130,7 @@ private: bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - SharedPtr<Shared::URIs> _uris; + Shared::URIs& _uris; SharedPtr<Interface> _engine; SharedPtr<SigClientInterface> _emitter; diff --git a/ingen/shared/Builder.hpp b/ingen/shared/Builder.hpp index 55e2c30f..8a800ca6 100644 --- a/ingen/shared/Builder.hpp +++ b/ingen/shared/Builder.hpp @@ -17,8 +17,6 @@ #ifndef INGEN_SHARED_BUILDER_HPP #define INGEN_SHARED_BUILDER_HPP -#include "raul/SharedPtr.hpp" - namespace Ingen { class Interface; @@ -35,7 +33,7 @@ class URIs; class Builder { public: - Builder(SharedPtr<Shared::URIs> uris, Interface& interface); + Builder(Shared::URIs& uris, Interface& interface); virtual ~Builder() {} void build(SharedPtr<const GraphObject> object); @@ -44,8 +42,8 @@ public: private: void build_object(SharedPtr<const GraphObject> object); - SharedPtr<Shared::URIs> _uris; - Interface& _interface; + Shared::URIs& _uris; + Interface& _interface; }; } // namespace Shared diff --git a/ingen/shared/World.hpp b/ingen/shared/World.hpp index 0fe75953..9ea5b3cb 100644 --- a/ingen/shared/World.hpp +++ b/ingen/shared/World.hpp @@ -14,17 +14,14 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_MODULE_WORLD_HPP -#define INGEN_MODULE_WORLD_HPP +#ifndef INGEN_SHARED_WORLD_HPP +#define INGEN_SHARED_WORLD_HPP #include <string> -#include "ingen/shared/Configuration.hpp" -#include "ingen/shared/Forge.hpp" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "raul/Atom.hpp" -#include "raul/SharedPtr.hpp" #include "raul/Noncopyable.hpp" +#include "raul/SharedPtr.hpp" typedef struct LilvWorldImpl LilvWorld; @@ -33,31 +30,46 @@ namespace Sord { class World; } namespace Ingen { class EngineBase; +class Forge; class Interface; namespace Serialisation { -class Serialiser; class Parser; +class Serialiser; } namespace Shared { +class Configuration; class LV2Features; -class URIs; -class URIMap; class Store; +class URIMap; +class URIs; -/** The "world" all Ingen modules may share. +/** The "world" all Ingen modules share. + * + * This is the root to which all components of Ingen are connected. It + * contains all necessary shared data (including the world for libraries like + * Sord and Lilv) and holds references to components. * - * All loaded components of Ingen, as well as things requiring shared access - * and/or locking (e.g. Sord, Lilv). + * Most functionality in Ingen is implemented in dynamically loaded modules, + * which are loaded using this interface. When loaded, those modules add + * facilities to the World which can then be used throughout the code. For + * example loading the "ingen_serialisation" module will set World::serialiser + * and World::parser to valid objects. * - * 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. + * The world is used in any process which uses the Ingen as a library, both + * client and server (e.g. the world may not actually contain an Engine, since + * it maybe running in another process or even on a different machine). */ class World : public Raul::Noncopyable { public: + /** Construct a new Ingen world. + * @param argc Argument count (as in C main()) + * @param argv Argument vector (as in C main()) + * @param map LV2 URID map implementation, or NULL to use internal. + * @param unmap LV2 URID unmap implementation, or NULL to use internal. + */ World(int& argc, char**& argv, LV2_URID_Map* map, @@ -65,64 +77,75 @@ public: virtual ~World(); + /** Load an Ingen module by name (e.g. "server", "gui", etc.) + * @return True on success. + */ virtual bool load_module(const char* name); + + /** Run a loaded module (modules that "run" only, e.g. gui). + * @return True on success. + */ virtual bool run_module(const char* name); + /** Unload all loaded Ingen modules. */ virtual void unload_modules(); + /** A function to create a new remote Interface. */ typedef SharedPtr<Interface> (*InterfaceFactory)( - World* world, - const std::string& engine_url, - SharedPtr<Interface> respondee); + World* world, + const std::string& engine_url, + SharedPtr<Interface> respondee); + /** Register an InterfaceFactory (for module implementations). */ virtual void add_interface_factory(const std::string& scheme, InterfaceFactory factory); + /** Return a new Interface to control the server at @p engine_url. + * @param respondee The Interface that will receive responses to commands + * and broadcasts, if applicable. + */ virtual SharedPtr<Interface> new_interface( const std::string& engine_url, SharedPtr<Interface> respondee); + /** Run a script. */ virtual bool run(const std::string& mime_type, const std::string& filename); virtual void set_engine(SharedPtr<EngineBase> e); virtual void set_interface(SharedPtr<Interface> e); - virtual void set_serialiser(SharedPtr<Serialisation::Serialiser> s); virtual void set_parser(SharedPtr<Serialisation::Parser> p); + virtual void set_serialiser(SharedPtr<Serialisation::Serialiser> s); virtual void set_store(SharedPtr<Store> s); virtual SharedPtr<EngineBase> engine(); virtual SharedPtr<Interface> interface(); - virtual SharedPtr<Serialisation::Serialiser> serialiser(); virtual SharedPtr<Serialisation::Parser> parser(); + virtual SharedPtr<Serialisation::Serialiser> serialiser(); virtual SharedPtr<Store> store(); - virtual Sord::World* rdf_world(); - - virtual SharedPtr<URIs> uris(); - virtual SharedPtr<URIMap> uri_map(); - - virtual int& argc(); - virtual char**& argv(); - + virtual int& argc(); + virtual char**& argv(); virtual Configuration& conf(); - virtual Ingen::Forge& forge(); - - virtual LV2Features* lv2_features(); + virtual Sord::World* rdf_world(); + virtual LilvWorld* lilv_world(); - virtual LilvWorld* lilv_world(); + virtual LV2Features& lv2_features(); + virtual Ingen::Forge& forge(); + virtual URIMap& uri_map(); + virtual URIs& uris(); virtual void set_jack_uuid(const std::string& uuid); virtual std::string jack_uuid(); private: - class Pimpl; + class Impl; - Pimpl* _impl; + Impl* _impl; }; -} // namespace Shared -} // namespace Ingen +} // namespace Shared +} // namespace Ingen -#endif // INGEN_MODULE_WORLD_HPP +#endif // INGEN_SHARED_WORLD_HPP diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index a1da01c4..042cba57 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -37,7 +37,7 @@ using namespace Shared; namespace Client { -ClientStore::ClientStore(SharedPtr<Shared::URIs> uris, +ClientStore::ClientStore(Shared::URIs& uris, SharedPtr<Interface> engine, SharedPtr<SigClientInterface> emitter) : _uris(uris) @@ -273,7 +273,7 @@ ClientStore::put(const Raul::URI& uri, #ifdef INGEN_CLIENT_STORE_DUMP LOG(Raul::info) << "PUT " << uri << " {" << endl; for (Iterator i = properties.begin(); i != properties.end(); ++i) - LOG(Raul::info) << '\t' << i->first << " = " << _uris->forge.str(i->second) + LOG(Raul::info) << '\t' << i->first << " = " << _uris.forge.str(i->second) << " :: " << i->second.type() << endl; LOG(Raul::info) << "}" << endl; #endif @@ -283,8 +283,8 @@ ClientStore::put(const Raul::URI& uri, is_patch, is_node, is_port, is_output); // Check if uri is a plugin - Iterator t = properties.find(_uris->rdf_type); - if (t != properties.end() && t->second.type() == _uris->forge.URI) { + Iterator t = properties.find(_uris.rdf_type); + if (t != properties.end() && t->second.type() == _uris.forge.URI) { const Raul::Atom& type = t->second; const Raul::URI& type_uri = type.get_uri(); const Plugin::Type plugin_type = Plugin::type_from_uri(type_uri); @@ -320,16 +320,16 @@ ClientStore::put(const Raul::URI& uri, model->set_properties(properties); add_object(model); } else if (is_node) { - const Iterator p = properties.find(_uris->ingen_prototype); + const Iterator p = properties.find(_uris.ingen_prototype); SharedPtr<PluginModel> plug; - if (p->second.is_valid() && p->second.type() == _uris->forge.URI) { + if (p->second.is_valid() && p->second.type() == _uris.forge.URI) { if (!(plug = _plugin(p->second.get_uri()))) { LOG(Raul::warn)(Raul::fmt("Unable to find plugin <%1%>\n") % p->second.get_uri()); plug = SharedPtr<PluginModel>( new PluginModel(uris(), p->second.get_uri(), - _uris->ingen_nil, + _uris.ingen_nil, Resource::Properties())); add_plugin(plug); } @@ -344,8 +344,8 @@ ClientStore::put(const Raul::URI& uri, PortModel::Direction pdir = (is_output) ? PortModel::OUTPUT : PortModel::INPUT; - const Iterator i = properties.find(_uris->lv2_index); - if (i != properties.end() && i->second.type() == _uris->forge.Int) { + const Iterator i = properties.find(_uris.lv2_index); + if (i != properties.end() && i->second.type() == _uris.forge.Int) { const uint32_t index = i->second.get_int32(); SharedPtr<PortModel> p( new PortModel(uris(), path, index, pdir)); @@ -370,11 +370,11 @@ ClientStore::delta(const Raul::URI& uri, LOG(Raul::info) << "DELTA " << uri << " {" << endl; for (iterator i = remove.begin(); i != remove.end(); ++i) LOG(Raul::info) << " - " << i->first - << " = " << _uris->forge.str(i->second) + << " = " << _uris.forge.str(i->second) << " :: " << i->second.type() << endl; for (iterator i = add.begin(); i != add.end(); ++i) LOG(Raul::info) << " + " << i->first - << " = " << _uris->forge.str(i->second) + << " = " << _uris.forge.str(i->second) << " :: " << i->second.type() << endl; LOG(Raul::info) << "}" << endl; #endif @@ -400,9 +400,9 @@ ClientStore::set_property(const Raul::URI& subject_uri, const Raul::URI& predicate, const Raul::Atom& value) { - if (subject_uri == _uris->ingen_engine) { + if (subject_uri == _uris.ingen_engine) { LOG(Raul::info)(Raul::fmt("Engine property <%1%> = %2%\n") - % predicate % _uris->forge.str(value)); + % predicate % _uris.forge.str(value)); return; } SharedPtr<Resource> subject = _resource(subject_uri); diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 5cdf5ab2..0c597490 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -48,7 +48,7 @@ lv2_ui_write(SuilController controller, SharedPtr<const PortModel> port = ports[port_index]; - const Shared::URIs& uris = *ui->world()->uris().get(); + const Shared::URIs& uris = ui->world()->uris(); // float (special case, always 0) if (format == 0) { @@ -125,7 +125,7 @@ PluginUI::create(Ingen::Shared::World* world, } SharedPtr<PluginUI> ret(new PluginUI(world, node, lilv_ui_get_uri(ui))); - ret->_features = world->lv2_features()->lv2_features( + ret->_features = world->lv2_features().lv2_features( world, const_cast<NodeModel*>(node.get())); SuilInstance* instance = suil_instance_new( diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 64eed0ff..3b9b530c 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -24,13 +24,13 @@ #include <gtkmm.h> +#include "ingen/Status.hpp" +#include "ingen/shared/World.hpp" +#include "raul/Atom.hpp" #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" #include "raul/URI.hpp" -#include "ingen/Status.hpp" -#include "ingen/shared/World.hpp" - namespace Ingen { class Interface; class Port; @@ -117,7 +117,7 @@ public: void run(); inline Ingen::Shared::World* world() const { return _world; } - inline Ingen::Shared::URIs& uris() const { return *_world->uris(); } + inline Ingen::Shared::URIs& uris() const { return _world->uris(); } protected: diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index fb32a9ac..cbb98268 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -144,7 +144,7 @@ Port::on_value_changed(GVariant* value) if (atom != model()->value()) { Ingen::Shared::World* const world = _app.world(); _app.interface()->set_property(model()->path(), - world->uris()->ingen_value, + world->uris().ingen_value, atom); } @@ -166,7 +166,7 @@ void Port::on_scale_point_activated(float f) { _app.interface()->set_property(model()->path(), - _app.world()->uris()->ingen_value, + _app.world()->uris().ingen_value, _app.world()->forge().make(f)); } diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 6afe7f68..c785d857 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -96,7 +96,7 @@ instantiate(const LV2UI_Descriptor* descriptor, ui->world = new Ingen::Shared::World( ui->argc, ui->argv, map, unmap); - ui->forge = new Ingen::Forge(*ui->world->uri_map().get()); + ui->forge = new Ingen::Forge(ui->world->uri_map()); if (!ui->world->load_module("client")) { delete ui; @@ -104,13 +104,12 @@ instantiate(const LV2UI_Descriptor* descriptor, } ui->sink = new IngenLV2AtomSink( - *ui->world->uris().get(), write_function, controller); + ui->world->uris(), write_function, controller); // Set up an engine interface that writes LV2 atoms ui->engine = SharedPtr<Ingen::Interface>( - new Ingen::Shared::AtomWriter(*ui->world->uri_map().get(), - *ui->world->uris().get(), - *ui->sink)); + new Ingen::Shared::AtomWriter( + ui->world->uri_map(), ui->world->uris(), *ui->sink)); ui->world->set_interface(ui->engine); @@ -121,8 +120,8 @@ instantiate(const LV2UI_Descriptor* descriptor, ui->app->attach(ui->client); ui->reader = SharedPtr<Ingen::Shared::AtomReader>( - new Ingen::Shared::AtomReader(*ui->world->uri_map().get(), - *ui->world->uris().get(), + new Ingen::Shared::AtomReader(ui->world->uri_map(), + ui->world->uris(), ui->world->forge(), *ui->client.get())); diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 96afc708..5f351bd3 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -99,8 +99,8 @@ get_properties(Ingen::Shared::World* world, const Sord::Node& subject) { SerdChunk out = { NULL, 0 }; - LV2_URID_Map* map = &world->uri_map()->urid_map_feature()->urid_map; - LV2_URID_Unmap* unmap = &world->uri_map()->urid_unmap_feature()->urid_unmap; + LV2_URID_Map* map = &world->uri_map().urid_map_feature()->urid_map; + LV2_URID_Unmap* unmap = &world->uri_map().urid_unmap_feature()->urid_unmap; Sratom* sratom = sratom_new(map); LV2_Atom_Forge forge; @@ -140,7 +140,7 @@ get_port(Ingen::Shared::World* world, const Raul::Path& parent, PortRecord& record) { - const URIs& uris = *world->uris().get(); + const URIs& uris = world->uris(); // Get all properties Resource::Properties props = get_properties(world, model, subject); @@ -222,7 +222,7 @@ parse_node(Ingen::Shared::World* world, const Raul::Path& path, boost::optional<GraphObject::Properties> data) { - const URIs& uris = *world->uris().get(); + const URIs& uris = world->uris(); Sord::URI ingen_prototype(*world->rdf_world(), NS_INGEN "prototype"); @@ -286,7 +286,7 @@ parse_patch(Ingen::Shared::World* world, const Sord::URI ingen_polyphony(*world->rdf_world(), NS_INGEN "polyphony"); const Sord::URI lv2_port(*world->rdf_world(), LV2_CORE__port); - const URIs& uris = *world->uris().get(); + const URIs& uris = world->uris(); const Sord::Node& patch = subject_node; uint32_t patch_poly = 0; diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 792d7f92..2d8f9d70 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -350,7 +350,7 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, Sord::URI(world, LV2_UI__ui), Sord::URI(world, "http://drobilla.net/ns/ingen#PatchUIGtk2")); - const URIs& uris = *_world.uris().get(); + const URIs& uris = _world.uris(); // Always write a symbol (required by Ingen) string symbol; @@ -544,8 +544,8 @@ Serialiser::Impl::serialise_properties(const GraphObject* o, { const GraphObject::Properties props = o->properties(context); - LV2_URID_Map* map = &_world.uri_map()->urid_map_feature()->urid_map; - LV2_URID_Unmap* unmap = &_world.uri_map()->urid_unmap_feature()->urid_unmap; + LV2_URID_Map* map = &_world.uri_map().urid_map_feature()->urid_map; + LV2_URID_Unmap* unmap = &_world.uri_map().urid_unmap_feature()->urid_unmap; Sratom* sratom = sratom_new(map); SerdNode base = serd_node_from_string(SERD_URI, (const uint8_t*)_base_uri.c_str()); diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index a89d19df..f8a9f499 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -118,7 +118,7 @@ Buffer::port_data(PortType port_type, SampleCount offset) } else { Raul::warn << "Audio data requested from non-audio buffer " << this << " :: " << _atom->type << " - " - << _factory.engine().world()->uri_map()->unmap_uri(_atom->type) + << _factory.engine().world()->uri_map().unmap_uri(_atom->type) << std::endl; assert(false); return NULL; diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 535da6b5..f43fa7a4 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -30,13 +30,11 @@ namespace Server { static const size_t EVENT_BYTES_PER_FRAME = 4; // FIXME -BufferFactory::BufferFactory(Engine& engine, - SharedPtr<Ingen::Shared::URIs> uris) +BufferFactory::BufferFactory(Engine& engine, Shared::URIs& uris) : _engine(engine) , _uris(uris) , _silent_buffer(NULL) { - assert(_uris); } BufferFactory::~BufferFactory() @@ -66,7 +64,7 @@ BufferFactory::free_list(Buffer* head) void BufferFactory::set_block_length(SampleCount block_length) { - _silent_buffer = create(_uris->atom_Sound, audio_buffer_size(block_length)); + _silent_buffer = create(_uris.atom_Sound, audio_buffer_size(block_length)); } uint32_t @@ -78,11 +76,11 @@ BufferFactory::audio_buffer_size(SampleCount nframes) uint32_t BufferFactory::default_buffer_size(LV2_URID type) { - if (type == _uris->atom_Float) { + if (type == _uris.atom_Float) { return sizeof(LV2_Atom_Float); - } else if (type == _uris->atom_Sound) { + } else if (type == _uris.atom_Sound) { return audio_buffer_size(_engine.driver()->block_length()); - } else if (type == _uris->atom_Sequence) { + } else if (type == _uris.atom_Sequence) { return _engine.driver()->block_length() * EVENT_BYTES_PER_FRAME; } else { return 0; @@ -136,11 +134,11 @@ BufferFactory::create(LV2_URID type, uint32_t capacity) capacity = default_buffer_size(type); } - if (type == _uris->atom_Float) { + if (type == _uris.atom_Float) { assert(capacity >= sizeof(LV2_Atom_Float)); buffer = new AudioBuffer(*this, type, capacity); - } else if (type == _uris->atom_Sound) { - assert(capacity >= default_buffer_size(_uris->atom_Sound)); + } else if (type == _uris.atom_Sound) { + assert(capacity >= default_buffer_size(_uris.atom_Sound)); buffer = new AudioBuffer(*this, type, capacity); } else { buffer = new Buffer(*this, type, capacity); diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 1ec11ca1..04b9bf9d 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -46,9 +46,7 @@ class Engine; class BufferFactory { public: - BufferFactory(Engine& engine, - SharedPtr<Ingen::Shared::URIs> uris); - + BufferFactory(Engine& engine, Shared::URIs& uris); ~BufferFactory(); static uint32_t audio_buffer_size(SampleCount nframes); @@ -60,9 +58,9 @@ public: void set_block_length(SampleCount block_length); - Ingen::Forge& forge(); - Ingen::Shared::URIs& uris() { return *_uris.get(); } - Engine& engine() { return _engine; } + Forge& forge(); + Shared::URIs& uris() { return _uris; } + Engine& engine() { return _engine; } private: friend class Buffer; @@ -71,9 +69,9 @@ private: BufferRef create(LV2_URID type, uint32_t capacity=0); inline Raul::AtomicPtr<Buffer>& free_list(LV2_URID type) { - if (type == _uris->atom_Float) { + if (type == _uris.atom_Float) { return _free_control; - } else if (type == _uris->atom_Sound) { + } else if (type == _uris.atom_Sound) { return _free_audio; } else { return _free_object; @@ -86,9 +84,9 @@ private: Raul::AtomicPtr<Buffer> _free_control; Raul::AtomicPtr<Buffer> _free_object; - Glib::Mutex _mutex; - Engine& _engine; - SharedPtr<Ingen::Shared::URIs> _uris; + Glib::Mutex _mutex; + Engine& _engine; + Shared::URIs& _uris; BufferRef _silent_buffer; }; diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 1cf8e969..2ff5259b 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -42,7 +42,7 @@ ControlBindings::ControlBindings(Engine& engine) , _learn_port(NULL) , _bindings(new Bindings()) , _feedback(new Buffer(*_engine.buffer_factory(), - engine.world()->uris()->atom_Sequence, + engine.world()->uris().atom_Sequence, 4096)) // FIXME: capacity? { } @@ -56,7 +56,7 @@ ControlBindings::Key ControlBindings::port_binding(PortImpl* port) const { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); const Raul::Atom& binding = port->get_property(uris.ingen_controlBinding); return binding_key(binding); } @@ -64,7 +64,7 @@ ControlBindings::port_binding(PortImpl* port) const ControlBindings::Key ControlBindings::binding_key(const Raul::Atom& binding) const { - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); Key key; if (binding.type() == _engine.world()->forge().Dict) { const Raul::Atom::DictValue& dict = binding.get_dict(); @@ -126,7 +126,7 @@ ControlBindings::port_value_changed(ProcessContext& context, const Raul::Atom& value_atom) { Ingen::Shared::World* world = context.engine().world(); - const Ingen::Shared::URIs& uris = *world->uris().get(); + const Ingen::Shared::URIs& uris = world->uris(); if (key) { int16_t value = port_value_to_control( port, key.type, value_atom, port->minimum(), port->maximum()); @@ -274,7 +274,7 @@ ControlBindings::set_port_value(ProcessContext& context, bool ControlBindings::bind(ProcessContext& context, Key key) { - const Ingen::Shared::URIs& uris = *context.engine().world()->uris().get(); + const Ingen::Shared::URIs& uris = context.engine().world()->uris(); assert(_learn_port); if (key.type == MIDI_NOTE) { bool toggled = _learn_port->has_property(uris.lv2_portProperty, uris.lv2_toggled); @@ -345,7 +345,7 @@ ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) _feedback->clear(); Ingen::Shared::World* world = context.engine().world(); - const Ingen::Shared::URIs& uris = *world->uris().get(); + const Ingen::Shared::URIs& uris = world->uris(); if (!_learn_port && bindings->empty()) { // Don't bother reading input diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 5652db27..8029e607 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -19,6 +19,7 @@ #include <unistd.h> #include "events/CreatePort.hpp" +#include "ingen/shared/Configuration.hpp" #include "ingen/shared/LV2Features.hpp" #include "ingen/shared/Store.hpp" #include "ingen/shared/URIs.hpp" @@ -148,7 +149,7 @@ Engine::activate() _message_context->Thread::start(); - const Ingen::Shared::URIs& uris = *world()->uris().get(); + const Ingen::Shared::URIs& uris = world()->uris(); Ingen::Forge& forge = world()->forge(); // Create root patch diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 7286cc9e..8dbd4425 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -148,7 +148,7 @@ EventWriter::set_property(const Raul::URI& uri, } } else { Resource::Properties remove; - remove.insert(make_pair(predicate, _engine.world()->uris()->wildcard)); + remove.insert(make_pair(predicate, _engine.world()->uris().wildcard)); Resource::Properties add; add.insert(make_pair(predicate, value)); _engine.enqueue_event( diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 8803c0c6..da2d434a 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -26,6 +26,9 @@ #include "ingen/serialisation/Serialiser.hpp" #endif +#include "ingen/shared/Configuration.hpp" +#include "ingen/shared/LV2Features.hpp" +#include "ingen/shared/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/List.hpp" #include "raul/log.hpp" @@ -43,8 +46,6 @@ #include "PostProcessor.hpp" #include "ProcessSlave.hpp" #include "ThreadManager.hpp" -#include "ingen/shared/LV2Features.hpp" -#include "ingen/shared/World.hpp" #include "util.hpp" #define LOG(s) (s("[JackDriver] ")) @@ -184,7 +185,7 @@ JackDriver::JackDriver(Engine& engine) , _sample_rate(0) , _is_activated(false) { - _midi_event_type = _engine.world()->uris()->midi_MidiEvent; + _midi_event_type = _engine.world()->uris().midi_MidiEvent; } JackDriver::~JackDriver() diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp index 9180b421..2aa68271 100644 --- a/src/server/LV2Info.cpp +++ b/src/server/LV2Info.cpp @@ -42,9 +42,9 @@ LV2Info::LV2Info(Ingen::Shared::World* world) { assert(world); - world->lv2_features()->add_feature( + world->lv2_features().add_feature( SharedPtr<Shared::LV2Features::Feature>(new ResizeFeature())); - world->lv2_features()->add_feature( + world->lv2_features().add_feature( SharedPtr<Shared::LV2Features::Feature>(new RequestRunFeature())); } diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 68a771e8..f1bf2d3d 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -150,8 +150,7 @@ LV2Node::instantiate(BufferFactory& bufs) _ports = new Raul::Array<PortImpl*>(num_ports, NULL); _instances = new Instances(_polyphony, SharedPtr<void>()); - _features = info->world().lv2_features()->lv2_features(&info->world(), - this); + _features = info->world().lv2_features().lv2_features(&info->world(), this); uint32_t port_buffer_size = 0; LilvNode* work_schedule = lilv_new_uri(info->lv2_world(), @@ -247,7 +246,7 @@ LV2Node::instantiate(BufferFactory& bufs) if (lilv_node_is_uri(type)) { port->add_property(uris.atom_bufferType, forge.alloc_uri(lilv_node_as_uri(type))); - buffer_type = bufs.engine().world()->uri_map()->map_uri( + buffer_type = bufs.engine().world()->uri_map().map_uri( lilv_node_as_uri(type)); } } diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 93e2d1d6..20f68c17 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -34,7 +34,7 @@ namespace Ingen { namespace Server { LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri) - : PluginImpl(*lv2_info->world().uris().get(), Plugin::LV2, uri) + : PluginImpl(lv2_info->world().uris(), Plugin::LV2, uri) , _lilv_plugin(NULL) , _lv2_info(lv2_info) { diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index 231a7db1..e64257be 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -99,7 +99,7 @@ NodeFactory::load_plugins() void NodeFactory::load_internal_plugins() { - Ingen::Shared::URIs& uris = *_world->uris().get(); + Ingen::Shared::URIs& uris = _world->uris(); InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); _plugins.insert(make_pair(controller_plug->uri(), controller_plug)); diff --git a/src/server/Notification.cpp b/src/server/Notification.cpp index 05570a0f..b4c55da1 100644 --- a/src/server/Notification.cpp +++ b/src/server/Notification.cpp @@ -28,7 +28,7 @@ void Notification::post_process(Notification& note, Engine& engine) { - const Ingen::Shared::URIs& uris = *engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = engine.world()->uris(); Ingen::Forge& forge = engine.world()->forge(); switch (note.type) { case PORT_VALUE: diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index b17d0475..f24ab574 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -44,8 +44,8 @@ PatchImpl::PatchImpl(Engine& engine, PatchImpl* parent, SampleRate srate, uint32_t internal_poly) - : NodeImpl(new PatchPlugin(*engine.world()->uris().get(), - engine.world()->uris()->ingen_Patch.c_str(), + : NodeImpl(new PatchPlugin(engine.world()->uris(), + engine.world()->uris().ingen_Patch.c_str(), "patch", "Ingen Patch"), symbol, poly, parent, srate) , _engine(engine) diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 9a9df50e..2b9c6766 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -55,7 +55,7 @@ CreateNode::CreateNode(Engine& engine, , _properties(properties) { const Resource::Properties::const_iterator p = properties.find( - engine.world()->uris()->ingen_polyphonic); + engine.world()->uris().ingen_polyphonic); if (p != properties.end() && p->second.type() == engine.world()->forge().Bool && p->second.get_bool()) _polyphonic = true; diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index d23c4506..22c4a817 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -76,7 +76,7 @@ CreatePatch::pre_process() if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) poly = _poly; - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); _patch = new PatchImpl(_engine, path.symbol(), poly, _parent, _engine.driver()->sample_rate(), _poly); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 448f7768..872b79c4 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -55,7 +55,7 @@ CreatePort::CreatePort(Engine& engine, , _properties(properties) , _is_output(is_output) { - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); typedef Resource::Properties::const_iterator Iterator; typedef std::pair<Iterator, Iterator> Range; @@ -77,7 +77,7 @@ CreatePort::CreatePort(Engine& engine, const Range buffer_types = properties.equal_range(uris.atom_bufferType); for (Iterator i = buffer_types.first; i != buffer_types.second; ++i) { if (i->second.type() == _engine.world()->forge().URI) { - _buffer_type = _engine.world()->uri_map()->map_uri(i->second.get_uri()); + _buffer_type = _engine.world()->uri_map().map_uri(i->second.get_uri()); } } @@ -96,7 +96,7 @@ CreatePort::pre_process() _patch = _engine.engine_store()->find_patch(_path.parent()); - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); if (_patch != NULL) { assert(_patch->path() == _path.parent()); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 0f1a16d7..503726a3 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -69,7 +69,7 @@ Get::post_process() respond(SUCCESS); // TODO: Keep a proper RDF model of the engine if (_request_client) { - Shared::URIs& uris = *_engine.world()->uris().get(); + Shared::URIs& uris = _engine.world()->uris(); _request_client->set_property( uris.ingen_engine, uris.ingen_sampleRate, diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 38e7490c..5d447895 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -79,13 +79,13 @@ SetMetadata::SetMetadata(Engine& engine, for (iterator i = properties.begin(); i != properties.end(); ++i) { LOG(info) << " + " << i->first << " = " << engine.world()->forge().str(i->second) - << " :: " << engine.world()->uri_map()->unmap_uri(i->second.type()) << endl; + << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) << endl; } typedef Resource::Properties::const_iterator iterator; for (iterator i = remove.begin(); i != remove.end(); ++i) { LOG(info) << " - " << i->first << " = " << engine.world()->forge().str(i->second) - << " :: " << engine.world()->uri_map()->unmap_uri(i->second.type()) << endl; + << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) << endl; } LOG(info) << "}" << endl; */ @@ -118,7 +118,7 @@ SetMetadata::pre_process() return; } - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); if (is_graph_object && !_object) { Raul::Path path(_subject.str()); @@ -272,7 +272,7 @@ SetMetadata::execute(ProcessContext& context) return; } - const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = _engine.world()->uris(); if (_create_event) { _create_event->execute(context); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 6305ff1e..db3a72e4 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -91,7 +91,7 @@ SetPortValue::pre_process() if (_port) { _port->set_value(_value); - _port->set_property(_engine.world()->uris()->ingen_value, _value); + _port->set_property(_engine.world()->uris().ingen_value, _value); } _binding = _engine.control_bindings()->port_binding(_port); @@ -119,7 +119,7 @@ SetPortValue::apply(Context& context) if (_status == SUCCESS && !_port) _port = _engine.engine_store()->find_port(_port_path); - Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + Ingen::Shared::URIs& uris = _engine.world()->uris(); if (!_port) { if (_status == SUCCESS) @@ -153,7 +153,7 @@ SetPortValue::post_process() if (!_status) { _engine.broadcaster()->set_property( _port_path, - _engine.world()->uris()->ingen_value, + _engine.world()->uris().ingen_value, _value); } } diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index a1f068fe..928996e5 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -14,8 +14,10 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "ingen/shared/Configuration.hpp" #include "ingen/shared/Module.hpp" #include "ingen/shared/World.hpp" +#include "raul/Configuration.hpp" #include "raul/log.hpp" #include "JackDriver.hpp" diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 3d3a367c..d6602173 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -140,12 +140,12 @@ private: public: LV2Driver(Engine& engine, SampleCount buffer_size, SampleCount sample_rate) : _context(engine) - , _reader(*engine.world()->uri_map().get(), - *engine.world()->uris().get(), + , _reader(engine.world()->uri_map(), + engine.world()->uris(), engine.world()->forge(), *engine.world()->interface().get()) - , _writer(*engine.world()->uri_map().get(), - *engine.world()->uris().get(), + , _writer(engine.world()->uri_map(), + engine.world()->uris(), *this) , _to_ui(buffer_size * sizeof(float)) // FIXME: size , _root_patch(NULL) @@ -240,7 +240,7 @@ public: const uint32_t capacity = seq->atom.size; // Initialise output port buffer to an empty Sequence - seq->atom.type = _context.engine().world()->uris()->atom_Sequence; + seq->atom.type = _context.engine().world()->uris().atom_Sequence; seq->atom.size = sizeof(LV2_Atom_Sequence_Body); const uint32_t read_space = _to_ui.read_space(); diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index 68d7ab08..c79181ff 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -30,7 +30,7 @@ using namespace std; namespace Ingen { namespace Shared { -Builder::Builder(SharedPtr<Shared::URIs> uris, Interface& interface) +Builder::Builder(Shared::URIs& uris, Interface& interface) : _uris(uris) , _interface(interface) { @@ -39,15 +39,14 @@ Builder::Builder(SharedPtr<Shared::URIs> uris, Interface& interface) void Builder::build(SharedPtr<const GraphObject> object) { - const URIs& uris = *_uris.get(); SharedPtr<const Patch> patch = PtrCast<const Patch>(object); if (patch) { if (!object->path().is_root()) { Resource::Properties props; - props.insert(make_pair(uris.rdf_type, - _uris->forge.alloc_uri(uris.ingen_Patch.str()))); - props.insert(make_pair(uris.ingen_polyphony, - _uris->forge.make(int32_t(patch->internal_poly())))); + props.insert(make_pair(_uris.rdf_type, + _uris.forge.alloc_uri(_uris.ingen_Patch.str()))); + props.insert(make_pair(_uris.ingen_polyphony, + _uris.forge.make(int32_t(patch->internal_poly())))); _interface.put(object->path(), props); } @@ -62,9 +61,9 @@ Builder::build(SharedPtr<const GraphObject> object) SharedPtr<const Node> node = PtrCast<const Node>(object); if (node) { Resource::Properties props; - props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); - props.insert(make_pair(uris.ingen_prototype, - _uris->forge.alloc_uri(node->plugin()->uri().str()))); + props.insert(make_pair(_uris.rdf_type, _uris.ingen_Node)); + props.insert(make_pair(_uris.ingen_prototype, + _uris.forge.alloc_uri(node->plugin()->uri().str()))); _interface.put(node->path(), props); build_object(object); return; diff --git a/src/shared/World.cpp b/src/shared/World.cpp index 1012a157..9873246f 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -14,25 +14,23 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include <boost/utility.hpp> - -#include <glibmm/module.h> -#include <glibmm/miscutils.h> #include <glibmm/fileutils.h> +#include <glibmm/miscutils.h> +#include <glibmm/module.h> -#include "lilv/lilv.h" -#include "raul/log.hpp" -#include "raul/Atom.hpp" -#include "sord/sordmm.hpp" - -#include "ingen/Interface.hpp" #include "ingen/EngineBase.hpp" -#include "ingen/shared/Module.hpp" -#include "ingen/shared/World.hpp" -#include "ingen/shared/runtime_paths.hpp" +#include "ingen/Interface.hpp" +#include "ingen/shared/Configuration.hpp" #include "ingen/shared/LV2Features.hpp" +#include "ingen/shared/Module.hpp" #include "ingen/shared/URIMap.hpp" #include "ingen/shared/URIs.hpp" +#include "ingen/shared/World.hpp" +#include "ingen/shared/runtime_paths.hpp" +#include "lilv/lilv.h" +#include "raul/Atom.hpp" +#include "raul/log.hpp" +#include "sord/sordmm.hpp" #define LOG(s) (s("[World] ")) @@ -96,19 +94,19 @@ ingen_load_module(const string& name) } } -class World::Pimpl { +class World::Impl { public: - Pimpl(int& a_argc, - char**& a_argv, - LV2_URID_Map* map, - LV2_URID_Unmap* unmap) + Impl(int& a_argc, + char**& a_argv, + LV2_URID_Map* map, + LV2_URID_Unmap* unmap) : argc(a_argc) , argv(a_argv) , lv2_features(NULL) , rdf_world(new Sord::World()) - , uri_map(new Ingen::Shared::URIMap(map, unmap)) , forge(new Ingen::Forge(*uri_map)) - , uris(new Shared::URIs(*forge, uri_map.get())) + , uri_map(new Ingen::Shared::URIMap(map, unmap)) + , uris(new Shared::URIs(*forge, uri_map)) , lilv_world(lilv_world_new()) { conf.parse(argc, argv); @@ -130,7 +128,7 @@ public: rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); } - virtual ~Pimpl() + virtual ~Impl() { serialiser.reset(); parser.reset(); @@ -143,17 +141,12 @@ public: script_runners.clear(); lilv_world_free(lilv_world); - lilv_world = NULL; delete rdf_world; - rdf_world = NULL; - delete lv2_features; - lv2_features = NULL; - delete forge; - - uris.reset(); + delete uri_map; + delete uris; } typedef std::map< const std::string, SharedPtr<Module> > Modules; @@ -171,9 +164,9 @@ public: Shared::Configuration conf; LV2Features* lv2_features; Sord::World* rdf_world; - SharedPtr<URIMap> uri_map; Ingen::Forge* forge; - SharedPtr<URIs> uris; + URIMap* uri_map; + URIs* uris; SharedPtr<Interface> interface; SharedPtr<EngineBase> engine; SharedPtr<Serialisation::Serialiser> serialiser; @@ -187,7 +180,7 @@ World::World(int& argc, char**& argv, LV2_URID_Map* map, LV2_URID_Unmap* unmap) - : _impl(new Pimpl(argc, argv, map, unmap)) + : _impl(new Impl(argc, argv, map, unmap)) { } @@ -199,33 +192,32 @@ World::~World() void World::set_engine(SharedPtr<EngineBase> e) { _impl->engine = e; } void World::set_interface(SharedPtr<Interface> i) { _impl->interface = i; } -void World::set_serialiser(SharedPtr<Serialisation::Serialiser> s) { _impl->serialiser = s; } void World::set_parser(SharedPtr<Serialisation::Parser> p) { _impl->parser = p; } +void World::set_serialiser(SharedPtr<Serialisation::Serialiser> s) { _impl->serialiser = s; } void World::set_store(SharedPtr<Store> s) { _impl->store = s; } -int& World::argc() { return _impl->argc; } -char**& World::argv() { return _impl->argv; } SharedPtr<EngineBase> World::engine() { return _impl->engine; } SharedPtr<Interface> World::interface() { return _impl->interface; } -SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->serialiser; } SharedPtr<Serialisation::Parser> World::parser() { return _impl->parser; } +SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->serialiser; } SharedPtr<Store> World::store() { return _impl->store; } -Shared::Configuration& World::conf() { return _impl->conf; } -Ingen::Forge& World::forge() { return *_impl->forge; } -LV2Features* World::lv2_features() { return _impl->lv2_features; } -LilvWorld* World::lilv_world() { return _impl->lilv_world; } -Sord::World* World::rdf_world() { return _impl->rdf_world; } -SharedPtr<URIs> World::uris() { return _impl->uris; } -SharedPtr<URIMap> World::uri_map() { return _impl->uri_map; } +int& World::argc() { return _impl->argc; } +char**& World::argv() { return _impl->argv; } +Shared::Configuration& World::conf() { return _impl->conf; } + +Sord::World* World::rdf_world() { return _impl->rdf_world; } +LilvWorld* World::lilv_world() { return _impl->lilv_world; } + +LV2Features& World::lv2_features() { return *_impl->lv2_features; } +Ingen::Forge& World::forge() { return *_impl->forge; } +URIs& World::uris() { return *_impl->uris; } +URIMap& World::uri_map() { return *_impl->uri_map; } -/** Load an Ingen module. - * @return true on success, false on failure - */ bool World::load_module(const char* name) { - Pimpl::Modules::iterator i = _impl->modules.find(name); + Impl::Modules::iterator i = _impl->modules.find(name); if (i != _impl->modules.end()) { LOG(Raul::info)(Raul::fmt("Module `%1%' already loaded\n") % name); return true; @@ -247,7 +239,7 @@ World::load_module(const char* name) bool World::run_module(const char* name) { - Pimpl::Modules::iterator i = _impl->modules.find(name); + Impl::Modules::iterator i = _impl->modules.find(name); if (i == _impl->modules.end()) { LOG(Raul::error) << "Attempt to run unloaded module `" << name << "'" << endl; return false; @@ -257,8 +249,6 @@ World::run_module(const char* name) return true; } -/** Unload all loaded Ingen modules. - */ void World::unload_modules() { @@ -272,7 +262,7 @@ World::new_interface(const std::string& engine_url, SharedPtr<Interface> respondee) { const string scheme = engine_url.substr(0, engine_url.find(":")); - const Pimpl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); + const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(scheme); if (i == _impl->interface_factories.end()) { Raul::warn << "Unknown URI scheme `" << scheme << "'" << endl; return SharedPtr<Interface>(); @@ -285,7 +275,7 @@ World::new_interface(const std::string& engine_url, bool World::run(const std::string& mime_type, const std::string& filename) { - const Pimpl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); + const Impl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type); if (i == _impl->script_runners.end()) { Raul::warn << "Unknown script MIME type `" << mime_type << "'" << endl; return false; diff --git a/src/socket/Socket.hpp b/src/socket/Socket.hpp index dd62aefa..e4dbb60a 100644 --- a/src/socket/Socket.hpp +++ b/src/socket/Socket.hpp @@ -18,6 +18,7 @@ #define INGEN_SOCKET_SOCKET_HPP #include <stdint.h> +#include <string.h> #include <sys/socket.h> #include <string> diff --git a/src/socket/SocketClient.hpp b/src/socket/SocketClient.hpp index de2b473b..f216a166 100644 --- a/src/socket/SocketClient.hpp +++ b/src/socket/SocketClient.hpp @@ -31,10 +31,7 @@ public: const std::string& uri, SharedPtr<Socket> sock, SharedPtr<Interface> respondee) - : SocketWriter(*world.uri_map().get(), - *world.uris().get(), - uri, - sock) + : SocketWriter(world.uri_map(), world.uris(), uri, sock) , _respondee(respondee) , _reader(world, *respondee.get(), sock) { diff --git a/src/socket/SocketListener.cpp b/src/socket/SocketListener.cpp index 6861a717..cbd29d7e 100644 --- a/src/socket/SocketListener.cpp +++ b/src/socket/SocketListener.cpp @@ -21,8 +21,9 @@ #include <string> #include "ingen/Interface.hpp" -#include "ingen/shared/World.hpp" #include "ingen/shared/AtomReader.hpp" +#include "ingen/shared/Configuration.hpp" +#include "ingen/shared/World.hpp" #include "sord/sordmm.hpp" #include "sratom/sratom.h" diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp index 94c3abdb..bef14f92 100644 --- a/src/socket/SocketReader.cpp +++ b/src/socket/SocketReader.cpp @@ -90,7 +90,7 @@ void SocketReader::_run() { Sord::World* world = _world.rdf_world(); - LV2_URID_Map* map = &_world.uri_map()->urid_map_feature()->urid_map; + LV2_URID_Map* map = &_world.uri_map().urid_map_feature()->urid_map; // Use <path:> as base URI so e.g. </foo/bar> will be a path SordNode* base_uri = sord_new_uri( @@ -132,10 +132,8 @@ SocketReader::_run() serd_reader_start_stream(reader, f, (const uint8_t*)"(socket)", false); // Make an AtomReader to call Ingen Interface methods based on Atom - Shared::AtomReader ar(*_world.uri_map().get(), - *_world.uris().get(), - _world.forge(), - _iface); + Shared::AtomReader ar( + _world.uri_map(), _world.uris(), _world.forge(), _iface); struct pollfd pfd; pfd.fd = _socket->fd(); diff --git a/src/socket/SocketServer.hpp b/src/socket/SocketServer.hpp index d03e7d4b..6732ed4e 100644 --- a/src/socket/SocketServer.hpp +++ b/src/socket/SocketServer.hpp @@ -35,8 +35,8 @@ public: : Server::EventWriter(engine) , SocketReader(world, *this, sock) , _engine(engine) - , _writer(new SocketWriter(*world.uri_map().get(), - *world.uris().get(), + , _writer(new SocketWriter(world.uri_map(), + world.uris(), sock->uri(), sock)) { |