diff options
author | David Robillard <d@drobilla.net> | 2020-08-02 15:23:19 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-02 15:23:19 +0200 |
commit | bdbdf42f3fe990c713c5437724db39274c387eee (patch) | |
tree | 7f921a04fd580da6bcb6fc8975fa2aebfcd93e0f /include/ingen/client | |
parent | ec0b87a18623c17c16f6a648fcf277abe14142b7 (diff) | |
download | ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.gz ingen-bdbdf42f3fe990c713c5437724db39274c387eee.tar.bz2 ingen-bdbdf42f3fe990c713c5437724db39274c387eee.zip |
Remove std::shared_ptr alias
Diffstat (limited to 'include/ingen/client')
-rw-r--r-- | include/ingen/client/ArcModel.hpp | 12 | ||||
-rw-r--r-- | include/ingen/client/BlockModel.hpp | 64 | ||||
-rw-r--r-- | include/ingen/client/ClientStore.hpp | 53 | ||||
-rw-r--r-- | include/ingen/client/GraphModel.hpp | 22 | ||||
-rw-r--r-- | include/ingen/client/ObjectModel.hpp | 21 | ||||
-rw-r--r-- | include/ingen/client/PluginModel.hpp | 9 | ||||
-rw-r--r-- | include/ingen/client/PluginUI.hpp | 43 | ||||
-rw-r--r-- | include/ingen/client/PortModel.hpp | 8 | ||||
-rw-r--r-- | include/ingen/client/SocketClient.hpp | 32 |
9 files changed, 136 insertions, 128 deletions
diff --git a/include/ingen/client/ArcModel.hpp b/include/ingen/client/ArcModel.hpp index 582314ca..05f104e4 100644 --- a/include/ingen/client/ArcModel.hpp +++ b/include/ingen/client/ArcModel.hpp @@ -20,10 +20,10 @@ #include "ingen/Arc.hpp" #include "ingen/client/PortModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <cassert> +#include <memory> namespace ingen { namespace client { @@ -37,8 +37,8 @@ class ClientStore; class INGEN_API ArcModel : public Arc { public: - SPtr<PortModel> tail() const { return _tail; } - SPtr<PortModel> head() const { return _head; } + std::shared_ptr<PortModel> tail() const { return _tail; } + std::shared_ptr<PortModel> head() const { return _head; } const Raul::Path& tail_path() const override { return _tail->path(); } const Raul::Path& head_path() const override { return _head->path(); } @@ -46,7 +46,7 @@ public: private: friend class ClientStore; - ArcModel(SPtr<PortModel> tail, SPtr<PortModel> head) + ArcModel(std::shared_ptr<PortModel> tail, std::shared_ptr<PortModel> head) : _tail(std::move(tail)) , _head(std::move(head)) { @@ -57,8 +57,8 @@ private: assert(_tail->path() != _head->path()); } - const SPtr<PortModel> _tail; - const SPtr<PortModel> _head; + const std::shared_ptr<PortModel> _tail; + const std::shared_ptr<PortModel> _head; }; } // namespace client diff --git a/include/ingen/client/BlockModel.hpp b/include/ingen/client/BlockModel.hpp index ac034242..8c1645d9 100644 --- a/include/ingen/client/BlockModel.hpp +++ b/include/ingen/client/BlockModel.hpp @@ -21,10 +21,10 @@ #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <algorithm> #include <cstdint> +#include <memory> #include <string> #include <vector> @@ -50,60 +50,60 @@ public: GraphType graph_type() const override { return Node::GraphType::BLOCK; } - using Ports = std::vector<SPtr<const PortModel>>; + using Ports = std::vector<std::shared_ptr<const PortModel>>; - SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; - SPtr<const PortModel> get_port(uint32_t index) const; + std::shared_ptr<const PortModel> get_port(const Raul::Symbol& symbol) const; + std::shared_ptr<const PortModel> get_port(uint32_t index) const; Node* port(uint32_t index) const override; - const URI& plugin_uri() const { return _plugin_uri; } - const Resource* plugin() const override { return _plugin.get(); } - Resource* plugin() { return _plugin.get(); } - SPtr<PluginModel> plugin_model() const { return _plugin; } - uint32_t num_ports() const override { return _ports.size(); } - const Ports& ports() const { return _ports; } + const URI& plugin_uri() const { return _plugin_uri; } + const Resource* plugin() const override { return _plugin.get(); } + Resource* plugin() { return _plugin.get(); } + std::shared_ptr<PluginModel> plugin_model() const { return _plugin; } + uint32_t num_ports() const override { return _ports.size(); } + const Ports& ports() const { return _ports; } - void default_port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate = 1) const; + void default_port_value_range(const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate = 1) const; - void port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate = 1) const; + void port_value_range(const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate = 1) const; std::string label() const; - std::string port_label(const SPtr<const PortModel>& port) const; + std::string port_label(const std::shared_ptr<const PortModel>& port) const; // Signals - INGEN_SIGNAL(new_port, void, SPtr<const PortModel>) - INGEN_SIGNAL(removed_port, void, SPtr<const PortModel>) + INGEN_SIGNAL(new_port, void, std::shared_ptr<const PortModel>) + INGEN_SIGNAL(removed_port, void, std::shared_ptr<const PortModel>) protected: friend class ClientStore; BlockModel(URIs& uris, URI plugin_uri, const Raul::Path& path); - BlockModel(URIs& uris, - const SPtr<PluginModel>& plugin, - const Raul::Path& path); + BlockModel(URIs& uris, + const std::shared_ptr<PluginModel>& plugin, + const Raul::Path& path); explicit BlockModel(const Raul::Path& path); - void add_child(const SPtr<ObjectModel>& c) override; - bool remove_child(const SPtr<ObjectModel>& c) override; - void add_port(const SPtr<PortModel>& pm); - void remove_port(const SPtr<PortModel>& port); + void add_child(const std::shared_ptr<ObjectModel>& c) override; + bool remove_child(const std::shared_ptr<ObjectModel>& c) override; + void add_port(const std::shared_ptr<PortModel>& pm); + void remove_port(const std::shared_ptr<PortModel>& port); void remove_port(const Raul::Path& port_path); - void set(const SPtr<ObjectModel>& model) override; + void set(const std::shared_ptr<ObjectModel>& model) override; virtual void clear(); - Ports _ports; ///< Vector of ports - URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SPtr<PluginModel> _plugin; ///< The plugin this block is an instance of + Ports _ports; ///< Vector of ports + URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + std::shared_ptr<PluginModel> _plugin; ///< Plugin this is an instance of private: mutable uint32_t _num_values; ///< Size of _min_values and _max_values diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp index 77042109..6fa040b2 100644 --- a/include/ingen/client/ClientStore.hpp +++ b/include/ingen/client/ClientStore.hpp @@ -23,10 +23,10 @@ #include "ingen/URI.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <map> +#include <memory> namespace Raul { class Path; @@ -57,24 +57,25 @@ class INGEN_API ClientStore : public Store , public Interface , public INGEN_TRACKABLE { public: - ClientStore( - URIs& uris, - Log& log, - const SPtr<SigClientInterface>& emitter = SPtr<SigClientInterface>()); + ClientStore(URIs& uris, + Log& log, + const std::shared_ptr<SigClientInterface>& emitter = + std::shared_ptr<SigClientInterface>()); URI uri() const override { return URI("ingen:/clients/store"); } - SPtr<const ObjectModel> object(const Raul::Path& path) const; - SPtr<const PluginModel> plugin(const URI& uri) const; - SPtr<const Resource> resource(const URI& uri) const; + std::shared_ptr<const ObjectModel> object(const Raul::Path& path) const; + std::shared_ptr<const PluginModel> plugin(const URI& uri) const; + std::shared_ptr<const Resource> resource(const URI& uri) const; void clear(); - using Plugins = std::map<const URI, SPtr<PluginModel>>; + using Plugins = std::map<const URI, std::shared_ptr<PluginModel>>; - SPtr<const Plugins> plugins() const { return _plugins; } - SPtr<Plugins> plugins() { return _plugins; } - void set_plugins(SPtr<Plugins> p) { _plugins = std::move(p); } + std::shared_ptr<const Plugins> plugins() const { return _plugins; } + std::shared_ptr<Plugins> plugins() { return _plugins; } + + void set_plugins(std::shared_ptr<Plugins> p) { _plugins = std::move(p); } URIs& uris() { return _uris; } @@ -97,33 +98,33 @@ public: void operator()(const SetProperty&); void operator()(const Undo&) {} - INGEN_SIGNAL(new_object, void, SPtr<ObjectModel>) - INGEN_SIGNAL(new_plugin, void, SPtr<PluginModel>) + INGEN_SIGNAL(new_object, void, std::shared_ptr<ObjectModel>) + INGEN_SIGNAL(new_plugin, void, std::shared_ptr<PluginModel>) INGEN_SIGNAL(plugin_deleted, void, URI) private: - SPtr<ObjectModel> _object(const Raul::Path& path); - SPtr<PluginModel> _plugin(const URI& uri); - SPtr<PluginModel> _plugin(const Atom& uri); - SPtr<Resource> _resource(const URI& uri); + std::shared_ptr<ObjectModel> _object(const Raul::Path& path); + std::shared_ptr<PluginModel> _plugin(const URI& uri); + std::shared_ptr<PluginModel> _plugin(const Atom& uri); + std::shared_ptr<Resource> _resource(const URI& uri); - void add_object(const SPtr<ObjectModel>& object); - SPtr<ObjectModel> remove_object(const Raul::Path& path); + void add_object(const std::shared_ptr<ObjectModel>& object); + std::shared_ptr<ObjectModel> remove_object(const Raul::Path& path); - void add_plugin(const SPtr<PluginModel>& pm); + void add_plugin(const std::shared_ptr<PluginModel>& pm); - SPtr<GraphModel> connection_graph(const Raul::Path& tail_path, + std::shared_ptr<GraphModel> connection_graph(const Raul::Path& tail_path, const Raul::Path& head_path); // Slots for SigClientInterface signals bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - URIs& _uris; - Log& _log; - SPtr<SigClientInterface> _emitter; + URIs& _uris; + Log& _log; + std::shared_ptr<SigClientInterface> _emitter; - SPtr<Plugins> _plugins; ///< Map, keyed by plugin URI + std::shared_ptr<Plugins> _plugins; ///< Map, keyed by plugin URI }; } // namespace client diff --git a/include/ingen/client/GraphModel.hpp b/include/ingen/client/GraphModel.hpp index 190c08eb..3ddf2342 100644 --- a/include/ingen/client/GraphModel.hpp +++ b/include/ingen/client/GraphModel.hpp @@ -22,9 +22,9 @@ #include "ingen/client/BlockModel.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <cstdint> +#include <memory> namespace ingen { namespace client { @@ -43,18 +43,18 @@ public: GraphType graph_type() const override { return Node::GraphType::GRAPH; } - SPtr<ArcModel> get_arc(const ingen::Node* tail, - const ingen::Node* head); + std::shared_ptr<ArcModel> + get_arc(const ingen::Node* tail, const ingen::Node* head); bool enabled() const; bool polyphonic() const; uint32_t internal_poly() const; // Signals - INGEN_SIGNAL(new_block, void, SPtr<BlockModel>) - INGEN_SIGNAL(removed_block, void, SPtr<BlockModel>) - INGEN_SIGNAL(new_arc, void, SPtr<ArcModel>) - INGEN_SIGNAL(removed_arc, void, SPtr<ArcModel>) + INGEN_SIGNAL(new_block, void, std::shared_ptr<BlockModel>) + INGEN_SIGNAL(removed_block, void, std::shared_ptr<BlockModel>) + INGEN_SIGNAL(new_arc, void, std::shared_ptr<ArcModel>) + INGEN_SIGNAL(removed_arc, void, std::shared_ptr<ArcModel>) private: friend class ClientStore; @@ -67,11 +67,11 @@ private: } void clear() override; - void add_child(const SPtr<ObjectModel>& c) override; - bool remove_child(const SPtr<ObjectModel>& o) override; - void remove_arcs_on(const SPtr<PortModel>& p); + void add_child(const std::shared_ptr<ObjectModel>& c) override; + bool remove_child(const std::shared_ptr<ObjectModel>& o) override; + void remove_arcs_on(const std::shared_ptr<PortModel>& p); - void add_arc(const SPtr<ArcModel>& arc); + void add_arc(const std::shared_ptr<ArcModel>& arc); void remove_arc(const ingen::Node* tail, const ingen::Node* head); }; diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp index a1e603f6..73e2080e 100644 --- a/include/ingen/client/ObjectModel.hpp +++ b/include/ingen/client/ObjectModel.hpp @@ -26,10 +26,11 @@ #include "ingen/URIs.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include "raul/Symbol.hpp" +#include <memory> + namespace ingen { class Atom; @@ -60,14 +61,14 @@ public: const Raul::Path& path() const override { return _path; } const Raul::Symbol& symbol() const override { return _symbol; } - SPtr<ObjectModel> parent() const { return _parent; } - bool polyphonic() const; + std::shared_ptr<ObjectModel> parent() const { return _parent; } + bool polyphonic() const; Node* graph_parent() const override { return _parent.get(); } // Signals - INGEN_SIGNAL(new_child, void, SPtr<ObjectModel>) - INGEN_SIGNAL(removed_child, void, SPtr<ObjectModel>) + INGEN_SIGNAL(new_child, void, std::shared_ptr<ObjectModel>) + INGEN_SIGNAL(removed_child, void, std::shared_ptr<ObjectModel>) INGEN_SIGNAL(property, void, const URI&, const Atom&) INGEN_SIGNAL(property_removed, void, const URI&, const Atom&) INGEN_SIGNAL(destroyed, void) @@ -80,13 +81,13 @@ protected: ObjectModel(const ObjectModel& copy); void set_path(const Raul::Path& p) override; - virtual void set_parent(const SPtr<ObjectModel>& p); - virtual void add_child(const SPtr<ObjectModel>& c) {} - virtual bool remove_child(const SPtr<ObjectModel>& c) { return true; } + virtual void set_parent(const std::shared_ptr<ObjectModel>& p); + virtual void add_child(const std::shared_ptr<ObjectModel>& c) {} + virtual bool remove_child(const std::shared_ptr<ObjectModel>& c) { return true; } - virtual void set(const SPtr<ObjectModel>& o); + virtual void set(const std::shared_ptr<ObjectModel>& o); - SPtr<ObjectModel> _parent; + std::shared_ptr<ObjectModel> _parent; private: Raul::Path _path; diff --git a/include/ingen/client/PluginModel.hpp b/include/ingen/client/PluginModel.hpp index 9c5acc78..24024a1b 100644 --- a/include/ingen/client/PluginModel.hpp +++ b/include/ingen/client/PluginModel.hpp @@ -22,13 +22,13 @@ #include "ingen/World.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" #include <cstdint> #include <map> +#include <memory> #include <string> namespace ingen { @@ -82,8 +82,9 @@ public: bool has_ui() const; - SPtr<PluginUI> - ui(ingen::World& world, const SPtr<const BlockModel>& block) const; + std::shared_ptr<PluginUI> + ui(ingen::World& world, + const std::shared_ptr<const BlockModel>& block) const; std::string documentation(bool html) const; std::string port_documentation(uint32_t index, bool html) const; @@ -104,7 +105,7 @@ public: protected: friend class ClientStore; - void set(const SPtr<PluginModel>& p); + void set(const std::shared_ptr<PluginModel>& p); void add_preset(const URI& uri, const std::string& label); diff --git a/include/ingen/client/PluginUI.hpp b/include/ingen/client/PluginUI.hpp index 89c951c3..35a14bd2 100644 --- a/include/ingen/client/PluginUI.hpp +++ b/include/ingen/client/PluginUI.hpp @@ -22,11 +22,11 @@ #include "ingen/LV2Features.hpp" #include "ingen/Resource.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "suil/suil.h" #include <cstdint> +#include <memory> #include <set> namespace ingen { @@ -53,9 +53,10 @@ public: * connected first. The caller should connect to signal_property_changed, * then call instantiate(). */ - static SPtr<PluginUI> create(ingen::World& world, - const SPtr<const BlockModel>& block, - const LilvPlugin* plugin); + static std::shared_ptr<PluginUI> + create(ingen::World& world, + const std::shared_ptr<const BlockModel>& block, + const LilvPlugin* plugin); /** Instantiate the UI. * @@ -86,28 +87,28 @@ public: const Atom&, // Object Resource::Graph) // Context - ingen::World& world() const { return _world; } - SPtr<const BlockModel> block() const { return _block; } + ingen::World& world() const { return _world; } + std::shared_ptr<const BlockModel> block() const { return _block; } private: - PluginUI(ingen::World& world, - SPtr<const BlockModel> block, - LilvUIs* uis, - const LilvUI* ui, - const LilvNode* ui_type); - - ingen::World& _world; - SPtr<const BlockModel> _block; - SuilInstance* _instance; - LilvUIs* _uis; - const LilvUI* _ui; - LilvNode* _ui_node; - LilvNode* _ui_type; - std::set<uint32_t> _subscribed_ports; + PluginUI(ingen::World& world, + std::shared_ptr<const BlockModel> block, + LilvUIs* uis, + const LilvUI* ui, + const LilvNode* ui_type); + + ingen::World& _world; + std::shared_ptr<const BlockModel> _block; + SuilInstance* _instance; + LilvUIs* _uis; + const LilvUI* _ui; + LilvNode* _ui_node; + LilvNode* _ui_type; + std::set<uint32_t> _subscribed_ports; static SuilHost* ui_host; - SPtr<LV2Features::FeatureArray> _features; + std::shared_ptr<LV2Features::FeatureArray> _features; }; } // namespace client diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp index 46034b2f..61b223df 100644 --- a/include/ingen/client/PortModel.hpp +++ b/include/ingen/client/PortModel.hpp @@ -19,11 +19,11 @@ #include "ingen/client/ObjectModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/core/lv2.h" #include "lv2/port-props/port-props.h" #include <cstdlib> +#include <memory> #include <string> namespace Raul { class Path; } @@ -82,10 +82,10 @@ private: , _direction(dir) {} - void add_child(const SPtr<ObjectModel>& c) override { throw; } - bool remove_child(const SPtr<ObjectModel>& c) override { throw; } + void add_child(const std::shared_ptr<ObjectModel>& c) override { throw; } + bool remove_child(const std::shared_ptr<ObjectModel>& c) override { throw; } - void set(const SPtr<ObjectModel>& model) override; + void set(const std::shared_ptr<ObjectModel>& model) override; uint32_t _index; Direction _direction; diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp index b23c6a45..57c1de97 100644 --- a/include/ingen/client/SocketClient.hpp +++ b/include/ingen/client/SocketClient.hpp @@ -22,6 +22,8 @@ #include "ingen/ingen.h" #include "raul/Socket.hpp" +#include <memory> + namespace ingen { namespace client { @@ -29,39 +31,41 @@ namespace client { class INGEN_API SocketClient : public SocketWriter { public: - SocketClient(World& world, - const URI& uri, - const SPtr<Raul::Socket>& sock, - const SPtr<Interface>& respondee) + SocketClient(World& world, + const URI& uri, + const std::shared_ptr<Raul::Socket>& sock, + const std::shared_ptr<Interface>& respondee) : SocketWriter(world.uri_map(), world.uris(), uri, sock) , _respondee(respondee) , _reader(world, *respondee, sock) {} - SPtr<Interface> respondee() const override { + std::shared_ptr<Interface> respondee() const override { return _respondee; } - void set_respondee(const SPtr<Interface>& respondee) override { + void set_respondee(const std::shared_ptr<Interface>& respondee) override + { _respondee = respondee; } - static SPtr<ingen::Interface> - new_socket_interface(ingen::World& world, - const URI& uri, - const SPtr<ingen::Interface>& respondee) + static std::shared_ptr<ingen::Interface> + new_socket_interface(ingen::World& world, + const URI& uri, + const std::shared_ptr<ingen::Interface>& respondee) { const Raul::Socket::Type type = (uri.scheme() == "unix" ? Raul::Socket::Type::UNIX : Raul::Socket::Type::TCP); - SPtr<Raul::Socket> sock(new Raul::Socket(type)); + std::shared_ptr<Raul::Socket> sock(new Raul::Socket(type)); if (!sock->connect(uri)) { world.log().error("Failed to connect <%1%> (%2%)\n", sock->uri(), strerror(errno)); return nullptr; } - return SPtr<Interface>(new SocketClient(world, uri, sock, respondee)); + return std::shared_ptr<Interface>( + new SocketClient(world, uri, sock, respondee)); } static void register_factories(World& world) { @@ -70,8 +74,8 @@ public: } private: - SPtr<Interface> _respondee; - SocketReader _reader; + std::shared_ptr<Interface> _respondee; + SocketReader _reader; }; } // namespace client |