From 86bf9cbd7af99c8964745d414494c26af11af0f4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Dec 2017 00:03:59 +0100 Subject: Simplify Tee --- ingen/Tee.hpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'ingen') diff --git a/ingen/Tee.hpp b/ingen/Tee.hpp index f02d8602..543dfa28 100644 --- a/ingen/Tee.hpp +++ b/ingen/Tee.hpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include "ingen/Interface.hpp" #include "ingen/types.hpp" @@ -32,25 +32,13 @@ class Tee : public Interface public: typedef std::set< SPtr > Sinks; - Tee(const Sinks& sinks = {}) - : _sinks(sinks) - {} + explicit Tee(Sinks sinks) : _sinks(std::move(sinks)) {} - void add_sink(SPtr sink) { - std::lock_guard lock(_sinks_mutex); - _sinks.insert(sink); - } - - bool remove_sink(SPtr sink) { - std::lock_guard lock(_sinks_mutex); - return (_sinks.erase(sink) > 0); - } - - virtual SPtr respondee() const { + SPtr respondee() const override { return (*_sinks.begin())->respondee(); } - virtual void set_respondee(SPtr respondee) { + void set_respondee(SPtr respondee) override { (*_sinks.begin())->set_respondee(respondee); } @@ -61,9 +49,7 @@ public: } } - Raul::URI uri() const { return Raul::URI("ingen:/tee"); } - const Sinks& sinks() const { return _sinks; } - Sinks& sinks() { return _sinks; } + Raul::URI uri() const override { return Raul::URI("ingen:/tee"); } private: std::mutex _sinks_mutex; -- cgit v1.2.1