summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-17 00:03:59 +0100
committerDavid Robillard <d@drobilla.net>2017-12-17 00:03:59 +0100
commit86bf9cbd7af99c8964745d414494c26af11af0f4 (patch)
tree72ce9b2a55777f5de0ffa139812eaa761870af7d /ingen
parentaf51373cadb57d8b31ccb3c359e7c80d8f697487 (diff)
downloadingen-86bf9cbd7af99c8964745d414494c26af11af0f4.tar.gz
ingen-86bf9cbd7af99c8964745d414494c26af11af0f4.tar.bz2
ingen-86bf9cbd7af99c8964745d414494c26af11af0f4.zip
Simplify Tee
Diffstat (limited to 'ingen')
-rw-r--r--ingen/Tee.hpp24
1 files changed, 5 insertions, 19 deletions
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 <mutex>
#include <set>
-#include <string>
+#include <utility>
#include "ingen/Interface.hpp"
#include "ingen/types.hpp"
@@ -32,25 +32,13 @@ class Tee : public Interface
public:
typedef std::set< SPtr<Interface> > Sinks;
- Tee(const Sinks& sinks = {})
- : _sinks(sinks)
- {}
+ explicit Tee(Sinks sinks) : _sinks(std::move(sinks)) {}
- void add_sink(SPtr<Interface> sink) {
- std::lock_guard<std::mutex> lock(_sinks_mutex);
- _sinks.insert(sink);
- }
-
- bool remove_sink(SPtr<Interface> sink) {
- std::lock_guard<std::mutex> lock(_sinks_mutex);
- return (_sinks.erase(sink) > 0);
- }
-
- virtual SPtr<Interface> respondee() const {
+ SPtr<Interface> respondee() const override {
return (*_sinks.begin())->respondee();
}
- virtual void set_respondee(SPtr<Interface> respondee) {
+ void set_respondee(SPtr<Interface> 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;