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 | |
parent | 8215246d12f49573f7ebcdc62ddae84185c22bfe (diff) | |
download | ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.gz ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.bz2 ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.zip |
Cleanup: Avoid parameter copying overhead
Diffstat (limited to 'ingen')
-rw-r--r-- | ingen/EngineBase.hpp | 4 | ||||
-rw-r--r-- | ingen/LV2Features.hpp | 2 | ||||
-rw-r--r-- | ingen/Parser.hpp | 26 | ||||
-rw-r--r-- | ingen/Serialiser.hpp | 12 | ||||
-rw-r--r-- | ingen/Store.hpp | 2 | ||||
-rw-r--r-- | ingen/TurtleWriter.hpp | 2 | ||||
-rw-r--r-- | ingen/World.hpp | 10 | ||||
-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 |
11 files changed, 59 insertions, 57 deletions
diff --git a/ingen/EngineBase.hpp b/ingen/EngineBase.hpp index 7b3239f1..36742601 100644 --- a/ingen/EngineBase.hpp +++ b/ingen/EngineBase.hpp @@ -132,12 +132,12 @@ public: /** Register a client to receive updates about engine changes. */ - virtual void register_client(SPtr<Interface> client) = 0; + virtual void register_client(const SPtr<Interface>& client) = 0; /** Unregister a client. */ - virtual bool unregister_client(SPtr<Interface> client) = 0; + virtual bool unregister_client(const SPtr<Interface>& client) = 0; }; } // namespace ingen diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp index e2ce600f..06811294 100644 --- a/ingen/LV2Features.hpp +++ b/ingen/LV2Features.hpp @@ -78,7 +78,7 @@ protected: LV2_Feature** _array; }; - void add_feature(SPtr<Feature> feature); + void add_feature(const SPtr<Feature>& feature); bool is_supported(const std::string& uri) const; SPtr<FeatureArray> lv2_features(World& world, Node* node) const; diff --git a/ingen/Parser.hpp b/ingen/Parser.hpp index 8d868a8c..45d087cd 100644 --- a/ingen/Parser.hpp +++ b/ingen/Parser.hpp @@ -77,21 +77,21 @@ public: * @return whether or not load was successful. */ virtual bool parse_file( - World& world, - Interface& target, - const FilePath& path, - boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(), - boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(), - boost::optional<Properties> data = boost::optional<Properties>()); + World& world, + Interface& target, + const FilePath& path, + const boost::optional<Raul::Path>& parent = boost::optional<Raul::Path>(), + const boost::optional<Raul::Symbol>& symbol = boost::optional<Raul::Symbol>(), + const boost::optional<Properties>& data = boost::optional<Properties>()); virtual boost::optional<URI> parse_string( - World& world, - Interface& target, - const std::string& str, - const URI& base_uri, - boost::optional<Raul::Path> parent = boost::optional<Raul::Path>(), - boost::optional<Raul::Symbol> symbol = boost::optional<Raul::Symbol>(), - boost::optional<Properties> data = boost::optional<Properties>()); + World& world, + Interface& target, + const std::string& str, + const URI& base_uri, + const boost::optional<Raul::Path>& parent = boost::optional<Raul::Path>(), + const boost::optional<Raul::Symbol>& symbol = boost::optional<Raul::Symbol>(), + const boost::optional<Properties>& data = boost::optional<Properties>()); }; } // namespace ingen diff --git a/ingen/Serialiser.hpp b/ingen/Serialiser.hpp index 4980a36d..776b837e 100644 --- a/ingen/Serialiser.hpp +++ b/ingen/Serialiser.hpp @@ -46,8 +46,8 @@ public: virtual ~Serialiser(); /** Write a graph and all its contents as a complete bundle. */ - virtual void write_bundle(SPtr<const Node> graph, - const URI& uri); + virtual void write_bundle(const SPtr<const Node>& graph, + const URI& uri); /** Begin a serialization to a string. * @@ -76,15 +76,15 @@ public: * * @throw std::logic_error */ - virtual void serialise(SPtr<const Node> object, - Property::Graph context = Property::Graph::DEFAULT); + virtual void serialise(const SPtr<const Node>& object, + Property::Graph context = Property::Graph::DEFAULT); /** Serialize an arc. * * @throw std::logic_error */ - virtual void serialise_arc(const Sord::Node& parent, - SPtr<const Arc> arc); + virtual void serialise_arc(const Sord::Node& parent, + const SPtr<const Arc>& arc); /** Finish serialization. * diff --git a/ingen/Store.hpp b/ingen/Store.hpp index 3c92dcc4..1aa90936 100644 --- a/ingen/Store.hpp +++ b/ingen/Store.hpp @@ -54,7 +54,7 @@ public: iterator find_descendants_end(Store::iterator parent); const_iterator find_descendants_end(Store::const_iterator parent) const; - const_range children_range(SPtr<const Node> o) const; + const_range children_range(const SPtr<const Node>& o) const; /** Remove the object at `top` and all its children from the store. * diff --git a/ingen/TurtleWriter.hpp b/ingen/TurtleWriter.hpp index 2ee027ae..9c88be2e 100644 --- a/ingen/TurtleWriter.hpp +++ b/ingen/TurtleWriter.hpp @@ -41,7 +41,7 @@ class URIs; class INGEN_API TurtleWriter : public AtomWriter, public AtomSink { public: - TurtleWriter(URIMap& map, URIs& uris, const URI& uri); + TurtleWriter(URIMap& map, URIs& uris, URI uri); ~TurtleWriter() override; diff --git a/ingen/World.hpp b/ingen/World.hpp index c8d69c5b..a2906525 100644 --- a/ingen/World.hpp +++ b/ingen/World.hpp @@ -102,16 +102,16 @@ public: * @param respondee The Interface that will receive responses to commands * and broadcasts, if applicable. */ - virtual SPtr<Interface> new_interface(const URI& engine_uri, - SPtr<Interface> respondee); + virtual SPtr<Interface> new_interface(const URI& engine_uri, + const SPtr<Interface>& respondee); /** Run a script. */ virtual bool run(const std::string& mime_type, const std::string& filename); - virtual void set_engine(SPtr<EngineBase> e); - virtual void set_interface(SPtr<Interface> i); - virtual void set_store(SPtr<Store> s); + virtual void set_engine(const SPtr<EngineBase>& e); + virtual void set_interface(const SPtr<Interface>& i); + virtual void set_store(const SPtr<Store>& s); virtual SPtr<EngineBase> engine(); virtual SPtr<Interface> interface(); 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; |