From acb958e95d0e8ca1b0dd912fe8bbf2e14e5f74e9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 8 Mar 2019 09:06:55 +0100 Subject: Pass World everywhere by reference --- ingen/DataAccess.hpp | 4 ++-- ingen/InstanceAccess.hpp | 4 ++-- ingen/LV2Features.hpp | 7 +++---- ingen/Log.hpp | 2 +- ingen/Module.hpp | 4 ++-- ingen/URIMap.hpp | 2 +- ingen/World.hpp | 2 +- ingen/client/PluginModel.hpp | 2 +- ingen/client/PluginUI.hpp | 8 ++++---- ingen/client/SocketClient.hpp | 12 ++++++------ 10 files changed, 23 insertions(+), 24 deletions(-) (limited to 'ingen') diff --git a/ingen/DataAccess.hpp b/ingen/DataAccess.hpp index fb3e3a79..34b59a49 100644 --- a/ingen/DataAccess.hpp +++ b/ingen/DataAccess.hpp @@ -41,8 +41,8 @@ struct DataAccess : public ingen::LV2Features::Feature const char* uri() const override { return "http://lv2plug.in/ns/ext/data-access"; } - SPtr feature(World* world, Node* node) override { - Node* store_node = world->store()->get(node->path()); + SPtr feature(World& world, Node* node) override { + Node* store_node = world.store()->get(node->path()); if (!store_node) { return SPtr(); } diff --git a/ingen/InstanceAccess.hpp b/ingen/InstanceAccess.hpp index 85fdae16..27ae0d4e 100644 --- a/ingen/InstanceAccess.hpp +++ b/ingen/InstanceAccess.hpp @@ -34,8 +34,8 @@ struct InstanceAccess : public ingen::LV2Features::Feature { const char* uri() const override { return "http://lv2plug.in/ns/ext/instance-access"; } - SPtr feature(World* world, Node* node) override { - Node* store_node = world->store()->get(node->path()); + SPtr feature(World& world, Node* node) override { + Node* store_node = world.store()->get(node->path()); if (!store_node) { return SPtr(); } diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp index 541af576..db5d530f 100644 --- a/ingen/LV2Features.hpp +++ b/ingen/LV2Features.hpp @@ -44,7 +44,7 @@ public: virtual const char* uri() const = 0; - virtual SPtr feature(World* world, + virtual SPtr feature(World& world, Node* block) = 0; protected: @@ -57,7 +57,7 @@ protected: const char* uri() const override { return _uri; } - SPtr feature(World* world, Node* block) override { + SPtr feature(World& world, Node* block) override { return SPtr(); } @@ -82,8 +82,7 @@ protected: void add_feature(SPtr feature); bool is_supported(const std::string& uri) const; - SPtr lv2_features(World* world, - Node* node) const; + SPtr lv2_features(World& world, Node* node) const; private: typedef std::vector< SPtr > Features; diff --git a/ingen/Log.hpp b/ingen/Log.hpp index ed964447..4d1bd1ee 100644 --- a/ingen/Log.hpp +++ b/ingen/Log.hpp @@ -47,7 +47,7 @@ public: struct Feature : public LV2Features::Feature { const char* uri() const override { return LV2_LOG__log; } - SPtr feature(World* world, Node* block) override; + SPtr feature(World& world, Node* block) override; struct Handle { LV2_Log_Log lv2_log; diff --git a/ingen/Module.hpp b/ingen/Module.hpp index 405f4fa1..17f7b10b 100644 --- a/ingen/Module.hpp +++ b/ingen/Module.hpp @@ -40,8 +40,8 @@ public: Module(const Module&) = delete; Module& operator=(const Module&) = delete; - virtual void load(ingen::World* world) = 0; - virtual void run(ingen::World* world) {} + virtual void load(ingen::World& world) = 0; + virtual void run(ingen::World& world) {} /** Library implementing this module. * diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp index 1dbb950c..f1825439 100644 --- a/ingen/URIMap.hpp +++ b/ingen/URIMap.hpp @@ -57,7 +57,7 @@ public: const char* uri() const override { return _feature.URI; } - SPtr feature(World*, Node*) override { + SPtr feature(World&, Node*) override { return SPtr(&_feature, NullDeleter); } diff --git a/ingen/World.hpp b/ingen/World.hpp index 89dc983b..d895b742 100644 --- a/ingen/World.hpp +++ b/ingen/World.hpp @@ -89,7 +89,7 @@ public: virtual bool run_module(const char* name); /** A function to create a new remote Interface. */ - typedef SPtr (*InterfaceFactory)(World* world, + typedef SPtr (*InterfaceFactory)(World& world, const URI& engine_uri, SPtr respondee); diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 97fbd2a0..08a0fec9 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -83,7 +83,7 @@ public: bool has_ui() const; - SPtr ui(ingen::World* world, + SPtr ui(ingen::World& world, SPtr block) const; std::string documentation(bool html) const; diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 6a6d6db9..f17c8f61 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -48,7 +48,7 @@ public: * connected first. The caller should connect to signal_property_changed, * then call instantiate(). */ - static SPtr create(ingen::World* world, + static SPtr create(ingen::World& world, SPtr block, const LilvPlugin* plugin); @@ -81,17 +81,17 @@ public: const Atom&, // Object Resource::Graph); // Context - ingen::World* world() const { return _world; } + ingen::World& world() const { return _world; } SPtr block() const { return _block; } private: - PluginUI(ingen::World* world, + PluginUI(ingen::World& world, SPtr block, LilvUIs* uis, const LilvUI* ui, const LilvNode* ui_type); - ingen::World* _world; + ingen::World& _world; SPtr _block; SuilInstance* _instance; LilvUIs* _uis; diff --git a/ingen/client/SocketClient.hpp b/ingen/client/SocketClient.hpp index 9703cf29..bce5ab38 100644 --- a/ingen/client/SocketClient.hpp +++ b/ingen/client/SocketClient.hpp @@ -47,7 +47,7 @@ public: } static SPtr - new_socket_interface(ingen::World* world, + new_socket_interface(ingen::World& world, const URI& uri, SPtr respondee) { @@ -57,16 +57,16 @@ public: SPtr sock(new Raul::Socket(type)); if (!sock->connect(uri)) { - world->log().error(fmt("Failed to connect <%1%> (%2%)\n") + world.log().error(fmt("Failed to connect <%1%> (%2%)\n") % sock->uri() % strerror(errno)); return SPtr(); } - return SPtr(new SocketClient(*world, uri, sock, respondee)); + return SPtr(new SocketClient(world, uri, sock, respondee)); } - static void register_factories(World* world) { - world->add_interface_factory("unix", &new_socket_interface); - world->add_interface_factory("tcp", &new_socket_interface); + static void register_factories(World& world) { + world.add_interface_factory("unix", &new_socket_interface); + world.add_interface_factory("tcp", &new_socket_interface); } private: -- cgit v1.2.1