diff options
author | David Robillard <d@drobilla.net> | 2019-12-08 18:03:43 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-08 20:59:06 +0100 |
commit | c35cbf038d0992887b8d4bcf5d4ff83c323ec60c (patch) | |
tree | 02384c6a8671e866a54cbd9f6002a3dd145116b9 /ingen/client | |
parent | 8215246d12f49573f7ebcdc62ddae84185c22bfe (diff) | |
download | ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.gz ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.bz2 ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.zip |
Cleanup: Avoid parameter copying overhead
Diffstat (limited to 'ingen/client')
-rw-r--r-- | ingen/client/BlockModel.hpp | 36 | ||||
-rw-r--r-- | ingen/client/GraphModel.hpp | 8 | ||||
-rw-r--r-- | ingen/client/ObjectModel.hpp | 8 | ||||
-rw-r--r-- | ingen/client/PortModel.hpp | 6 |
4 files changed, 30 insertions, 28 deletions
diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index f6aa731a..d1f754bd 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -64,18 +64,18 @@ public: uint32_t num_ports() const override { return _ports.size(); } const Ports& ports() const { return _ports; } - void default_port_value_range(SPtr<const PortModel> port, - float& min, - float& max, - uint32_t srate = 1) const; + void default_port_value_range(const SPtr<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; + void port_value_range(const SPtr<const PortModel>& port, + float& min, + float& max, + uint32_t srate = 1) const; std::string label() const; - std::string port_label(SPtr<const PortModel> port) const; + std::string port_label(const SPtr<const PortModel>& port) const; // Signals INGEN_SIGNAL(new_port, void, SPtr<const PortModel>); @@ -87,17 +87,19 @@ protected: BlockModel(URIs& uris, const URI& plugin_uri, const Raul::Path& path); - BlockModel(URIs& uris, - SPtr<PluginModel> plugin, - const Raul::Path& path); + + BlockModel(URIs& uris, + const SPtr<PluginModel>& plugin, + const Raul::Path& path); + explicit BlockModel(const Raul::Path& path); - void add_child(SPtr<ObjectModel> c) override; - bool remove_child(SPtr<ObjectModel> c) override; - void add_port(SPtr<PortModel> pm); - void remove_port(SPtr<PortModel> port); + 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 remove_port(const Raul::Path& port_path); - void set(SPtr<ObjectModel> model) override; + void set(const SPtr<ObjectModel>& model) override; virtual void clear(); diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index 8713b6a9..c3339048 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -64,11 +64,11 @@ private: {} void clear() override; - void add_child(SPtr<ObjectModel> c) override; - bool remove_child(SPtr<ObjectModel> o) override; - void remove_arcs_on(SPtr<PortModel> p); + 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_arc(SPtr<ArcModel> arc); + void add_arc(const 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 94906dec..535bcdd2 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -80,11 +80,11 @@ protected: ObjectModel(const ObjectModel& copy); void set_path(const Raul::Path& p) override; - 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_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(SPtr<ObjectModel> o); + virtual void set(const SPtr<ObjectModel>& o); SPtr<ObjectModel> _parent; diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 4aa033d1..8bdf0398 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -82,10 +82,10 @@ private: , _direction(dir) {} - void add_child(SPtr<ObjectModel> c) override { throw; } - bool remove_child(SPtr<ObjectModel> c) override { throw; } + void add_child(const SPtr<ObjectModel>& c) override { throw; } + bool remove_child(const SPtr<ObjectModel>& c) override { throw; } - void set(SPtr<ObjectModel> model) override; + void set(const SPtr<ObjectModel>& model) override; uint32_t _index; Direction _direction; |