diff options
author | David Robillard <d@drobilla.net> | 2007-07-24 21:23:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-24 21:23:22 +0000 |
commit | bac31a50f17608c514afce5ad014316cccde3d5a (patch) | |
tree | de4ec623cc5099e3de4b9b5a1883b51694fe6bf9 /src/libs/engine | |
parent | bb1c49dfa484db080938cff6f8f70167c9026a1c (diff) | |
download | ingen-bac31a50f17608c514afce5ad014316cccde3d5a.tar.gz ingen-bac31a50f17608c514afce5ad014316cccde3d5a.tar.bz2 ingen-bac31a50f17608c514afce5ad014316cccde3d5a.zip |
Scrapped ClientKey in favour of a URI string (towards a simpler closer-to-straight-C engine interface).
Fixed client deregistration.
Added metadata value requesting.
git-svn-id: http://svn.drobilla.net/lad/ingen@614 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/ClientBroadcaster.cpp | 106 | ||||
-rw-r--r-- | src/libs/engine/ClientBroadcaster.hpp | 21 | ||||
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.cpp | 27 | ||||
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.hpp | 1 | ||||
-rw-r--r-- | src/libs/engine/OSCResponder.cpp | 3 | ||||
-rw-r--r-- | src/libs/engine/OSCResponder.hpp | 4 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 14 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.hpp | 8 | ||||
-rw-r--r-- | src/libs/engine/events/RegisterClientEvent.cpp | 17 | ||||
-rw-r--r-- | src/libs/engine/events/RegisterClientEvent.hpp | 6 | ||||
-rw-r--r-- | src/libs/engine/events/RequestAllObjectsEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/RequestMetadataEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/RequestObjectEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/RequestPluginEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/RequestPluginsEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/RequestPortValueEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/UnregisterClientEvent.cpp | 6 | ||||
-rw-r--r-- | src/libs/engine/events/UnregisterClientEvent.hpp | 7 |
18 files changed, 95 insertions, 137 deletions
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 311e8792..8547543a 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -18,7 +18,6 @@ #include <cassert> #include <iostream> #include <unistd.h> -#include "interface/ClientKey.hpp" #include "interface/ClientInterface.hpp" #include "ClientBroadcaster.hpp" #include "ObjectStore.hpp" @@ -42,59 +41,34 @@ namespace Ingen { /** Register a client to receive messages over the notification band. */ void -ClientBroadcaster::register_client(const ClientKey key, SharedPtr<ClientInterface> client) +ClientBroadcaster::register_client(const string& uri, SharedPtr<ClientInterface> client) { - bool found = false; - for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i) - if ((*i).first == key) - found = true; - - if (!found) { - _clients.push_back(pair<ClientKey, SharedPtr<ClientInterface> >(key, client)); - cout << "[ClientBroadcaster] Registered client " << key.uri() - << " (" << _clients.size() << " clients)" << endl; + ClientMap::iterator i = _clients.find(uri); + + if (i == _clients.end()) { + _clients[uri] = client; + cout << "[ClientBroadcaster] Registered client: " << uri << endl; } else { - cout << "[ClientBroadcaster] Client already registered." << endl; + cout << "[ClientBroadcaster] Client already registered: " << uri << endl; } } /** Remove a client from the list of registered clients. * - * The removed client is returned (not deleted). It is the caller's - * responsibility to delete the returned pointer, if it's not NULL. - * - * @return true if client was found and removed (and refcount decremented). + * @return true if client was found and removed. */ bool -ClientBroadcaster::unregister_client(const ClientKey& key) +ClientBroadcaster::unregister_client(const string& uri) { - cerr << "FIXME: unregister broken\n"; - return false; - -#if 0 - if (responder == NULL) - return NULL; - - // FIXME: remove filthy cast - const string url = lo_address_get_url(((OSCResponder*)responder)->source()); - ClientInterface* r = NULL; - - for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i) { - if ((*i).second->url() == url) { - r = *i; - _clients.erase(i); - break; - } - } + size_t erased = _clients.erase(uri); - if (r != NULL) - cout << "[OSC] Unregistered client " << r->url() << " (" << _clients.size() << " clients)" << endl; + if (erased > 0) + cout << "Unregistered client: " << uri << endl; else - cerr << "[OSC] ERROR: Unable to find client to unregister!" << endl; - - return r; -#endif + cout << "Failed to find client to unregister: " << uri << endl; + + return (erased > 0); } @@ -106,22 +80,22 @@ ClientBroadcaster::unregister_client(const ClientKey& key) * events, in anticipation of libom and multiple ways of responding to clients). */ SharedPtr<ClientInterface> -ClientBroadcaster::client(const ClientKey& key) +ClientBroadcaster::client(const string& uri) { - for (ClientList::iterator i = _clients.begin(); i != _clients.end(); ++i) - if ((*i).first == key) - return (*i).second; - - cerr << "[ClientBroadcaster] Failed to find client " << key.uri() << endl; - - return SharedPtr<ClientInterface>(); + ClientMap::iterator i = _clients.find(uri); + if (i != _clients.end()) { + return (*i).second; + } else { + cerr << "[ClientBroadcaster] Failed to find client: " << uri << endl; + return SharedPtr<ClientInterface>(); + } } void ClientBroadcaster::send_error(const string& msg) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->error(msg); } @@ -187,7 +161,7 @@ ClientBroadcaster::send_plugins_to(SharedPtr<ClientInterface> client, const list void ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list) { - for (ClientList::const_iterator c = _clients.begin(); c != _clients.end(); ++c) + for (ClientMap::const_iterator c = _clients.begin(); c != _clients.end(); ++c) send_plugins_to((*c).second, plugin_list); } @@ -195,7 +169,7 @@ ClientBroadcaster::send_plugins(const list<Plugin*>& plugin_list) void ClientBroadcaster::send_node(const Node* node, bool recursive) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) ObjectSender::send_node((*i).second.get(), node, recursive); } @@ -203,7 +177,7 @@ ClientBroadcaster::send_node(const Node* node, bool recursive) void ClientBroadcaster::send_port(const Port* port) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) ObjectSender::send_port((*i).second.get(), port); } @@ -212,21 +186,21 @@ void ClientBroadcaster::send_destroyed(const string& path) { assert(path != "/"); - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->object_destroyed(path); } void ClientBroadcaster::send_patch_cleared(const string& patch_path) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_cleared(patch_path); } void ClientBroadcaster::send_connection(const Connection* const c) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->connection(c->src_port()->path(), c->dst_port()->path()); } @@ -234,7 +208,7 @@ ClientBroadcaster::send_connection(const Connection* const c) void ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->disconnection(src_port_path, dst_port_path); } @@ -242,7 +216,7 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string& void ClientBroadcaster::send_patch_enable(const string& patch_path) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_enabled(patch_path); } @@ -250,7 +224,7 @@ ClientBroadcaster::send_patch_enable(const string& patch_path) void ClientBroadcaster::send_patch_disable(const string& patch_path) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->patch_disabled(patch_path); } @@ -262,7 +236,7 @@ ClientBroadcaster::send_patch_disable(const string& patch_path) void ClientBroadcaster::send_metadata_update(const string& node_path, const string& key, const Atom& value) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->metadata_update(node_path, key, value); } @@ -276,7 +250,7 @@ ClientBroadcaster::send_metadata_update(const string& node_path, const string& k void ClientBroadcaster::send_control_change(const string& port_path, float value) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->control_change(port_path, value); } @@ -284,7 +258,7 @@ ClientBroadcaster::send_control_change(const string& port_path, float value) void ClientBroadcaster::send_program_add(const string& node_path, int bank, int program, const string& name) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_add(node_path, bank, program, name); } @@ -292,7 +266,7 @@ ClientBroadcaster::send_program_add(const string& node_path, int bank, int progr void ClientBroadcaster::send_program_remove(const string& node_path, int bank, int program) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_remove(node_path, bank, program); } @@ -304,7 +278,7 @@ ClientBroadcaster::send_program_remove(const string& node_path, int bank, int pr void ClientBroadcaster::send_patch(const Patch* const p, bool recursive) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) ObjectSender::send_patch((*i).second.get(), p, recursive); } @@ -314,7 +288,7 @@ ClientBroadcaster::send_patch(const Patch* const p, bool recursive) void ClientBroadcaster::send_rename(const string& old_path, const string& new_path) { - for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->object_renamed(old_path, new_path); } @@ -326,7 +300,7 @@ ClientBroadcaster::send_all_objects() { cerr << "FIXME: send_all" << endl; - //for (ClientList::const_iterator i = _clients.begin(); i != _clients.end(); ++i) + //for (ClientMap::const_iterator i = _clients.begin(); i != _clients.end(); ++i) // (*i).second->send_all_objects(); } diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index 87e321bb..3103c4d9 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -19,16 +19,17 @@ #define CLIENTBROADCASTER_H #include <string> -#include <iostream> -#include <utility> #include <list> +#include <map> #include <lo/lo.h> #include <pthread.h> #include <raul/SharedPtr.hpp> #include "interface/ClientInterface.hpp" #include "types.hpp" -using std::list; using std::string; using std::pair; +using std::map; +using std::string; +using std::list; namespace Ingen { @@ -37,8 +38,7 @@ class Port; class Plugin; class Patch; class Connection; -namespace Shared { class ClientKey; class Responder; } -using Shared::ClientKey; +namespace Shared { class Responder; } using Shared::ClientInterface; @@ -55,10 +55,10 @@ using Shared::ClientInterface; class ClientBroadcaster { public: - void register_client(const ClientKey key, SharedPtr<ClientInterface> client); - bool unregister_client(const ClientKey& key); + void register_client(const string& uri, SharedPtr<ClientInterface> client); + bool unregister_client(const string& uri); - SharedPtr<ClientInterface> client(const ClientKey& key); + SharedPtr<ClientInterface> client(const string& uri); // Notification band: @@ -91,9 +91,8 @@ public: void send_plugins_to(SharedPtr<ClientInterface>, const list<Plugin*>& plugin_list); private: - typedef list<pair<ClientKey, SharedPtr<ClientInterface> > > ClientList; - //list<pair<ClientKey, ClientInterface* const> > _clients; - ClientList _clients; + typedef std::map<string, SharedPtr<ClientInterface> > ClientMap; + ClientMap _clients; }; diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index d3d1b666..011f950c 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -22,7 +22,6 @@ #include "types.hpp" #include <raul/SharedPtr.hpp> #include <raul/AtomLiblo.hpp> -#include "interface/ClientKey.hpp" #include "interface/ClientInterface.hpp" #include "OSCEngineReceiver.hpp" #include "QueuedEventSource.hpp" @@ -34,8 +33,6 @@ using std::cerr; using std::cout; using std::endl; namespace Ingen { -using Shared::ClientKey; - /*! \page engine_osc_namespace Engine OSC Namespace Documentation * @@ -255,8 +252,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, // Don't respond } else { me->disable_responses(); - SharedPtr<ClientInterface> client = me->_engine.broadcaster()->client( - ClientKey(ClientKey::OSC_URL, (const char*)url)); + SharedPtr<ClientInterface> client = me->_engine.broadcaster()->client(url); if (client) client->disable(); else @@ -334,7 +330,7 @@ OSCEngineReceiver::_register_client_cb(const char* path, const char* types, lo_a char* const url = lo_address_get_url(addr); SharedPtr<ClientInterface> client(new OSCClientSender((const char*)url)); - register_client(ClientKey(ClientKey::OSC_URL, (const char*)url), client); + register_client(url, client); free(url); return 0; @@ -351,7 +347,7 @@ OSCEngineReceiver::_unregister_client_cb(const char* path, const char* types, lo lo_address addr = lo_message_get_source(msg); char* url = lo_address_get_url(addr); - unregister_client(ClientKey(ClientKey::OSC_URL, url)); + unregister_client(url); free(url); return 0; @@ -757,12 +753,12 @@ OSCEngineReceiver::_metadata_set_cb(const char* path, const char* types, lo_arg* if (argc != 4 || types[0] != 'i' || types[1] != 's' || types[2] != 's') return 1; - const char* node_path = &argv[1]->s; + const char* object_path = &argv[1]->s; const char* key = &argv[2]->s; Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(types[3], argv[3]); - set_metadata(node_path, key, value); + set_metadata(object_path, key, value); return 0; } @@ -779,18 +775,11 @@ OSCEngineReceiver::_metadata_set_cb(const char* path, const char* types, lo_arg* int OSCEngineReceiver::_metadata_get_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - /* - const char* node_path = &argv[1]->s; + const char* object_path = &argv[1]->s; const char* key = &argv[2]->s; - */ - cerr << "FIXME: OSC metadata request\n"; - // FIXME: Equivalent? - /* - RequestMetadataEvent* ev = new RequestMetadataEvent( - new OSCResponder(ClientKey(addr)), - node_path, key); - */ + request_metadata(object_path, key); + return 0; } diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp index 40a3801b..478af249 100644 --- a/src/libs/engine/OSCEngineReceiver.hpp +++ b/src/libs/engine/OSCEngineReceiver.hpp @@ -108,6 +108,7 @@ private: LO_HANDLER(request_plugin); LO_HANDLER(request_object); LO_HANDLER(request_port_value); + LO_HANDLER(request_metadata); LO_HANDLER(request_plugins); LO_HANDLER(request_all_objects); diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp index 71104be4..a966a2d3 100644 --- a/src/libs/engine/OSCResponder.cpp +++ b/src/libs/engine/OSCResponder.cpp @@ -17,7 +17,6 @@ #include "OSCResponder.hpp" #include "ClientBroadcaster.hpp" -#include "interface/ClientKey.hpp" #include <cstdlib> #include <iostream> #include <inttypes.h> @@ -90,7 +89,7 @@ SharedPtr<ClientInterface> OSCResponder::client() { if (_broadcaster) - return _broadcaster->client(client_key()); + return _broadcaster->client(client_uri()); else return SharedPtr<ClientInterface>(); } diff --git a/src/libs/engine/OSCResponder.hpp b/src/libs/engine/OSCResponder.hpp index a7b0968d..b536c169 100644 --- a/src/libs/engine/OSCResponder.hpp +++ b/src/libs/engine/OSCResponder.hpp @@ -19,6 +19,7 @@ #define OSCRESPONDER_H #include <inttypes.h> +#include <string> #include <memory> #include <lo/lo.h> #include "interface/Responder.hpp" @@ -51,8 +52,7 @@ public: const char* url() const { return _url; } - Shared::ClientKey client_key() - { return Shared::ClientKey(Shared::ClientKey::OSC_URL, _url); } + std::string client_uri() { return _url; } SharedPtr<Shared::ClientInterface> client(); diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 2abb5a1c..f54f850a 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -25,9 +25,9 @@ namespace Ingen { QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size) -: QueuedEventSource(queued_size, stamped_size) -, _responder(SharedPtr<Shared::Responder>(new Shared::Responder())) // NULL responder -, _engine(engine) + : QueuedEventSource(queued_size, stamped_size) + , _responder(SharedPtr<Shared::Responder>(new Shared::Responder())) // NULL responder + , _engine(engine) { } @@ -74,16 +74,16 @@ QueuedEngineInterface::disable_responses() void -QueuedEngineInterface::register_client(ClientKey key, SharedPtr<ClientInterface> client) +QueuedEngineInterface::register_client(const string& uri, SharedPtr<ClientInterface> client) { - push_queued(new RegisterClientEvent(_engine, _responder, now(), key, client)); + push_queued(new RegisterClientEvent(_engine, _responder, now(), uri, client)); } void -QueuedEngineInterface::unregister_client(ClientKey key) +QueuedEngineInterface::unregister_client(const string& uri) { - push_queued(new UnregisterClientEvent(_engine, _responder, now(), key)); + push_queued(new UnregisterClientEvent(_engine, _responder, now(), uri)); } diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp index 204338bf..889b8f8e 100644 --- a/src/libs/engine/QueuedEngineInterface.hpp +++ b/src/libs/engine/QueuedEngineInterface.hpp @@ -24,7 +24,6 @@ #include <raul/SharedPtr.hpp> #include "interface/EngineInterface.hpp" #include "interface/ClientInterface.hpp" -#include "interface/ClientKey.hpp" #include "interface/Responder.hpp" #include "QueuedEventSource.hpp" #include "Engine.hpp" @@ -32,7 +31,6 @@ using std::string; namespace Ingen { -using Shared::ClientKey; using Shared::ClientInterface; using Shared::EngineInterface; class Engine; @@ -70,8 +68,8 @@ public: virtual void disable_responses(); // Client registration - virtual void register_client(ClientKey key, SharedPtr<ClientInterface> client); - virtual void unregister_client(ClientKey key); + virtual void register_client(const string& uri, SharedPtr<ClientInterface> client); + virtual void unregister_client(const string& uri); // Engine commands @@ -148,6 +146,8 @@ public: virtual void request_object(const string& path); virtual void request_port_value(const string& port_path); + + virtual void request_metadata(const string& path, const string& key); virtual void request_plugins(); diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index ace2b3e0..ac2dbbc3 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -23,13 +23,14 @@ namespace Ingen { -RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, - SampleCount timestamp, - ClientKey key, - SharedPtr<ClientInterface> client) -: QueuedEvent(engine, responder, timestamp) -, _key(key) -, _client(client) +RegisterClientEvent::RegisterClientEvent(Engine& engine, + SharedPtr<Shared::Responder> responder, + SampleCount timestamp, + const string& uri, + SharedPtr<ClientInterface> client) + : QueuedEvent(engine, responder, timestamp) + , _uri(uri) + , _client(client) { } @@ -37,7 +38,7 @@ RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Shared::Respo void RegisterClientEvent::pre_process() { - _engine.broadcaster()->register_client(_key, _client); + _engine.broadcaster()->register_client(_uri, _client); QueuedEvent::pre_process(); } diff --git a/src/libs/engine/events/RegisterClientEvent.hpp b/src/libs/engine/events/RegisterClientEvent.hpp index be02fd41..90528956 100644 --- a/src/libs/engine/events/RegisterClientEvent.hpp +++ b/src/libs/engine/events/RegisterClientEvent.hpp @@ -19,12 +19,10 @@ #define REGISTERCLIENTEVENT_H #include "QueuedEvent.hpp" -#include "interface/ClientKey.hpp" #include "interface/ClientInterface.hpp" #include <string> using std::string; using Ingen::Shared::ClientInterface; -using Ingen::Shared::ClientKey; using Ingen::Shared::Responder; namespace Ingen { @@ -40,14 +38,14 @@ public: RegisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, - ClientKey key, + const string& uri, SharedPtr<ClientInterface> client); void pre_process(); void post_process(); private: - ClientKey _key; + string _uri; SharedPtr<ClientInterface> _client; }; diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index a6940442..4b068536 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -34,7 +34,7 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(Engine& engine, SharedPtr<Shared: void RequestAllObjectsEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); QueuedEvent::pre_process(); } diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index 5000256f..b9696c4a 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -41,7 +41,7 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr<Shared::Res void RequestMetadataEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); if (_client) { _object = _engine.object_store()->find(_path); diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp index 25f95d00..8efe37b7 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -43,7 +43,7 @@ RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Shared::Respond void RequestObjectEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); _object = _engine.object_store()->find(_path); QueuedEvent::pre_process(); diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index 4e1a1660..981c98e7 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -42,7 +42,7 @@ RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Shared::Respond void RequestPluginEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); _plugin = _engine.node_factory()->plugin(_uri); QueuedEvent::pre_process(); diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp index 3976dd08..50271b7f 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -33,7 +33,7 @@ RequestPluginsEvent::RequestPluginsEvent(Engine& engine, SharedPtr<Shared::Respo void RequestPluginsEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); // Take a copy to send in the post processing thread (to avoid problems // because std::list isn't thread safe) diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index 7444068e..113369b3 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -42,7 +42,7 @@ RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Shared::R void RequestPortValueEvent::pre_process() { - _client = _engine.broadcaster()->client(_responder->client_key()); + _client = _engine.broadcaster()->client(_responder->client_uri()); _port = _engine.object_store()->find_port(_port_path); QueuedEvent::pre_process(); diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index be03f151..11424003 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -24,9 +24,9 @@ namespace Ingen { -UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, ClientKey key) +UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, const string& uri) : QueuedEvent(engine, responder, timestamp) -, _key(key) +, _uri(uri) { } @@ -34,7 +34,7 @@ UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Shared::R void UnregisterClientEvent::post_process() { - if (_engine.broadcaster()->unregister_client(_key)) + if (_engine.broadcaster()->unregister_client(_uri)) _responder->respond_ok(); else _responder->respond_error("Unable to unregister client"); diff --git a/src/libs/engine/events/UnregisterClientEvent.hpp b/src/libs/engine/events/UnregisterClientEvent.hpp index 17d85b93..500c1250 100644 --- a/src/libs/engine/events/UnregisterClientEvent.hpp +++ b/src/libs/engine/events/UnregisterClientEvent.hpp @@ -19,7 +19,6 @@ #define UNREGISTERCLIENTEVENT_H #include "QueuedEvent.hpp" -#include "interface/ClientKey.hpp" #include <string> using std::string; @@ -27,10 +26,8 @@ namespace Ingen { namespace Shared { class ClientInterface; - class ClientKey; } using Shared::ClientInterface; -using Shared::ClientKey; /** Unregisters an OSC client so it no longer receives notifications. @@ -43,12 +40,12 @@ public: UnregisterClientEvent(Engine& engine, SharedPtr<Shared::Responder> responder, SampleCount timestamp, - ClientKey key); + const string& uri); void post_process(); private: - ClientKey _key; + string _uri; }; |