From a7d83f19b08eb4c6f79a82fe60c2b86db13f4420 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 24 Nov 2018 13:44:03 +0100 Subject: Squashed 'waflib/' changes from 6e726eb1..5ea8f99f 5ea8f99f Improve test output spacing 0e23b29f Raise exception when test suite fails to ensure non-zero exit status d6de073b Show run time of unit tests 5b655541 Add short configure option for ultra-strict flags 4687ba6d Use gtest-like test output 258903d9 Fix failure count in test group summaries da07e738 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d --- src/server/Broadcaster.hpp | 118 --------------------------------------------- 1 file changed, 118 deletions(-) delete mode 100644 src/server/Broadcaster.hpp (limited to 'src/server/Broadcaster.hpp') diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp deleted file mode 100644 index 3981b265..00000000 --- a/src/server/Broadcaster.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2016 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_ENGINE_BROADCASTER_HPP -#define INGEN_ENGINE_BROADCASTER_HPP - -#include -#include -#include -#include -#include - -#include "ingen/Interface.hpp" -#include "ingen/types.hpp" - -#include "BlockFactory.hpp" - -namespace Ingen { -namespace Server { - -/** Broadcaster for all clients. - * - * This is an Interface that forwards all messages to all registered - * clients (for updating all clients on state changes in the engine). - * - * \ingroup engine - */ -class Broadcaster : public Interface -{ -public: - Broadcaster(); - ~Broadcaster(); - - void register_client(SPtr client); - bool unregister_client(SPtr client); - - void set_broadcast(SPtr client, bool broadcast); - - /** Ignore a client when broadcasting. - * - * This is used to prevent feeding back updates to the client that - * initiated a property set in the first place. - */ - void set_ignore_client(SPtr client) { _ignore_client = client; } - void clear_ignore_client() { _ignore_client.reset(); } - - /** Return true iff there are any clients with broadcasting enabled. - * - * This is used in the audio thread to decide whether or not notifications - * should be calculated and emitted. - */ - bool must_broadcast() const { return _must_broadcast; } - - /** A handle that represents a transfer of possibly several changes. - * - * This object going out of scope signifies the transfer is completed. - * This makes doing the right thing in recursive functions that send - * updates simple (e.g. Event::post_process()). - */ - class Transfer : public Raul::Noncopyable { - public: - explicit Transfer(Broadcaster& b) : broadcaster(b) { - if (++broadcaster._bundle_depth == 1) { - broadcaster.bundle_begin(); - } - } - ~Transfer() { - if (--broadcaster._bundle_depth == 0) { - broadcaster.bundle_end(); - } - } - Broadcaster& broadcaster; - }; - - void send_plugins(const BlockFactory::Plugins& plugins); - void send_plugins_to(Interface*, const BlockFactory::Plugins& plugins); - - void message(const Message& msg) override { - std::lock_guard lock(_clients_mutex); - for (const auto& c : _clients) { - if (c != _ignore_client) { - c->message(msg); - } - } - } - - URI uri() const override { return URI("ingen:/broadcaster"); } - -private: - friend class Transfer; - - typedef std::set> Clients; - - std::mutex _clients_mutex; - Clients _clients; - std::set< SPtr > _broadcastees; - std::atomic _must_broadcast; - unsigned _bundle_depth; - SPtr _ignore_client; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_BROADCASTER_HPP -- cgit v1.2.1