diff options
author | David Robillard <d@drobilla.net> | 2013-01-12 23:38:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-12 23:38:03 +0000 |
commit | df1447c665e6c3631961297a9d3e9aff4e94c47f (patch) | |
tree | c0ff117c362e6d571f430f886ab62f372b59af08 /ingen/client | |
parent | bb335dca695273622b7a4ebbefbe9e089edb9ab4 (diff) | |
download | ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.gz ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.bz2 ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.zip |
Remove Raul::SharedPtr and switch to std::shared_ptr.
Use project local short type aliases for shared_ptr and friends.
Move Raul::Disposable and Raul::Manageable into Raul::Maid.
Use sets to store machina nodes and edges to avoid O(n) searches.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4939 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen/client')
-rw-r--r-- | ingen/client/ArcModel.hpp | 12 | ||||
-rw-r--r-- | ingen/client/BlockModel.hpp | 58 | ||||
-rw-r--r-- | ingen/client/ClientStore.hpp | 56 | ||||
-rw-r--r-- | ingen/client/GraphModel.hpp | 20 | ||||
-rw-r--r-- | ingen/client/ObjectModel.hpp | 24 | ||||
-rw-r--r-- | ingen/client/PluginModel.hpp | 8 | ||||
-rw-r--r-- | ingen/client/PluginUI.hpp | 28 | ||||
-rw-r--r-- | ingen/client/PortModel.hpp | 16 |
8 files changed, 113 insertions, 109 deletions
diff --git a/ingen/client/ArcModel.hpp b/ingen/client/ArcModel.hpp index 99d5afa0..4306be09 100644 --- a/ingen/client/ArcModel.hpp +++ b/ingen/client/ArcModel.hpp @@ -19,8 +19,8 @@ #include <cassert> +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/Arc.hpp" #include "ingen/client/PortModel.hpp" @@ -37,8 +37,8 @@ class ClientStore; class ArcModel : public Arc { public: - SharedPtr<PortModel> tail() const { return _tail; } - SharedPtr<PortModel> head() const { return _head; } + SPtr<PortModel> tail() const { return _tail; } + SPtr<PortModel> head() const { return _head; } const Raul::Path& tail_path() const { return _tail->path(); } const Raul::Path& head_path() const { return _head->path(); } @@ -46,7 +46,7 @@ public: private: friend class ClientStore; - ArcModel(SharedPtr<PortModel> tail, SharedPtr<PortModel> head) + ArcModel(SPtr<PortModel> tail, SPtr<PortModel> head) : _tail(tail) , _head(head) { @@ -57,8 +57,8 @@ private: assert(_tail->path() != _head->path()); } - const SharedPtr<PortModel> _tail; - const SharedPtr<PortModel> _head; + const SPtr<PortModel> _tail; + const SPtr<PortModel> _head; }; } // namespace Client diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index 3262b230..b5db2b0d 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -21,11 +21,11 @@ #include <string> #include <vector> -#include "raul/SharedPtr.hpp" #include "ingen/Node.hpp" #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/client/PortModel.hpp" +#include "ingen/types.hpp" namespace Raul { class Path; } @@ -50,31 +50,35 @@ public: GraphType graph_type() const { return Node::GraphType::BLOCK; } - typedef std::vector< SharedPtr<const PortModel> > Ports; + typedef std::vector< SPtr<const PortModel> > Ports; - SharedPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; + SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; Node* port(uint32_t index) const; - const Raul::URI& plugin_uri() const { return _plugin_uri; } - const Plugin* plugin() const { return _plugin.get(); } - Plugin* plugin() { return _plugin.get(); } - SharedPtr<PluginModel> plugin_model() const { return _plugin; } - uint32_t num_ports() const { return _ports.size(); } - const Ports& ports() const { return _ports; } + const Raul::URI& plugin_uri() const { return _plugin_uri; } + const Plugin* plugin() const { return _plugin.get(); } + Plugin* plugin() { return _plugin.get(); } + SPtr<PluginModel> plugin_model() const { return _plugin; } + uint32_t num_ports() const { return _ports.size(); } + const Ports& ports() const { return _ports; } - void default_port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate=1) const; + void default_port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate = 1) const; - void port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate=1) const; + void port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate = 1) const; std::string label() const; - std::string port_label(SharedPtr<const PortModel> port) const; + std::string port_label(SPtr<const PortModel> port) const; // Signals - INGEN_SIGNAL(new_port, void, SharedPtr<const PortModel>); - INGEN_SIGNAL(removed_port, void, SharedPtr<const PortModel>); + INGEN_SIGNAL(new_port, void, SPtr<const PortModel>); + INGEN_SIGNAL(removed_port, void, SPtr<const PortModel>); protected: friend class ClientStore; @@ -82,23 +86,23 @@ protected: BlockModel(URIs& uris, const Raul::URI& plugin_uri, const Raul::Path& path); - BlockModel(URIs& uris, - SharedPtr<PluginModel> plugin, - const Raul::Path& path); + BlockModel(URIs& uris, + SPtr<PluginModel> plugin, + const Raul::Path& path); explicit BlockModel(const Raul::Path& path); - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); - void add_port(SharedPtr<PortModel> pm); - void remove_port(SharedPtr<PortModel> pm); + void add_child(SPtr<ObjectModel> c); + bool remove_child(SPtr<ObjectModel> c); + void add_port(SPtr<PortModel> pm); + void remove_port(SPtr<PortModel> pm); void remove_port(const Raul::Path& port_path); - void set(SharedPtr<ObjectModel> model); + void set(SPtr<ObjectModel> model); virtual void clear(); - Ports _ports; ///< Vector of ports - Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr<PluginModel> _plugin; ///< The plugin this block is an instance of + Ports _ports; ///< Vector of ports + Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + SPtr<PluginModel> _plugin; ///< The plugin this block is an instance of private: mutable uint32_t _num_values; ///< Size of _min_values and _max_values diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 3d7d724a..e9c85ba9 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -22,10 +22,10 @@ #include <string> #include "ingen/Interface.hpp" -#include "ingen/client/signal.hpp" #include "ingen/Store.hpp" +#include "ingen/client/signal.hpp" +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" namespace Raul { class Atom; } @@ -53,23 +53,23 @@ class ClientStore : public Store , public INGEN_TRACKABLE { public: ClientStore( - URIs& uris, - Log& log, - SharedPtr<Interface> engine = SharedPtr<Interface>(), - SharedPtr<SigClientInterface> emitter = SharedPtr<SigClientInterface>()); + URIs& uris, + Log& log, + SPtr<Interface> engine = SPtr<Interface>(), + SPtr<SigClientInterface> emitter = SPtr<SigClientInterface>()); Raul::URI uri() const { return Raul::URI("ingen:/clients/store"); } - SharedPtr<const ObjectModel> object(const Raul::Path& path) const; - SharedPtr<const PluginModel> plugin(const Raul::URI& uri) const; - SharedPtr<const Resource> resource(const Raul::URI& uri) const; + SPtr<const ObjectModel> object(const Raul::Path& path) const; + SPtr<const PluginModel> plugin(const Raul::URI& uri) const; + SPtr<const Resource> resource(const Raul::URI& uri) const; void clear(); - typedef std::map< const Raul::URI, SharedPtr<PluginModel> > Plugins; - SharedPtr<const Plugins> plugins() const { return _plugins; } - SharedPtr<Plugins> plugins() { return _plugins; } - void set_plugins(SharedPtr<Plugins> p) { _plugins = p; } + typedef std::map< const Raul::URI, SPtr<PluginModel> > Plugins; + SPtr<const Plugins> plugins() const { return _plugins; } + SPtr<Plugins> plugins() { return _plugins; } + void set_plugins(SPtr<Plugins> p) { _plugins = p; } URIs& uris() { return _uris; } @@ -104,21 +104,21 @@ public: void response(int32_t id, Status status, const std::string& subject) {} void error(const std::string& msg) {} - INGEN_SIGNAL(new_object, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(new_plugin, void, SharedPtr<PluginModel>); + INGEN_SIGNAL(new_object, void, SPtr<ObjectModel>); + INGEN_SIGNAL(new_plugin, void, SPtr<PluginModel>); private: - SharedPtr<ObjectModel> _object(const Raul::Path& path); - SharedPtr<PluginModel> _plugin(const Raul::URI& uri); - SharedPtr<Resource> _resource(const Raul::URI& uri); + SPtr<ObjectModel> _object(const Raul::Path& path); + SPtr<PluginModel> _plugin(const Raul::URI& uri); + SPtr<Resource> _resource(const Raul::URI& uri); - void add_object(SharedPtr<ObjectModel> object); - SharedPtr<ObjectModel> remove_object(const Raul::Path& path); + void add_object(SPtr<ObjectModel> object); + SPtr<ObjectModel> remove_object(const Raul::Path& path); - void add_plugin(SharedPtr<PluginModel> plugin); + void add_plugin(SPtr<PluginModel> plugin); - SharedPtr<GraphModel> connection_graph(const Raul::Path& tail_path, - const Raul::Path& head_path); + SPtr<GraphModel> connection_graph(const Raul::Path& tail_path, + const Raul::Path& head_path); void bundle_begin() {} void bundle_end() {} @@ -127,12 +127,12 @@ private: bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - URIs& _uris; - Log& _log; - SharedPtr<Interface> _engine; - SharedPtr<SigClientInterface> _emitter; + URIs& _uris; + Log& _log; + SPtr<Interface> _engine; + SPtr<SigClientInterface> _emitter; - SharedPtr<Plugins> _plugins; ///< Map, keyed by plugin URI + SPtr<Plugins> _plugins; ///< Map, keyed by plugin URI }; } // namespace Client diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index 996e9129..7a899ecb 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -18,7 +18,7 @@ #define INGEN_CLIENT_GRAPHMODEL_HPP #include "ingen/client/BlockModel.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { namespace Client { @@ -37,18 +37,18 @@ public: GraphType graph_type() const { return Node::GraphType::GRAPH; } - SharedPtr<ArcModel> get_arc(const Ingen::Node* tail, - const Ingen::Node* head); + SPtr<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, SharedPtr<BlockModel>); - INGEN_SIGNAL(removed_block, void, SharedPtr<BlockModel>); - INGEN_SIGNAL(new_arc, void, SharedPtr<ArcModel>); - INGEN_SIGNAL(removed_arc, void, SharedPtr<ArcModel>); + 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>); private: friend class ClientStore; @@ -58,10 +58,10 @@ private: {} void clear(); - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); + void add_child(SPtr<ObjectModel> c); + bool remove_child(SPtr<ObjectModel> c); - void add_arc(SharedPtr<ArcModel> arc); + void add_arc(SPtr<ArcModel> arc); void remove_arc(const Ingen::Node* tail, const Ingen::Node* head); }; diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index 60e873e4..52655949 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -25,8 +25,8 @@ #include <cassert> #include <cstdlib> +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" #include "ingen/Node.hpp" @@ -63,16 +63,16 @@ public: void on_property(const Raul::URI& uri, const Raul::Atom& value); - const Raul::Path& path() const { return _path; } - const Raul::Symbol& symbol() const { return _symbol; } - SharedPtr<ObjectModel> parent() const { return _parent; } - bool polyphonic() const; + const Raul::Path& path() const { return _path; } + const Raul::Symbol& symbol() const { return _symbol; } + SPtr<ObjectModel> parent() const { return _parent; } + bool polyphonic() const; Node* graph_parent() const { return _parent.get(); } // Signals - INGEN_SIGNAL(new_child, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(removed_child, void, SharedPtr<ObjectModel>); + INGEN_SIGNAL(new_child, void, SPtr<ObjectModel>); + INGEN_SIGNAL(removed_child, void, SPtr<ObjectModel>); INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&); INGEN_SIGNAL(destroyed, void); INGEN_SIGNAL(moved, void); @@ -84,13 +84,13 @@ protected: ObjectModel(const ObjectModel& copy); virtual void set_path(const Raul::Path& p); - virtual void set_parent(SharedPtr<ObjectModel> p); - virtual void add_child(SharedPtr<ObjectModel> c) {} - virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; } + virtual void set_parent(SPtr<ObjectModel> p); + virtual void add_child(SPtr<ObjectModel> c) {} + virtual bool remove_child(SPtr<ObjectModel> c) { return true; } - virtual void set(SharedPtr<ObjectModel> model); + virtual void set(SPtr<ObjectModel> model); - SharedPtr<ObjectModel> _parent; + SPtr<ObjectModel> _parent; private: Raul::Path _path; diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 4195dfe2..dea85651 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -26,8 +26,8 @@ #include "ingen/Resource.hpp" #include "ingen/World.hpp" #include "ingen/client/signal.hpp" +#include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/SharedPtr.hpp" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" @@ -74,8 +74,8 @@ public: bool has_ui() const; - SharedPtr<PluginUI> ui(Ingen::World* world, - SharedPtr<const BlockModel> block) const; + SPtr<PluginUI> ui(Ingen::World* world, + SPtr<const BlockModel> block) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); @@ -95,7 +95,7 @@ public: protected: friend class ClientStore; - void set(SharedPtr<PluginModel> p); + void set(SPtr<PluginModel> p); private: Type _type; diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 60403570..b2a8bd6b 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_CLIENT_PLUGINUI_HPP #define INGEN_CLIENT_PLUGINUI_HPP -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "lilv/lilv.h" @@ -42,9 +42,9 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr<PluginUI> create(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvPlugin* plugin); + static SPtr<PluginUI> create(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvPlugin* plugin); SuilWidget get_widget(); @@ -55,22 +55,22 @@ public: bool is_resizable() const; - Ingen::World* world() const { return _world; } - SharedPtr<const BlockModel> block() const { return _block; } + Ingen::World* world() const { return _world; } + SPtr<const BlockModel> block() const { return _block; } private: - PluginUI(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvNode* ui_node); + PluginUI(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvNode* ui_node); - Ingen::World* _world; - SharedPtr<const BlockModel> _block; - SuilInstance* _instance; - LilvNode* _ui_node; + Ingen::World* _world; + SPtr<const BlockModel> _block; + SuilInstance* _instance; + LilvNode* _ui_node; static SuilHost* ui_host; - SharedPtr<LV2Features::FeatureArray> _features; + SPtr<LV2Features::FeatureArray> _features; }; } // namespace Client diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 92379e6e..568975fc 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -20,7 +20,7 @@ #include <cstdlib> #include <string> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -71,8 +71,8 @@ public: INGEN_SIGNAL(value_changed, void, const Raul::Atom&); INGEN_SIGNAL(voice_changed, void, uint32_t, const Raul::Atom&); INGEN_SIGNAL(activity, void, const Raul::Atom&); - INGEN_SIGNAL(connection, void, SharedPtr<PortModel>); - INGEN_SIGNAL(disconnection, void, SharedPtr<PortModel>); + INGEN_SIGNAL(connection, void, SPtr<PortModel>); + INGEN_SIGNAL(disconnection, void, SPtr<PortModel>); private: friend class ClientStore; @@ -87,20 +87,20 @@ private: , _connections(0) {} - void add_child(SharedPtr<ObjectModel> c) { throw; } - bool remove_child(SharedPtr<ObjectModel> c) { throw; } + void add_child(SPtr<ObjectModel> c) { throw; } + bool remove_child(SPtr<ObjectModel> c) { throw; } - void connected_to(SharedPtr<PortModel> p) { + void connected_to(SPtr<PortModel> p) { ++_connections; _signal_connection.emit(p); } - void disconnected_from(SharedPtr<PortModel> p) { + void disconnected_from(SPtr<PortModel> p) { --_connections; _signal_disconnection.emit(p); } - void set(SharedPtr<ObjectModel> model); + void set(SPtr<ObjectModel> model); uint32_t _index; Direction _direction; |