diff options
author | David Robillard <d@drobilla.net> | 2010-02-03 20:39:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-03 20:39:18 +0000 |
commit | aef3c9348218029a077f40081fd078a9e2ee85ca (patch) | |
tree | b77d6ef50f66004129a03cb0751b653336c50f14 /src/engine | |
parent | 3e495d47f06cca50521076e8f77a966dfec521ab (diff) | |
download | ingen-aef3c9348218029a077f40081fd078a9e2ee85ca.tar.gz ingen-aef3c9348218029a077f40081fd078a9e2ee85ca.tar.bz2 ingen-aef3c9348218029a077f40081fd078a9e2ee85ca.zip |
Responder => Request, and handle EventSource unblocking from Request (simplify Event interfaces).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2417 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
54 files changed, 381 insertions, 389 deletions
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp index 482d25e6..7dac9915 100644 --- a/src/engine/ClientBroadcaster.cpp +++ b/src/engine/ClientBroadcaster.cpp @@ -70,11 +70,8 @@ ClientBroadcaster::unregister_client(const URI& uri) -/** Looks up the client with the given @a source address (which is used as the +/** Looks up the client with the given source @a uri (which is used as the * unique identifier for registered clients). - * - * (A responder is passed to remove the dependency on liblo addresses in request - * events, in anticipation of libom and multiple ways of responding to clients). */ ClientInterface* ClientBroadcaster::client(const URI& uri) diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index e57c144f..78420e3a 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -183,8 +183,8 @@ Engine::activate() properties.insert(make_pair(uris.lv2_name, "Control")); properties.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort)); properties.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); - Events::CreatePort* ev = new Events::CreatePort(*this, SharedPtr<Responder>(), 0, - "/ingen_control", uris.lv2ev_EventPort, false, NULL, properties); + Events::CreatePort* ev = new Events::CreatePort(*this, SharedPtr<Request>(), 0, + "/ingen_control", uris.lv2ev_EventPort, false, properties); ev->pre_process(); ProcessContext context(*this); ev->execute(context); diff --git a/src/engine/Event.hpp b/src/engine/Event.hpp index d4ee596b..bac8464a 100644 --- a/src/engine/Event.hpp +++ b/src/engine/Event.hpp @@ -27,7 +27,7 @@ namespace Ingen { class Engine; -class Responder; +class Request; class ProcessContext; @@ -57,17 +57,17 @@ public: inline SampleCount time() const { return _time; } protected: - Event(Engine& engine, SharedPtr<Responder> responder, FrameTime time) + Event(Engine& engine, SharedPtr<Request> request, FrameTime time) : _engine(engine) - , _responder(responder) + , _request(request) , _time(time) , _executed(false) {} - Engine& _engine; - SharedPtr<Responder> _responder; - FrameTime _time; - bool _executed; + Engine& _engine; + SharedPtr<Request> _request; + FrameTime _time; + bool _executed; }; diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index 2ddfaa59..5b939992 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -179,16 +179,16 @@ OSCEngineReceiver::ReceiveThread::_run() } -/** Create a new responder for this message, if necessary. +/** Create a new request for this message, if necessary. * - * This is based on the fact that the current responder is stored in a ref + * This is based on the fact that the current request is stored in a ref * counted pointer, and events just take a reference to that. Thus, events - * may delete their responder if we've since switched to a new one, or the + * may delete their request if we've since switched to a new one, or the * same one can stay around and serve a series of events. * Hooray for reference counting. * * If this message came from the same source as the last message, no allocation - * of responders or lo_addresses or any of it needs to be done. Unfortunately + * of requests or lo_addresses or any of it needs to be done. Unfortunately * the only way to check is by comparing URLs, because liblo addresses suck. * Lack of a fast liblo address comparison really sucks here, in any case. */ @@ -205,15 +205,15 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, const lo_address addr = lo_message_get_source(msg); char* const url = lo_address_get_url(addr); - const SharedPtr<Responder> r = me->_responder; + const SharedPtr<Request> r = me->_request; /* Different address than last time, have to do a lookup */ if (!r || !r->client() || strcmp(url, r->client()->uri().c_str())) { Shared::ClientInterface* client = me->_engine.broadcaster()->client(url); if (client) - me->_responder = SharedPtr<Responder>(new Responder(client, id)); + me->_request = SharedPtr<Request>(new Request(me, client, id)); else - me->_responder = SharedPtr<Responder>(new Responder()); + me->_request = SharedPtr<Request>(new Request(me)); } if (id != -1) { diff --git a/src/engine/OSCEngineReceiver.hpp b/src/engine/OSCEngineReceiver.hpp index c70f680f..7279913f 100644 --- a/src/engine/OSCEngineReceiver.hpp +++ b/src/engine/OSCEngineReceiver.hpp @@ -21,7 +21,7 @@ #include <stdint.h> #include <lo/lo.h> #include "QueuedEngineInterface.hpp" -#include "Responder.hpp" +#include "Request.hpp" namespace Ingen { diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 42978832..dbbc0099 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -34,7 +34,7 @@ using namespace Shared; QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queue_size) : EventSource(queue_size) - , _responder(new Responder(NULL, 0)) + , _request(new Request(this, NULL, 0)) , _engine(engine) , _in_bundle(false) { @@ -56,16 +56,16 @@ QueuedEngineInterface::now() const void QueuedEngineInterface::set_next_response_id(int32_t id) { - if (_responder) - _responder->set_id(id); + if (_request) + _request->set_id(id); } void QueuedEngineInterface::disable_responses() { - _responder->set_client(NULL); - _responder->set_id(0); + _request->set_client(NULL); + _request->set_id(0); } @@ -75,12 +75,12 @@ QueuedEngineInterface::disable_responses() void QueuedEngineInterface::register_client(ClientInterface* client) { - push_queued(new Events::RegisterClient(_engine, _responder, now(), client->uri(), client)); - if (!_responder) { - _responder = SharedPtr<Responder>(new Responder(client, 1)); + push_queued(new Events::RegisterClient(_engine, _request, now(), client->uri(), client)); + if (!_request) { + _request = SharedPtr<Request>(new Request(this, client, 1)); } else { - _responder->set_id(1); - _responder->set_client(client); + _request->set_id(1); + _request->set_client(client); } } @@ -88,10 +88,10 @@ QueuedEngineInterface::register_client(ClientInterface* client) void QueuedEngineInterface::unregister_client(const URI& uri) { - push_queued(new Events::UnregisterClient(_engine, _responder, now(), uri)); - if (_responder && _responder->client() && _responder->client()->uri() == uri) { - _responder->set_id(0); - _responder->set_client(NULL); + push_queued(new Events::UnregisterClient(_engine, _request, now(), uri)); + if (_request && _request->client() && _request->client()->uri() == uri) { + _request->set_id(0); + _request->set_client(NULL); } } @@ -101,7 +101,7 @@ QueuedEngineInterface::unregister_client(const URI& uri) void QueuedEngineInterface::load_plugins() { - push_queued(new Events::LoadPlugins(_engine, _responder, now(), this)); + push_queued(new Events::LoadPlugins(_engine, _request, now())); } @@ -114,7 +114,7 @@ QueuedEngineInterface::activate() _engine.activate(); } EventSource::activate_source(); - push_queued(new Events::Ping(_engine, _responder, now())); + push_queued(new Events::Ping(_engine, _request, now())); in_activate = false; } @@ -122,14 +122,14 @@ QueuedEngineInterface::activate() void QueuedEngineInterface::deactivate() { - push_queued(new Events::Deactivate(_engine, _responder, now())); + push_queued(new Events::Deactivate(_engine, _request, now())); } void QueuedEngineInterface::quit() { - _responder->respond_ok(); + _request->respond_ok(); _engine.quit(); } @@ -166,7 +166,7 @@ QueuedEngineInterface::put(const URI& uri, LOG(debug) << " " << i->first << " = " << i->second << " :: " << i->second.type() << endl; LOG(debug) << "}" << endl; - push_queued(new Events::SetMetadata(_engine, _responder, now(), this, true, meta, subject, properties)); + push_queued(new Events::SetMetadata(_engine, _request, now(), true, meta, subject, properties)); } @@ -174,14 +174,14 @@ void QueuedEngineInterface::move(const Path& old_path, const Path& new_path) { - push_queued(new Events::Move(_engine, _responder, now(), old_path, new_path)); + push_queued(new Events::Move(_engine, _request, now(), old_path, new_path)); } void QueuedEngineInterface::del(const Path& path) { - push_queued(new Events::Delete(_engine, _responder, now(), this, path)); + push_queued(new Events::Delete(_engine, _request, now(), path)); } @@ -189,7 +189,7 @@ void QueuedEngineInterface::connect(const Path& src_port_path, const Path& dst_port_path) { - push_queued(new Events::Connect(_engine, _responder, now(), src_port_path, dst_port_path)); + push_queued(new Events::Connect(_engine, _request, now(), src_port_path, dst_port_path)); } @@ -198,7 +198,7 @@ void QueuedEngineInterface::disconnect(const Path& src_port_path, const Path& dst_port_path) { - push_queued(new Events::Disconnect(_engine, _responder, now(), src_port_path, dst_port_path)); + push_queued(new Events::Disconnect(_engine, _request, now(), src_port_path, dst_port_path)); } @@ -206,7 +206,7 @@ void QueuedEngineInterface::disconnect_all(const Path& patch_path, const Path& path) { - push_queued(new Events::DisconnectAll(_engine, _responder, now(), patch_path, path)); + push_queued(new Events::DisconnectAll(_engine, _request, now(), patch_path, path)); } @@ -215,14 +215,14 @@ QueuedEngineInterface::set_voice_value(const Path& port_path, uint32_t voice, const Raul::Atom& value) { - push_queued(new Events::SetPortValue(_engine, _responder, true, now(), voice, port_path, value)); + push_queued(new Events::SetPortValue(_engine, _request, true, now(), voice, port_path, value)); } void QueuedEngineInterface::learn(const Path& path) { - push_queued(new Events::Learn(_engine, _responder, now(), path)); + push_queued(new Events::Learn(_engine, _request, now(), path)); } @@ -236,7 +236,7 @@ QueuedEngineInterface::set_property(const URI& uri, Path path = meta ? (string("/") + path.chop_start("/")) : uri.str(); Resource::Properties properties; properties.insert(make_pair(predicate, value)); - push_queued(new Events::SetMetadata(_engine, _responder, now(), this, true, meta, path, properties)); + push_queued(new Events::SetMetadata(_engine, _request, now(), true, meta, path, properties)); } // Requests // @@ -245,9 +245,9 @@ void QueuedEngineInterface::ping() { if (_engine.activated()) { - push_queued(new Events::Ping(_engine, _responder, now())); - } else if (_responder) { - _responder->respond_ok(); + push_queued(new Events::Ping(_engine, _request, now())); + } else if (_request) { + _request->respond_ok(); } } @@ -255,7 +255,7 @@ QueuedEngineInterface::ping() void QueuedEngineInterface::get(const URI& uri) { - push_queued(new Events::Get(_engine, _responder, now(), uri)); + push_queued(new Events::Get(_engine, _request, now(), uri)); } @@ -266,23 +266,23 @@ QueuedEngineInterface::request_property(const URI& uri, const URI& key) bool meta = (hash != string::npos); const string path_str = string("/") + uri.chop_start("/"); if (meta && Path::is_valid(path_str)) - push_queued(new Events::RequestMetadata(_engine, _responder, now(), meta, path_str, key)); + push_queued(new Events::RequestMetadata(_engine, _request, now(), meta, path_str, key)); else - push_queued(new Events::RequestMetadata(_engine, _responder, now(), meta, uri, key)); + push_queued(new Events::RequestMetadata(_engine, _request, now(), meta, uri, key)); } void QueuedEngineInterface::request_plugins() { - push_queued(new Events::RequestPlugins(_engine, _responder, now())); + push_queued(new Events::RequestPlugins(_engine, _request, now())); } void QueuedEngineInterface::request_all_objects() { - push_queued(new Events::RequestAllObjects(_engine, _responder, now())); + push_queued(new Events::RequestAllObjects(_engine, _request, now())); } diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index 23ab608b..463cdfc3 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -26,7 +26,7 @@ #include "interface/EngineInterface.hpp" #include "interface/Resource.hpp" #include "EventSource.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "tuning.hpp" #include "types.hpp" @@ -42,7 +42,7 @@ class Engine; * * Responses occur through the event mechanism (which notified clients in * event post_process methods) and are related to an event by an integer ID. - * If you do not register a responder, you have no way of knowing if your calls + * If you do not register a request, you have no way of knowing if your calls * are successful. */ class QueuedEngineInterface : public EventSource, public Shared::EngineInterface @@ -110,9 +110,9 @@ public: protected: virtual void disable_responses(); - SharedPtr<Responder> _responder; ///< NULL if responding disabled - Engine& _engine; - bool _in_bundle; ///< True iff a bundle is currently being received + SharedPtr<Request> _request; ///< NULL if responding disabled + Engine& _engine; + bool _in_bundle; ///< True iff a bundle is currently being received private: SampleCount now() const; diff --git a/src/engine/QueuedEvent.hpp b/src/engine/QueuedEvent.hpp index ab82b474..a75701c9 100644 --- a/src/engine/QueuedEvent.hpp +++ b/src/engine/QueuedEvent.hpp @@ -22,8 +22,6 @@ namespace Ingen { -class EventSource; - /** An Event with a not-time-critical preprocessing stage. * @@ -53,28 +51,24 @@ public: bool is_prepared() { return _pre_processed; } protected: - QueuedEvent(Engine& engine, - SharedPtr<Responder> responder, - FrameTime time, - bool blocking = false, - EventSource* source = NULL) - : Event(engine, responder, time) - , _source(source) + QueuedEvent(Engine& engine, + SharedPtr<Request> request, + FrameTime time, + bool blocking=false) + : Event(engine, request, time) , _pre_processed(false) , _blocking(blocking) {} // NULL event base (for internal events only!) QueuedEvent(Engine& engine) - : Event(engine, SharedPtr<Responder>(), 0) - , _source(NULL) + : Event(engine, SharedPtr<Request>(), 0) , _pre_processed(false) , _blocking(false) {} - EventSource* _source; - bool _pre_processed; - bool _blocking; + bool _pre_processed; + bool _blocking; }; diff --git a/src/engine/Responder.hpp b/src/engine/Request.hpp index 625d88e6..80c0cf42 100644 --- a/src/engine/Responder.hpp +++ b/src/engine/Request.hpp @@ -15,39 +15,47 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef INGEN_ENGINE_RESPONDER_HPP -#define INGEN_ENGINE_RESPONDER_HPP +#ifndef INGEN_ENGINE_REQUEST_HPP +#define INGEN_ENGINE_REQUEST_HPP #include <inttypes.h> #include <string> #include "interface/ClientInterface.hpp" +#include "EventSource.hpp" namespace Ingen { -/** Class to handle responding to clients. +/** Record of a request (used to respond to clients). * * This is a glorified std::pair<ClientInterface*, int32_t> for replying * to numbered messages from a client. * - * For responses that involve more messages, the response will come first + * For responses that involve several messages, the response will come first * followed by the messages (eg object notifications, values, errors, etc.) * in a bundle (or "transfer" if too large). */ -class Responder +class Request { public: - Responder(Shared::ClientInterface* client=0, int32_t id=1) - : _client(client) + Request(EventSource* source=0, Shared::ClientInterface* client=0, int32_t id=1) + : _source(source) + , _client(client) , _id(id) {} - int32_t id() const { return _id; } - void set_id(int32_t id) { _id = id; } + EventSource* source() { return _source; } + int32_t id() const { return _id; } + void set_id(int32_t id) { _id = id; } Shared::ClientInterface* client() const { return _client; } void set_client(Shared::ClientInterface* client) { _client = client; } + void unblock() { + if (_source) + _source->unblock(); + } + void respond_ok() { if (_client) _client->response_ok(_id); @@ -59,6 +67,7 @@ public: } private: + EventSource* _source; Shared::ClientInterface* _client; int32_t _id; }; @@ -66,5 +75,5 @@ private: } // namespace Ingen -#endif // INGEN_ENGINE_RESPONDER_HPP +#endif // INGEN_ENGINE_REQUEST_HPP diff --git a/src/engine/events/AllNotesOff.cpp b/src/engine/events/AllNotesOff.cpp index 8ce27c87..1c5e281b 100644 --- a/src/engine/events/AllNotesOff.cpp +++ b/src/engine/events/AllNotesOff.cpp @@ -16,7 +16,7 @@ */ #include "AllNotesOff.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "EngineStore.hpp" #include "shared/Store.hpp" @@ -29,8 +29,8 @@ namespace Events { /** Note off with patch explicitly passed - triggered by MIDI. */ -AllNotesOff::AllNotesOff(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PatchImpl* patch) -: Event(engine, responder, timestamp), +AllNotesOff::AllNotesOff(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, PatchImpl* patch) +: Event(engine, request, timestamp), _patch(patch) { } @@ -38,8 +38,8 @@ AllNotesOff::AllNotesOff(Engine& engine, SharedPtr<Responder> responder, SampleC /** Note off event with lookup - triggered by OSC. */ -AllNotesOff::AllNotesOff(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& patch_path) -: Event(engine, responder, timestamp), +AllNotesOff::AllNotesOff(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& patch_path) +: Event(engine, request, timestamp), _patch_path(patch_path), _patch(NULL) { @@ -64,7 +64,7 @@ void AllNotesOff::post_process() { if (_patch != NULL) - _responder->respond_ok(); + _request->respond_ok(); } diff --git a/src/engine/events/AllNotesOff.hpp b/src/engine/events/AllNotesOff.hpp index f4c07f7d..1b18c0ae 100644 --- a/src/engine/events/AllNotesOff.hpp +++ b/src/engine/events/AllNotesOff.hpp @@ -34,8 +34,8 @@ namespace Events { class AllNotesOff : public Event { public: - AllNotesOff(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PatchImpl* patch); - AllNotesOff(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& patch_path); + AllNotesOff(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, PatchImpl* patch); + AllNotesOff(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& patch_path); void execute(ProcessContext& context); void post_process(); diff --git a/src/engine/events/Connect.cpp b/src/engine/events/Connect.cpp index a79fe243..1654645c 100644 --- a/src/engine/events/Connect.cpp +++ b/src/engine/events/Connect.cpp @@ -28,7 +28,7 @@ #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "types.hpp" using namespace std; @@ -40,8 +40,8 @@ namespace Events { using namespace Shared; -Connect::Connect(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& src_port_path, const Path& dst_port_path) - : QueuedEvent(engine, responder, timestamp) +Connect::Connect(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& src_port_path, const Path& dst_port_path) + : QueuedEvent(engine, request, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -185,7 +185,7 @@ Connect::post_process() { std::ostringstream ss; if (_error == NO_ERROR) { - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->connect(_src_port_path, _dst_port_path); return; } @@ -209,7 +209,7 @@ Connect::post_process() ss << "Unknown error"; } ss << ")"; - _responder->respond_error(ss.str()); + _request->respond_error(ss.str()); } diff --git a/src/engine/events/Connect.hpp b/src/engine/events/Connect.hpp index f8e2cdfa..7f88d160 100644 --- a/src/engine/events/Connect.hpp +++ b/src/engine/events/Connect.hpp @@ -50,7 +50,7 @@ namespace Events { class Connect : public QueuedEvent { public: - Connect(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path); + Connect(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp index 4d3af4db..426044ee 100644 --- a/src/engine/events/CreateNode.cpp +++ b/src/engine/events/CreateNode.cpp @@ -20,7 +20,7 @@ #include "raul/Path.hpp" #include "redlandmm/World.hpp" #include "CreateNode.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" @@ -42,13 +42,13 @@ using namespace Shared; CreateNode::CreateNode( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Path& path, const URI& plugin_uri, bool polyphonic, const Resource::Properties& properties) - : QueuedEvent(engine, responder, timestamp) + : QueuedEvent(engine, request, timestamp) , _path(path) , _plugin_uri(plugin_uri) , _polyphonic(polyphonic) @@ -127,25 +127,25 @@ CreateNode::execute(ProcessContext& context) void CreateNode::post_process() { - if (!_responder) + if (!_request) return; string msg; if (_node_already_exists) { msg = string("Could not create node - ").append(_path.str());// + " already exists."; - _responder->respond_error(msg); + _request->respond_error(msg); } else if (_patch == NULL) { msg = "Could not find patch '" + _path.parent().str() +"' to add node."; - _responder->respond_error(msg); + _request->respond_error(msg); } else if (_plugin == NULL) { msg = "Unable to load node "; msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")"; - _responder->respond_error(msg); + _request->respond_error(msg); } else if (_node == NULL) { msg = "Failed to instantiate plugin " + _plugin_uri.str(); - _responder->respond_error(msg); + _request->respond_error(msg); } else { - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->send_object(_node, true); // yes, send ports } } diff --git a/src/engine/events/CreateNode.hpp b/src/engine/events/CreateNode.hpp index 389c0ff5..4bb7e0b5 100644 --- a/src/engine/events/CreateNode.hpp +++ b/src/engine/events/CreateNode.hpp @@ -41,7 +41,7 @@ class CreateNode : public QueuedEvent public: CreateNode( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& node_path, const Raul::URI& plugin_uri, diff --git a/src/engine/events/CreatePatch.cpp b/src/engine/events/CreatePatch.cpp index 5d72f13a..c90e2c17 100644 --- a/src/engine/events/CreatePatch.cpp +++ b/src/engine/events/CreatePatch.cpp @@ -19,7 +19,7 @@ #include "raul/Path.hpp" #include "shared/LV2URIMap.hpp" #include "events/CreatePatch.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" @@ -39,12 +39,12 @@ using namespace Shared; CreatePatch::CreatePatch( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path, int poly, const Resource::Properties& properties) - : QueuedEvent(engine, responder, timestamp) + : QueuedEvent(engine, request, timestamp) , _path(path) , _patch(NULL) , _parent(NULL) @@ -134,32 +134,32 @@ void CreatePatch::post_process() { string msg; - if (_responder) { + if (_request) { switch (_error) { case NO_ERROR: - _responder->respond_ok(); + _request->respond_ok(); // Don't send ports/nodes that have been added since prepare() // (otherwise they would be sent twice) _engine.broadcaster()->send_object(_patch, false); break; case OBJECT_EXISTS: - _responder->respond_ok(); + _request->respond_ok(); /*string msg = "Unable to create patch: "; msg.append(_path).append(" already exists."); - _responder->respond_error(msg);*/ + _request->respond_error(msg);*/ break; case PARENT_NOT_FOUND: msg = "Unable to create patch: Parent "; msg.append(Path(_path).parent().str()).append(" not found."); - _responder->respond_error(msg); + _request->respond_error(msg); break; case INVALID_POLY: msg = "Unable to create patch "; - msg.append(_path.str()).append(": ").append("Invalid polyphony respondered."); - _responder->respond_error(msg); + msg.append(_path.str()).append(": ").append("Invalid polyphony requested."); + _request->respond_error(msg); break; default: - _responder->respond_error("Unable to load patch."); + _request->respond_error("Unable to load patch."); } } } diff --git a/src/engine/events/CreatePatch.hpp b/src/engine/events/CreatePatch.hpp index a9f1281e..2db36d35 100644 --- a/src/engine/events/CreatePatch.hpp +++ b/src/engine/events/CreatePatch.hpp @@ -38,7 +38,7 @@ class CreatePatch : public QueuedEvent public: CreatePatch( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path, int poly, diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index 151181f4..7b63f6c5 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -28,12 +28,11 @@ #include "DuplexPort.hpp" #include "Engine.hpp" #include "EngineStore.hpp" -#include "EventSource.hpp" #include "PatchImpl.hpp" #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" using namespace std; using namespace Raul; @@ -46,14 +45,13 @@ using namespace Shared; CreatePort::CreatePort( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path, const Raul::URI& type, bool is_output, - EventSource* source, const Resource::Properties& properties) - : QueuedEvent(engine, responder, timestamp, true, source) + : QueuedEvent(engine, request, timestamp, true) , _error(NO_ERROR) , _path(path) , _type(type) @@ -146,30 +144,30 @@ CreatePort::execute(ProcessContext& context) _engine.driver()->add_port(_driver_port); } - if (_source) - _source->unblock(); + if (_request) + _request->unblock(); } void CreatePort::post_process() { - if (!_responder) + if (!_request) return; string msg; switch (_error) { case NO_ERROR: - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->send_object(_patch_port, true); break; case UNKNOWN_TYPE: msg = string("Could not create port ") + _path.str() + " (Unknown type)"; - _responder->respond_error(msg); + _request->respond_error(msg); break; case CREATION_FAILED: msg = string("Could not create port ") + _path.str() + " (Creation failed)"; - _responder->respond_error(msg); + _request->respond_error(msg); break; } } diff --git a/src/engine/events/CreatePort.hpp b/src/engine/events/CreatePort.hpp index ad8ab5bf..b901dbf4 100644 --- a/src/engine/events/CreatePort.hpp +++ b/src/engine/events/CreatePort.hpp @@ -42,12 +42,11 @@ class CreatePort : public QueuedEvent public: CreatePort( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path, const Raul::URI& type, bool is_output, - EventSource* source, const Shared::Resource::Properties& properties); void pre_process(); diff --git a/src/engine/events/Deactivate.hpp b/src/engine/events/Deactivate.hpp index 609430d9..66e84a4a 100644 --- a/src/engine/events/Deactivate.hpp +++ b/src/engine/events/Deactivate.hpp @@ -32,12 +32,12 @@ namespace Events { class Deactivate : public QueuedEvent { public: - Deactivate(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp) - : QueuedEvent(engine, responder, timestamp) + Deactivate(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) + : QueuedEvent(engine, request, timestamp) {} void post_process() { - _responder->respond_ok(); + _request->respond_ok(); _engine.deactivate(); } }; diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp index 30166c51..82681c08 100644 --- a/src/engine/events/Delete.cpp +++ b/src/engine/events/Delete.cpp @@ -24,12 +24,11 @@ #include "Driver.hpp" #include "Engine.hpp" #include "EngineStore.hpp" -#include "EventSource.hpp" #include "NodeBase.hpp" #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" using namespace std; @@ -39,8 +38,8 @@ namespace Events { using namespace Shared; -Delete::Delete(Engine& engine, SharedPtr<Responder> responder, FrameTime time, EventSource* source, const Raul::Path& path) - : QueuedEvent(engine, responder, time, true, source) +Delete::Delete(Engine& engine, SharedPtr<Request> request, FrameTime time, const Raul::Path& path) + : QueuedEvent(engine, request, time, true) , _path(path) , _store_iterator(engine.engine_store()->end()) , _driver_port(NULL) @@ -50,7 +49,8 @@ Delete::Delete(Engine& engine, SharedPtr<Responder> responder, FrameTime time, E , _compiled_patch(NULL) , _disconnect_event(NULL) { - assert(_source); + assert(request); + assert(request->source()); } @@ -159,8 +159,7 @@ Delete::execute(ProcessContext& context) } } - if (_source) - _source->unblock(); + _request->unblock(); } @@ -171,17 +170,17 @@ Delete::post_process() if (!_node && !_port) { if (_path.is_root()) { - _responder->respond_error("You can not destroy the root patch (/)"); + _request->respond_error("You can not destroy the root patch (/)"); } else { string msg = string("Could not find object ") + _path.str() + " to destroy"; - _responder->respond_error(msg); + _request->respond_error(msg); } } if (_patch_node_listnode) { assert(_node); _node->deactivate(); - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->bundle_begin(); if (_disconnect_event) _disconnect_event->post_process(); @@ -190,7 +189,7 @@ Delete::post_process() _engine.maid()->push(_patch_node_listnode); } else if (_patch_port_listnode) { assert(_port); - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->bundle_begin(); if (_disconnect_event) _disconnect_event->post_process(); @@ -198,7 +197,7 @@ Delete::post_process() _engine.broadcaster()->bundle_end(); _engine.maid()->push(_patch_port_listnode); } else { - _responder->respond_error("Unable to destroy object"); + _request->respond_error("Unable to destroy object"); } if (_driver_port) { diff --git a/src/engine/events/Delete.hpp b/src/engine/events/Delete.hpp index 8ad8ac12..be786c56 100644 --- a/src/engine/events/Delete.hpp +++ b/src/engine/events/Delete.hpp @@ -59,11 +59,10 @@ class Delete : public QueuedEvent { public: Delete( - Engine& engine, - SharedPtr<Responder> responder, - FrameTime timestamp, - EventSource* source, - const Raul::Path& path); + Engine& engine, + SharedPtr<Request> request, + FrameTime timestamp, + const Raul::Path& path); ~Delete(); diff --git a/src/engine/events/Disconnect.cpp b/src/engine/events/Disconnect.cpp index 007886f1..d1cfefe6 100644 --- a/src/engine/events/Disconnect.cpp +++ b/src/engine/events/Disconnect.cpp @@ -19,7 +19,7 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" #include "events/Disconnect.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "ConnectionImpl.hpp" #include "InputPort.hpp" @@ -37,12 +37,12 @@ namespace Events { Disconnect::Disconnect( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::Path& src_port_path, - const Raul::Path& dst_port_path) - : QueuedEvent(engine, responder, timestamp) + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::Path& src_port_path, + const Raul::Path& dst_port_path) + : QueuedEvent(engine, request, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -58,19 +58,19 @@ Disconnect::Disconnect( Disconnect::Disconnect( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, PortImpl* const src_port, PortImpl* const dst_port) -: QueuedEvent(engine, responder, timestamp), - _src_port_path(src_port->path()), - _dst_port_path(dst_port->path()), - _patch(src_port->parent_node()->parent_patch()), - _src_port(src_port), - _dst_port(dst_port), - _lookup(false), - _compiled_patch(NULL), - _error(NO_ERROR) + : QueuedEvent(engine, request, timestamp) + , _src_port_path(src_port->path()) + , _dst_port_path(dst_port->path()) + , _patch(src_port->parent_node()->parent_patch()) + , _src_port(src_port) + , _dst_port(dst_port) + , _lookup(false) + , _compiled_patch(NULL) + , _error(NO_ERROR) { // FIXME: These break for patch ports.. is that ok? /*assert(src_port->is_output()); @@ -205,14 +205,16 @@ Disconnect::execute(ProcessContext& context) void Disconnect::post_process() { - if (_error == NO_ERROR) { - _responder->respond_ok(); - _engine.broadcaster()->disconnect(_src_port->path(), _dst_port->path()); - } else { - string msg = "Unable to disconnect "; - msg.append(_src_port_path.str() + " -> " + _dst_port_path.str()); - _responder->respond_error(msg); - } + if (_error == NO_ERROR) { + if (_request) + _request->respond_ok(); + _engine.broadcaster()->disconnect(_src_port->path(), _dst_port->path()); + } else { + string msg = "Unable to disconnect "; + msg.append(_src_port_path.str() + " -> " + _dst_port_path.str()); + if (_request) + _request->respond_error(msg); + } } diff --git a/src/engine/events/Disconnect.hpp b/src/engine/events/Disconnect.hpp index e118143c..0bba8c7b 100644 --- a/src/engine/events/Disconnect.hpp +++ b/src/engine/events/Disconnect.hpp @@ -49,18 +49,18 @@ class Disconnect : public QueuedEvent { public: Disconnect( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); Disconnect( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - PortImpl* const src_port, - PortImpl* const dst_port); + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + PortImpl* const src_port, + PortImpl* const dst_port); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/DisconnectAll.cpp b/src/engine/events/DisconnectAll.cpp index aedeadb7..af577199 100644 --- a/src/engine/events/DisconnectAll.cpp +++ b/src/engine/events/DisconnectAll.cpp @@ -31,7 +31,7 @@ #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "util.hpp" using namespace std; @@ -41,8 +41,8 @@ namespace Ingen { namespace Events { -DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& parent_path, const Path& node_path) - : QueuedEvent(engine, responder, timestamp) +DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& parent_path, const Path& node_path) + : QueuedEvent(engine, request, timestamp) , _parent_path(parent_path) , _path(node_path) , _parent(NULL) @@ -116,7 +116,7 @@ DisconnectAll::pre_process() if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) { Disconnect* ev = new Disconnect(_engine, - SharedPtr<Responder>(new Responder()), _time, c->src_port(), c->dst_port()); + SharedPtr<Request>(), _time, c->src_port(), c->dst_port()); ev->pre_process(); _disconnect_events.push_back(new Raul::List<Disconnect*>::Node(ev)); c->pending_disconnection(true); @@ -128,7 +128,7 @@ DisconnectAll::pre_process() ConnectionImpl* c = (ConnectionImpl*)i->get(); if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) { Disconnect* ev = new Disconnect(_engine, - SharedPtr<Responder>(new Responder()), _time, c->src_port(), c->dst_port()); + SharedPtr<Request>(), _time, c->src_port(), c->dst_port()); ev->pre_process(); _disconnect_events.push_back(new Raul::List<Disconnect*>::Node(ev)); c->pending_disconnection(true); @@ -156,13 +156,13 @@ void DisconnectAll::post_process() { if (_error == NO_ERROR) { - if (_responder) - _responder->respond_ok(); + if (_request) + _request->respond_ok(); for (Raul::List<Disconnect*>::iterator i = _disconnect_events.begin(); i != _disconnect_events.end(); ++i) (*i)->post_process(); } else { - if (_responder) { + if (_request) { boost::format fmt("Unable to disconnect %1% (%2%)"); fmt % _path; switch (_error) { @@ -177,7 +177,7 @@ DisconnectAll::post_process() default: break; } - _responder->respond_error(fmt.str()); + _request->respond_error(fmt.str()); } } } diff --git a/src/engine/events/DisconnectAll.hpp b/src/engine/events/DisconnectAll.hpp index d350e889..300f3213 100644 --- a/src/engine/events/DisconnectAll.hpp +++ b/src/engine/events/DisconnectAll.hpp @@ -44,11 +44,11 @@ class DisconnectAll : public QueuedEvent { public: DisconnectAll( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::Path& parent_path, - const Raul::Path& node_path); + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::Path& parent_path, + const Raul::Path& node_path); DisconnectAll( Engine& engine, diff --git a/src/engine/events/Get.cpp b/src/engine/events/Get.cpp index 6901adc3..214bb33d 100644 --- a/src/engine/events/Get.cpp +++ b/src/engine/events/Get.cpp @@ -17,7 +17,7 @@ #include "Get.hpp" #include "interface/ClientInterface.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "EngineStore.hpp" #include "ClientBroadcaster.hpp" @@ -35,10 +35,10 @@ namespace Events { Get::Get( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, const URI& uri) - : QueuedEvent(engine, responder, timestamp) + : QueuedEvent(engine, request, timestamp) , _uri(uri) , _object(NULL) , _plugin(NULL) @@ -70,15 +70,15 @@ void Get::post_process() { if (!_object && !_plugin) { - _responder->respond_error("Unable to find object requested."); - } else if (_responder->client()) { - _responder->respond_ok(); + _request->respond_error("Unable to find object requested."); + } else if (_request->client()) { + _request->respond_ok(); if (_object) - _responder->client()->put(_uri, _object->properties()); + _request->client()->put(_uri, _object->properties()); else if (_plugin) - _responder->client()->put(_uri, _plugin->properties()); + _request->client()->put(_uri, _plugin->properties()); } else { - _responder->respond_error("Unable to find client to send object."); + _request->respond_error("Unable to find client to send object."); } } diff --git a/src/engine/events/Get.hpp b/src/engine/events/Get.hpp index 5054ddb5..2abae3a4 100644 --- a/src/engine/events/Get.hpp +++ b/src/engine/events/Get.hpp @@ -37,10 +37,10 @@ class Get : public QueuedEvent { public: Get( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::URI& uri); + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::URI& uri); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/Learn.cpp b/src/engine/events/Learn.cpp index e700ab79..bf453bc3 100644 --- a/src/engine/events/Learn.cpp +++ b/src/engine/events/Learn.cpp @@ -23,7 +23,7 @@ #include "NodeImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "internals/Controller.hpp" using namespace std; @@ -32,8 +32,8 @@ namespace Ingen { namespace Events { -Learn::Learn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path) - : QueuedEvent(engine, responder, timestamp) +Learn::Learn(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path) + : QueuedEvent(engine, request, timestamp) , _error(NO_ERROR) , _path(path) , _object(NULL) @@ -81,14 +81,14 @@ void Learn::post_process() { if (_error == NO_ERROR) { - _responder->respond_ok(); + _request->respond_ok(); } else if (_object == NULL) { string msg = "Did not find node '"; msg.append(_path.str()).append("' for learn."); - _responder->respond_error(msg); + _request->respond_error(msg); } else { const string msg = string("Object '") + _path.str() + "' is not capable of learning."; - _responder->respond_error(msg); + _request->respond_error(msg); } } diff --git a/src/engine/events/Learn.hpp b/src/engine/events/Learn.hpp index 5f548797..fea8a53e 100644 --- a/src/engine/events/Learn.hpp +++ b/src/engine/events/Learn.hpp @@ -36,7 +36,7 @@ namespace Events { class Learn : public QueuedEvent { public: - Learn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path); + Learn(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Raul::Path& path); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/LoadPlugins.cpp b/src/engine/events/LoadPlugins.cpp index 65043757..d8a1175d 100644 --- a/src/engine/events/LoadPlugins.cpp +++ b/src/engine/events/LoadPlugins.cpp @@ -16,18 +16,17 @@ */ #include "LoadPlugins.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" -#include "EventSource.hpp" namespace Ingen { namespace Events { -LoadPlugins::LoadPlugins(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, EventSource* source) - : QueuedEvent(engine, responder, timestamp, true, source) +LoadPlugins::LoadPlugins(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) + : QueuedEvent(engine, request, timestamp, true) { } @@ -42,10 +41,10 @@ LoadPlugins::pre_process() void LoadPlugins::post_process() { - if (_source) - _source->unblock(); + if (_request) + _request->unblock(); - _responder->respond_ok(); + _request->respond_ok(); } diff --git a/src/engine/events/LoadPlugins.hpp b/src/engine/events/LoadPlugins.hpp index dcc5cd52..c1043551 100644 --- a/src/engine/events/LoadPlugins.hpp +++ b/src/engine/events/LoadPlugins.hpp @@ -31,10 +31,9 @@ namespace Events { class LoadPlugins : public QueuedEvent { public: - LoadPlugins(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - EventSource* source); + LoadPlugins(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/engine/events/Move.cpp b/src/engine/events/Move.cpp index 42ae88ca..822061f2 100644 --- a/src/engine/events/Move.cpp +++ b/src/engine/events/Move.cpp @@ -22,7 +22,7 @@ #include "NodeImpl.hpp" #include "EngineStore.hpp" #include "PatchImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Driver.hpp" using namespace std; @@ -34,8 +34,8 @@ namespace Events { using namespace Shared; -Move::Move(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const Path& new_path) - : QueuedEvent(engine, responder, timestamp) +Move::Move(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& path, const Path& new_path) + : QueuedEvent(engine, request, timestamp) , _old_path(path) , _new_path(new_path) , _parent_patch(NULL) @@ -116,7 +116,7 @@ Move::post_process() string msg = "Unable to rename object - "; if (_error == NO_ERROR) { - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->move(_old_path, _new_path); } else { if (_error == OBJECT_EXISTS) @@ -128,7 +128,7 @@ Move::post_process() else if (_error == PARENT_DIFFERS) msg.append(_new_path.str()).append(" is a child of a different patch"); - _responder->respond_error(msg); + _request->respond_error(msg); } } diff --git a/src/engine/events/Move.hpp b/src/engine/events/Move.hpp index 5a982397..9f9f8401 100644 --- a/src/engine/events/Move.hpp +++ b/src/engine/events/Move.hpp @@ -46,11 +46,11 @@ class Move : public QueuedEvent { public: Move( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::Path& old_path, - const Raul::Path& new_path); + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::Path& old_path, + const Raul::Path& new_path); ~Move(); void pre_process(); diff --git a/src/engine/events/Note.cpp b/src/engine/events/Note.cpp index e5a2370a..2fe9c868 100644 --- a/src/engine/events/Note.cpp +++ b/src/engine/events/Note.cpp @@ -24,7 +24,7 @@ #include "Note.hpp" #include "PluginImpl.hpp" #include "ProcessContext.hpp" -#include "Responder.hpp" +#include "Request.hpp" using namespace Raul; @@ -39,8 +39,8 @@ namespace Events { * * Used to be triggered by MIDI. Not used anymore. */ -Note::Note(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, NodeImpl* node, bool on, uint8_t note_num, uint8_t velocity) -: Event(engine, responder, timestamp), +Note::Note(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, NodeImpl* node, bool on, uint8_t note_num, uint8_t velocity) +: Event(engine, request, timestamp), _node(node), _on(on), _note_num(note_num), @@ -53,8 +53,8 @@ Note::Note(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp * * Triggered by OSC. */ -Note::Note(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& node_path, bool on, uint8_t note_num, uint8_t velocity) -: Event(engine, responder, timestamp), +Note::Note(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& node_path, bool on, uint8_t note_num, uint8_t velocity) +: Event(engine, request, timestamp), _node(NULL), _node_path(node_path), _on(on), @@ -95,11 +95,11 @@ Note::execute(ProcessContext& context) void Note::post_process() { - if (_responder) { + if (_request) { if (_node) - _responder->respond_ok(); + _request->respond_ok(); else - _responder->respond_error("Did not find node for note on event"); + _request->respond_error("Did not find node for note on event"); } } diff --git a/src/engine/events/Note.hpp b/src/engine/events/Note.hpp index 418e9130..4ead051c 100644 --- a/src/engine/events/Note.hpp +++ b/src/engine/events/Note.hpp @@ -35,21 +35,21 @@ namespace Events { class Note : public Event { public: - Note(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - NodeImpl* node, - bool on, - uint8_t note_num, - uint8_t velocity); + Note(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + NodeImpl* node, + bool on, + uint8_t note_num, + uint8_t velocity); - Note(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::Path& node_path, - bool on, - uint8_t note_num, - uint8_t velocity); + Note(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::Path& node_path, + bool on, + uint8_t note_num, + uint8_t velocity); void execute(ProcessContext& context); void post_process(); diff --git a/src/engine/events/Ping.hpp b/src/engine/events/Ping.hpp index f7359efc..6c0b2605 100644 --- a/src/engine/events/Ping.hpp +++ b/src/engine/events/Ping.hpp @@ -20,7 +20,7 @@ #include "QueuedEvent.hpp" #include "types.hpp" -#include "Responder.hpp" +#include "Request.hpp" namespace Ingen { @@ -37,11 +37,11 @@ namespace Events { class Ping : public QueuedEvent { public: - Ping(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp) - : QueuedEvent(engine, responder, timestamp) + Ping(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) + : QueuedEvent(engine, request, timestamp) {} - void post_process() { _responder->respond_ok(); } + void post_process() { _request->respond_ok(); } }; diff --git a/src/engine/events/RegisterClient.cpp b/src/engine/events/RegisterClient.cpp index 54368acb..2d7a8bea 100644 --- a/src/engine/events/RegisterClient.cpp +++ b/src/engine/events/RegisterClient.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Responder.hpp" +#include "Request.hpp" #include "events/RegisterClient.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -27,11 +27,11 @@ namespace Events { RegisterClient::RegisterClient(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const URI& uri, - Shared::ClientInterface* client) - : QueuedEvent(engine, responder, timestamp) + SharedPtr<Request> request, + SampleCount timestamp, + const URI& uri, + Shared::ClientInterface* client) + : QueuedEvent(engine, request, timestamp) , _uri(uri) , _client(client) { @@ -50,7 +50,7 @@ RegisterClient::pre_process() void RegisterClient::post_process() { - _responder->respond_ok(); + _request->respond_ok(); } diff --git a/src/engine/events/RegisterClient.hpp b/src/engine/events/RegisterClient.hpp index baecdc4d..5664b5c3 100644 --- a/src/engine/events/RegisterClient.hpp +++ b/src/engine/events/RegisterClient.hpp @@ -34,10 +34,10 @@ class RegisterClient : public QueuedEvent { public: RegisterClient(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::URI& uri, - Shared::ClientInterface* client); + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::URI& uri, + Shared::ClientInterface* client); void pre_process(); void post_process(); diff --git a/src/engine/events/RequestAllObjects.cpp b/src/engine/events/RequestAllObjects.cpp index 91e58e1e..98119e07 100644 --- a/src/engine/events/RequestAllObjects.cpp +++ b/src/engine/events/RequestAllObjects.cpp @@ -16,7 +16,7 @@ */ #include "events/RequestAllObjects.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "ObjectSender.hpp" #include "ClientBroadcaster.hpp" @@ -27,8 +27,8 @@ namespace Ingen { namespace Events { -RequestAllObjects::RequestAllObjects(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp) -: QueuedEvent(engine, responder, timestamp) +RequestAllObjects::RequestAllObjects(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) +: QueuedEvent(engine, request, timestamp) { } @@ -43,16 +43,16 @@ RequestAllObjects::pre_process() void RequestAllObjects::post_process() { - if (_responder->client()) { - _responder->respond_ok(); + if (_request->client()) { + _request->respond_ok(); // Everything is a child of the root patch, so this sends it all PatchImpl* root = _engine.engine_store()->find_patch("/"); - if (root && _responder->client()) - ObjectSender::send_object(_responder->client(), root, true); + if (root && _request->client()) + ObjectSender::send_object(_request->client(), root, true); } else { - _responder->respond_error("Unable to find client to send all objects"); + _request->respond_error("Unable to find client to send all objects"); } } diff --git a/src/engine/events/RequestAllObjects.hpp b/src/engine/events/RequestAllObjects.hpp index 3b44c5c0..d7970e12 100644 --- a/src/engine/events/RequestAllObjects.hpp +++ b/src/engine/events/RequestAllObjects.hpp @@ -31,7 +31,7 @@ namespace Events { class RequestAllObjects : public QueuedEvent { public: - RequestAllObjects(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp); + RequestAllObjects(Engine& engine, SharedPtr<Request> request, SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp index 1cc092e2..17c39585 100644 --- a/src/engine/events/RequestMetadata.cpp +++ b/src/engine/events/RequestMetadata.cpp @@ -28,7 +28,7 @@ #include "PluginImpl.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" -#include "Responder.hpp" +#include "Request.hpp" using namespace std; using namespace Raul; @@ -39,13 +39,13 @@ namespace Events { using namespace Shared; -RequestMetadata::RequestMetadata(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - bool is_meta, - const URI& subject, - const URI& key) - : QueuedEvent(engine, responder, timestamp) +RequestMetadata::RequestMetadata(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + bool is_meta, + const URI& subject, + const URI& key) + : QueuedEvent(engine, request, timestamp) , _error(NO_ERROR) , _special_type(NONE) , _uri(subject) @@ -60,7 +60,7 @@ void RequestMetadata::pre_process() { const bool is_object = (_uri.scheme() == Path::scheme && Path::is_valid(_uri.str())); - if (_responder->client()) { + if (_request->client()) { if (is_object) _resource = _engine.engine_store()->find_object(Path(_uri.str())); else @@ -110,25 +110,25 @@ RequestMetadata::execute(ProcessContext& context) void RequestMetadata::post_process() { - if (_responder->client()) { + if (_request->client()) { if (_special_type == PORT_VALUE) { if (_resource) { - _responder->respond_ok(); - _responder->client()->set_property(_uri.str(), + _request->respond_ok(); + _request->client()->set_property(_uri.str(), _engine.world()->uris->ingen_value, _value); } else { const string msg = "Get value for non-port " + _uri.str(); - _responder->respond_error(msg); + _request->respond_error(msg); } } else if (!_resource) { const string msg = "Unable to find subject " + _uri.str(); - _responder->respond_error(msg); + _request->respond_error(msg); } else { - _responder->respond_ok(); - _responder->client()->set_property(_uri, _key, _value); + _request->respond_ok(); + _request->client()->set_property(_uri, _key, _value); } } else { - _responder->respond_error("Unknown client"); + _request->respond_error("Unknown client"); } } diff --git a/src/engine/events/RequestMetadata.hpp b/src/engine/events/RequestMetadata.hpp index 68da6adc..60da3cb7 100644 --- a/src/engine/events/RequestMetadata.hpp +++ b/src/engine/events/RequestMetadata.hpp @@ -44,12 +44,12 @@ namespace Events { class RequestMetadata : public QueuedEvent { public: - RequestMetadata(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - bool meta, - const Raul::URI& subject, - const Raul::URI& key); + RequestMetadata(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + bool meta, + const Raul::URI& subject, + const Raul::URI& key); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/RequestPlugins.cpp b/src/engine/events/RequestPlugins.cpp index 95fd5ddf..89507a23 100644 --- a/src/engine/events/RequestPlugins.cpp +++ b/src/engine/events/RequestPlugins.cpp @@ -16,7 +16,7 @@ */ #include "RequestPlugins.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "NodeFactory.hpp" @@ -25,8 +25,8 @@ namespace Ingen { namespace Events { -RequestPlugins::RequestPlugins(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp) -: QueuedEvent(engine, responder, timestamp) +RequestPlugins::RequestPlugins(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) + : QueuedEvent(engine, request, timestamp) { } @@ -45,11 +45,11 @@ RequestPlugins::pre_process() void RequestPlugins::post_process() { - if (_responder->client()) { - _engine.broadcaster()->send_plugins_to(_responder->client(), _plugins); - _responder->respond_ok(); + if (_request->client()) { + _engine.broadcaster()->send_plugins_to(_request->client(), _plugins); + _request->respond_ok(); } else { - _responder->respond_error("Unable to find client to send plugins"); + _request->respond_error("Unable to find client to send plugins"); } } diff --git a/src/engine/events/RequestPlugins.hpp b/src/engine/events/RequestPlugins.hpp index e4372bc6..094edf51 100644 --- a/src/engine/events/RequestPlugins.hpp +++ b/src/engine/events/RequestPlugins.hpp @@ -23,7 +23,7 @@ namespace Ingen { -class Responder; +class Request; namespace Events { @@ -35,7 +35,7 @@ namespace Events { class RequestPlugins : public QueuedEvent { public: - RequestPlugins(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp); + RequestPlugins(Engine& engine, SharedPtr<Request> request, SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/engine/events/SendBinding.hpp b/src/engine/events/SendBinding.hpp index 7f69f777..837d3463 100644 --- a/src/engine/events/SendBinding.hpp +++ b/src/engine/events/SendBinding.hpp @@ -45,7 +45,7 @@ public: PortImpl* port, ControlBindings::Type type, int16_t num) - : Event(engine, SharedPtr<Responder>(), timestamp) + : Event(engine, SharedPtr<Request>(), timestamp) , _port(port) , _type(type) , _num(num) diff --git a/src/engine/events/SendPortActivity.hpp b/src/engine/events/SendPortActivity.hpp index 2e1c40f2..4481d8fc 100644 --- a/src/engine/events/SendPortActivity.hpp +++ b/src/engine/events/SendPortActivity.hpp @@ -46,7 +46,7 @@ public: inline SendPortActivity(Engine& engine, SampleCount timestamp, PortImpl* port) - : Event(engine, SharedPtr<Responder>(), timestamp) + : Event(engine, SharedPtr<Request>(), timestamp) , _port(port) { } diff --git a/src/engine/events/SendPortValue.hpp b/src/engine/events/SendPortValue.hpp index a106f459..8cbb3cbe 100644 --- a/src/engine/events/SendPortValue.hpp +++ b/src/engine/events/SendPortValue.hpp @@ -50,7 +50,7 @@ public: bool omni, uint32_t voice_num, const Raul::Atom& value) - : Event(engine, SharedPtr<Responder>(), timestamp) + : Event(engine, SharedPtr<Request>(), timestamp) , _port(port) , _omni(omni) , _voice_num(voice_num) diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index 30bf4907..8165f554 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -27,12 +27,11 @@ #include "CreatePort.hpp" #include "Engine.hpp" #include "EngineStore.hpp" -#include "EventSource.hpp" #include "GraphObjectImpl.hpp" #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "SetMetadata.hpp" #include "SetPortValue.hpp" @@ -47,15 +46,14 @@ typedef Shared::Resource::Properties Properties; SetMetadata::SetMetadata( - Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - EventSource* source, - bool replace, - bool meta, - const URI& subject, - const Properties& properties) - : QueuedEvent(engine, responder, timestamp, false, source) + Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + bool replace, + bool meta, + const URI& subject, + const Properties& properties) + : QueuedEvent(engine, request, timestamp, false) , _error(NO_ERROR) , _create_event(NULL) , _subject(subject) @@ -106,16 +104,16 @@ SetMetadata::pre_process() iterator p = _properties.find(uris.ingen_polyphony); if (p != _properties.end() && p->second.is_valid() && p->second.type() == Atom::INT) poly = p->second.get_int32(); - _create_event = new CreatePatch(_engine, _responder, _time, + _create_event = new CreatePatch(_engine, _request, _time, path, poly, _properties); } else if (is_node) { const iterator p = _properties.find(uris.rdf_instanceOf); - _create_event = new CreateNode(_engine, _responder, _time, + _create_event = new CreateNode(_engine, _request, _time, path, p->second.get_uri(), true, _properties); } else if (is_port) { _blocking = true; - _create_event = new CreatePort(_engine, _responder, _time, - path, data_type.uri(), is_output, _source, _properties); + _create_event = new CreatePort(_engine, _request, _time, + path, data_type.uri(), is_output, _properties); } if (_create_event) _create_event->pre_process(); @@ -178,7 +176,7 @@ SetMetadata::pre_process() } else if (key == uris.ingen_value) { PortImpl* port = dynamic_cast<PortImpl*>(_object); if (port) { - SetPortValue* ev = new SetPortValue(_engine, _responder, _time, port, value); + SetPortValue* ev = new SetPortValue(_engine, _request, _time, port, value); ev->pre_process(); _set_events.push_back(ev); } else { @@ -221,8 +219,8 @@ SetMetadata::execute(ProcessContext& context) if (_create_event) { QueuedEvent::execute(context); _create_event->execute(context); - if (_blocking && _source) - _source->unblock(); + if (_blocking && _request) + _request->unblock(); return; } @@ -277,23 +275,23 @@ SetMetadata::post_process() switch (_error) { case NO_ERROR: - _responder->respond_ok(); + _request->respond_ok(); _engine.broadcaster()->put(_subject, _properties); if (_create_event) _create_event->post_process(); break; case NOT_FOUND: - _responder->respond_error((boost::format( + _request->respond_error((boost::format( "Unable to find object `%1%'") % _subject).str()); case INTERNAL: - _responder->respond_error("Internal error"); + _request->respond_error("Internal error"); break; case BAD_OBJECT_TYPE: - _responder->respond_error((boost::format( + _request->respond_error((boost::format( "Bad type for object `%1%'") % _subject).str()); break; case BAD_VALUE_TYPE: - _responder->respond_error((boost::format( + _request->respond_error((boost::format( "Bad metadata value type for subject `%1%' predicate `%2%'") % _subject % _error_predicate).str()); break; diff --git a/src/engine/events/SetMetadata.hpp b/src/engine/events/SetMetadata.hpp index 6376a1fe..0abdd52a 100644 --- a/src/engine/events/SetMetadata.hpp +++ b/src/engine/events/SetMetadata.hpp @@ -67,9 +67,8 @@ class SetMetadata : public QueuedEvent public: SetMetadata( Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, - EventSource* source, bool replace, bool meta, const Raul::URI& subject, diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp index 33cf628c..aaa387b0 100644 --- a/src/engine/events/SetPortValue.cpp +++ b/src/engine/events/SetPortValue.cpp @@ -33,7 +33,7 @@ #include "ObjectBuffer.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "SetPortValue.hpp" using namespace std; @@ -46,13 +46,13 @@ using namespace Shared; /** Omni (all voices) control setting */ -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Responder> responder, - bool queued, - SampleCount timestamp, - const Raul::Path& port_path, - const Raul::Atom& value) - : QueuedEvent(engine, responder, timestamp) +SetPortValue::SetPortValue(Engine& engine, + SharedPtr<Request> request, + bool queued, + SampleCount timestamp, + const Raul::Path& port_path, + const Raul::Atom& value) + : QueuedEvent(engine, request, timestamp) , _queued(queued) , _omni(true) , _voice_num(0) @@ -65,14 +65,14 @@ SetPortValue::SetPortValue(Engine& engine, /** Voice-specific control setting */ -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Responder> responder, - bool queued, - SampleCount timestamp, - uint32_t voice_num, - const Raul::Path& port_path, - const Raul::Atom& value) - : QueuedEvent(engine, responder, timestamp) +SetPortValue::SetPortValue(Engine& engine, + SharedPtr<Request> request, + bool queued, + SampleCount timestamp, + uint32_t voice_num, + const Raul::Path& port_path, + const Raul::Atom& value) + : QueuedEvent(engine, request, timestamp) , _queued(queued) , _omni(false) , _voice_num(voice_num) @@ -84,12 +84,12 @@ SetPortValue::SetPortValue(Engine& engine, } /** Internal */ -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - PortImpl* port, - const Raul::Atom& value) - : QueuedEvent(engine, responder, timestamp) +SetPortValue::SetPortValue(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + PortImpl* port, + const Raul::Atom& value) + : QueuedEvent(engine, request, timestamp) , _queued(false) , _omni(true) , _voice_num(0) @@ -228,7 +228,7 @@ SetPortValue::post_process() switch (_error) { case NO_ERROR: assert(_port != NULL); - _responder->respond_ok(); + _request->respond_ok(); if (_omni) _engine.broadcaster()->set_property(_port_path, _engine.world()->uris->ingen_value, _value); @@ -238,22 +238,22 @@ SetPortValue::post_process() case TYPE_MISMATCH: ss << "Illegal value type " << _value.type() << " for port " << _port_path << endl; - _responder->respond_error(ss.str()); + _request->respond_error(ss.str()); break; case ILLEGAL_VOICE: ss << "Illegal voice number " << _voice_num; - _responder->respond_error(ss.str()); + _request->respond_error(ss.str()); break; case PORT_NOT_FOUND: msg = "Unable to find port "; msg.append(_port_path.str()).append(" to set value"); - _responder->respond_error(msg); + _request->respond_error(msg); break; case NO_SPACE: ss << "Attempt to write " << _value.data_size() << " bytes to " << _port_path.str() << ", with capacity " << _port->buffer_size() << endl; - _responder->respond_error(ss.str()); + _request->respond_error(ss.str()); break; } } diff --git a/src/engine/events/SetPortValue.hpp b/src/engine/events/SetPortValue.hpp index 821672fd..d7a3d7ae 100644 --- a/src/engine/events/SetPortValue.hpp +++ b/src/engine/events/SetPortValue.hpp @@ -42,14 +42,14 @@ class SetPortValue : public QueuedEvent { public: SetPortValue(Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, bool queued, SampleCount timestamp, const Raul::Path& port_path, const Raul::Atom& value); SetPortValue(Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, bool queued, SampleCount timestamp, uint32_t voice_num, @@ -57,7 +57,7 @@ public: const Raul::Atom& value); SetPortValue(Engine& engine, - SharedPtr<Responder> responder, + SharedPtr<Request> request, SampleCount timestamp, PortImpl* port, const Raul::Atom& value); diff --git a/src/engine/events/UnregisterClient.cpp b/src/engine/events/UnregisterClient.cpp index 8eedeff9..578b9adc 100644 --- a/src/engine/events/UnregisterClient.cpp +++ b/src/engine/events/UnregisterClient.cpp @@ -16,7 +16,7 @@ */ #include "interface/ClientInterface.hpp" -#include "Responder.hpp" +#include "Request.hpp" #include "UnregisterClient.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -27,8 +27,8 @@ namespace Ingen { namespace Events { -UnregisterClient::UnregisterClient(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri) - : QueuedEvent(engine, responder, timestamp) +UnregisterClient::UnregisterClient(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const URI& uri) + : QueuedEvent(engine, request, timestamp) , _uri(uri) { } @@ -38,9 +38,9 @@ void UnregisterClient::post_process() { if (_engine.broadcaster()->unregister_client(_uri)) - _responder->respond_ok(); + _request->respond_ok(); else - _responder->respond_error("Unable to unregister client"); + _request->respond_error("Unable to unregister client"); } diff --git a/src/engine/events/UnregisterClient.hpp b/src/engine/events/UnregisterClient.hpp index e32f8a94..9bd3f2cf 100644 --- a/src/engine/events/UnregisterClient.hpp +++ b/src/engine/events/UnregisterClient.hpp @@ -32,10 +32,10 @@ namespace Events { class UnregisterClient : public QueuedEvent { public: - UnregisterClient(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const Raul::URI& uri); + UnregisterClient(Engine& engine, + SharedPtr<Request> request, + SampleCount timestamp, + const Raul::URI& uri); void post_process(); |