diff options
Diffstat (limited to 'ingen/Tee.hpp')
-rw-r--r-- | ingen/Tee.hpp | 77 |
1 files changed, 10 insertions, 67 deletions
diff --git a/ingen/Tee.hpp b/ingen/Tee.hpp index 02596e03..12cccc91 100644 --- a/ingen/Tee.hpp +++ b/ingen/Tee.hpp @@ -54,77 +54,20 @@ public: (*_sinks.begin())->set_respondee(respondee); } -#define BROADCAST(msg, ...) \ - std::lock_guard<std::mutex> lock(_sinks_mutex); \ - for (const auto& s : _sinks) { \ - s->msg(__VA_ARGS__); \ - } - - void bundle_begin() { BROADCAST(bundle_begin); } - void bundle_end() { BROADCAST(bundle_end); } - - void put(const Raul::URI& uri, - const Properties& properties, - Resource::Graph ctx = Resource::Graph::DEFAULT) { - BROADCAST(put, uri, properties, ctx); - } - - void delta(const Raul::URI& uri, - const Properties& remove, - const Properties& add, - Resource::Graph ctx = Resource::Graph::DEFAULT) { - BROADCAST(delta, uri, remove, add, ctx); - } - - void copy(const Raul::URI& old_uri, - const Raul::URI& new_uri) { - BROADCAST(copy, old_uri, new_uri); - } - - void move(const Raul::Path& old_path, - const Raul::Path& new_path) { - BROADCAST(move, old_path, new_path); - } - - void del(const Raul::URI& uri) { BROADCAST(del, uri); } - - void connect(const Raul::Path& tail, - const Raul::Path& head) { - BROADCAST(connect, tail, head); - } - - void disconnect(const Raul::Path& tail, - const Raul::Path& head) { - BROADCAST(disconnect, tail, head); - } - - void disconnect_all(const Raul::Path& graph, - const Raul::Path& path) { - BROADCAST(disconnect_all, graph, path); - } - - void set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Atom& value, - Resource::Graph ctx = Resource::Graph::DEFAULT) { - BROADCAST(set_property, subject, predicate, value, ctx); + void set_response_id(int32_t id) { + std::lock_guard<std::mutex> lock(_sinks_mutex); + for (const auto& s : _sinks) { + s->set_response_id(id); + } } - void undo() { BROADCAST(undo); } - void redo() { BROADCAST(redo); } - - void set_response_id(int32_t id) { BROADCAST(set_response_id, id); } - - void get(const Raul::URI& uri) { BROADCAST(get, uri); } - - void response(int32_t id, Status status, const std::string& subject) { - BROADCAST(response, id, status, subject); + void message(const Message& message) override { + std::lock_guard<std::mutex> lock(_sinks_mutex); + for (const auto& s : _sinks) { + s->message(message); + } } - void error(const std::string& msg) { BROADCAST(error, msg); } - -#undef BROADCAST - Raul::URI uri() const { return Raul::URI("ingen:/tee"); } const Sinks& sinks() const { return _sinks; } Sinks& sinks() { return _sinks; } |