diff options
author | David Robillard <d@drobilla.net> | 2012-05-14 04:30:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-14 04:30:00 +0000 |
commit | f180683d453814dcd4a00eb5f0946fd7fc5677c4 (patch) | |
tree | ddd150d207c237c72ebf424acf517ce847bf2674 /src/server/ClientBroadcaster.hpp | |
parent | 121b8a2c33125225e11539b83d87cb9a1d70e537 (diff) | |
download | ingen-f180683d453814dcd4a00eb5f0946fd7fc5677c4.tar.gz ingen-f180683d453814dcd4a00eb5f0946fd7fc5677c4.tar.bz2 ingen-f180683d453814dcd4a00eb5f0946fd7fc5677c4.zip |
Remove Thread context stuff and add a thread-specific variable class, ThreadVar, which can be used for this and many other things.
ClientBroadcaster => Broadcaster.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4405 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/ClientBroadcaster.hpp')
-rw-r--r-- | src/server/ClientBroadcaster.hpp | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/src/server/ClientBroadcaster.hpp b/src/server/ClientBroadcaster.hpp deleted file mode 100644 index 88c471c6..00000000 --- a/src/server/ClientBroadcaster.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard <http://drobilla.net/> - - 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 <http://www.gnu.org/licenses/>. -*/ - -#ifndef INGEN_ENGINE_CLIENTBROADCASTER_HPP -#define INGEN_ENGINE_CLIENTBROADCASTER_HPP - -#include <list> -#include <map> -#include <string> - -#include <glibmm/thread.h> - -#include "raul/SharedPtr.hpp" - -#include "ingen/Interface.hpp" - -#include "NodeFactory.hpp" - -namespace Ingen { -namespace Server { - -class GraphObjectImpl; - -/** 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 ClientBroadcaster : public Interface -{ -public: - void register_client(const Raul::URI& uri, SharedPtr<Interface> client); - bool unregister_client(const Raul::URI& uri); - - SharedPtr<Interface> client(const Raul::URI& uri); - - void send_plugins(const NodeFactory::Plugins& plugin_list); - void send_plugins_to(Interface*, const NodeFactory::Plugins& plugin_list); - - void send_object(const GraphObjectImpl* p, bool recursive); - -#define BROADCAST(msg, ...) \ - Glib::Mutex::Lock lock(_clients_mutex); \ - for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) \ - (*i).second->msg(__VA_ARGS__) - - void bundle_begin() { BROADCAST(bundle_begin); } - void bundle_end() { BROADCAST(bundle_end); } - - void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT) { - BROADCAST(put, uri, properties); - } - - void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add) { - BROADCAST(delta, uri, remove, add); - } - - 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& parent_patch_path, - const Raul::Path& path) { - BROADCAST(disconnect_all, parent_patch_path, path); - } - - void set_property(const Raul::URI& subject, - const Raul::URI& predicate, - const Raul::Atom& value) { - BROADCAST(set_property, subject, predicate, value); - } - - Raul::URI uri() const { return "http://drobilla.net/ns/ingen#broadcaster"; } ///< N/A - - void set_response_id(int32_t id) {} ///< N/A - void get(const Raul::URI& uri) {} ///< N/A - void response(int32_t id, Status status) {} ///< N/A - - void error(const std::string& msg) { BROADCAST(error, msg); } - -private: - typedef std::map< Raul::URI, SharedPtr<Interface> > Clients; - - Glib::Mutex _clients_mutex; - Clients _clients; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_CLIENTBROADCASTER_HPP - |