diff options
author | David Robillard <d@drobilla.net> | 2011-10-21 23:11:27 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-10-21 23:11:27 +0000 |
commit | d7bc67f9752a90abf165c875839294befb42ef90 (patch) | |
tree | 1b8bddf242f95592d2ed563cc14a49b511580870 /src/server/events | |
parent | 221b1bfaec0ba4a9b1067fd16e2fb100e60a93ba (diff) | |
download | ingen-d7bc67f9752a90abf165c875839294befb42ef90.tar.gz ingen-d7bc67f9752a90abf165c875839294befb42ef90.tar.bz2 ingen-d7bc67f9752a90abf165c875839294befb42ef90.zip |
Merge Request into Event.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3574 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
28 files changed, 303 insertions, 304 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index c8858961..aae84b39 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -34,7 +34,6 @@ #include "PatchImpl.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" -#include "Request.hpp" #include "types.hpp" using namespace std; @@ -44,12 +43,13 @@ namespace Ingen { namespace Server { namespace Events { -Connect::Connect(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Path& src_port_path, - const Path& dst_port_path) - : Event(engine, request, timestamp) +Connect::Connect(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Path& src_port_path, + const Path& dst_port_path) + : Event(engine, client, id, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -177,7 +177,7 @@ Connect::post_process() { std::ostringstream ss; if (_error == NO_ERROR) { - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->connect(_src_port_path, _dst_port_path); return; } @@ -202,7 +202,7 @@ Connect::post_process() ss << "Unknown error"; } ss << ")"; - _request->respond_error(ss.str()); + respond_error(ss.str()); } } // namespace Events diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 3b9e64a3..92f8bcf4 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -49,11 +49,12 @@ namespace Events { class Connect : public Event { public: - Connect(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); + Connect(Engine& engine, + ClientInterface* client, + int32_t id, + 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/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index e827f840..04fef8b1 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -21,7 +21,6 @@ #include "sord/sordmm.hpp" #include "ingen/shared/LV2URIMap.hpp" #include "CreateNode.hpp" -#include "Request.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" @@ -40,14 +39,14 @@ namespace Ingen { namespace Server { namespace Events { -CreateNode::CreateNode( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Path& path, - const URI& plugin_uri, - const Resource::Properties& properties) - : Event(engine, request, timestamp) +CreateNode::CreateNode(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Path& path, + const URI& plugin_uri, + const Resource::Properties& properties) + : Event(engine, client, id, timestamp) , _path(path) , _plugin_uri(plugin_uri) , _patch(NULL) @@ -117,26 +116,22 @@ CreateNode::execute(ProcessContext& context) void CreateNode::post_process() { - if (!_request) { - return; - } - string msg; if (_node_already_exists) { msg = string("Could not create node - ").append(_path.str());// + " already exists."; - _request->respond_error(msg); + respond_error(msg); } else if (_patch == NULL) { msg = "Could not find patch '" + _path.parent().str() +"' to add node."; - _request->respond_error(msg); + respond_error(msg); } else if (_plugin == NULL) { msg = "Unable to load node "; msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")"; - _request->respond_error(msg); + respond_error(msg); } else if (_node == NULL) { msg = "Failed to instantiate plugin " + _plugin_uri.str(); - _request->respond_error(msg); + respond_error(msg); } else { - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->send_object(_node, true); // yes, send ports } } diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp index b01af7cc..0a89ba02 100644 --- a/src/server/events/CreateNode.hpp +++ b/src/server/events/CreateNode.hpp @@ -41,13 +41,13 @@ namespace Events { class CreateNode : public Event { public: - CreateNode( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& node_path, - const Raul::URI& plugin_uri, - const Resource::Properties& properties); + CreateNode(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& node_path, + const Raul::URI& plugin_uri, + const Resource::Properties& properties); void pre_process(); void execute(ProcessContext& context); diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index 2abe5d22..eda05ccd 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -19,7 +19,6 @@ #include "raul/Path.hpp" #include "ingen/shared/LV2URIMap.hpp" #include "events/CreatePatch.hpp" -#include "Request.hpp" #include "PatchImpl.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" @@ -35,14 +34,14 @@ namespace Ingen { namespace Server { namespace Events { -CreatePatch::CreatePatch( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& path, - int poly, - const Resource::Properties& properties) - : Event(engine, request, timestamp) +CreatePatch::CreatePatch(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + int poly, + const Resource::Properties& properties) + : Event(engine, client, id, timestamp) , _path(path) , _patch(NULL) , _parent(NULL) @@ -128,33 +127,31 @@ void CreatePatch::post_process() { string msg; - if (_request) { - switch (_error) { - case NO_ERROR: - _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: - _request->respond_ok(); - /*string msg = "Unable to create patch: "; - msg.append(_path).append(" already exists."); - _request->respond_error(msg);*/ - break; - case PARENT_NOT_FOUND: - msg = "Unable to create patch: Parent "; - msg.append(Path(_path).parent().str()).append(" not found."); - _request->respond_error(msg); - break; - case INVALID_POLY: - msg = "Unable to create patch "; - msg.append(_path.str()).append(": ").append("Invalid polyphony requested."); - _request->respond_error(msg); - break; - default: - _request->respond_error("Unable to load patch."); - } + switch (_error) { + case NO_ERROR: + 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: + respond_ok(); + /*string msg = "Unable to create patch: "; + msg.append(_path).append(" already exists."); + respond_error(msg);*/ + break; + case PARENT_NOT_FOUND: + msg = "Unable to create patch: Parent "; + msg.append(Path(_path).parent().str()).append(" not found."); + respond_error(msg); + break; + case INVALID_POLY: + msg = "Unable to create patch "; + msg.append(_path.str()).append(": ").append("Invalid polyphony requested."); + respond_error(msg); + break; + default: + respond_error("Unable to load patch."); } } diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp index 49f0b633..4addd524 100644 --- a/src/server/events/CreatePatch.hpp +++ b/src/server/events/CreatePatch.hpp @@ -36,13 +36,13 @@ namespace Events { class CreatePatch : public Event { public: - CreatePatch( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& path, - int poly, - const Resource::Properties& properties); + CreatePatch(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + int poly, + const Resource::Properties& properties); void pre_process(); void execute(ProcessContext& context); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 0a200add..1df393ca 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -31,7 +31,6 @@ #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Request.hpp" using namespace std; using namespace Raul; @@ -40,14 +39,14 @@ namespace Ingen { namespace Server { namespace Events { -CreatePort::CreatePort( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& path, - bool is_output, - const Resource::Properties& properties) - : Event(engine, request, timestamp) +CreatePort::CreatePort(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + bool is_output, + const Resource::Properties& properties) + : Event(engine, client, id, timestamp) , _path(path) , _data_type(PortType::UNKNOWN) , _patch(NULL) @@ -174,27 +173,23 @@ CreatePort::execute(ProcessContext& context) void CreatePort::post_process() { - if (!_request) { - return; - } - string msg; switch (_error) { case NO_ERROR: - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->send_object(_patch_port, true); break; case BAD_INDEX: msg = string("Could not create port ") + _path.str() + " (Illegal index given)"; - _request->respond_error(msg); + respond_error(msg); break; case UNKNOWN_TYPE: msg = string("Could not create port ") + _path.str() + " (Unknown type)"; - _request->respond_error(msg); + respond_error(msg); break; case CREATION_FAILED: msg = string("Could not create port ") + _path.str() + " (Creation failed)"; - _request->respond_error(msg); + respond_error(msg); break; } } diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index bb3aa0e4..4113611f 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -42,13 +42,13 @@ namespace Events { class CreatePort : public Event { public: - CreatePort( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& path, - bool is_output, - const Resource::Properties& properties); + CreatePort(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + bool is_output, + const Resource::Properties& properties); void pre_process(); void execute(ProcessContext& context); diff --git a/src/server/events/Deactivate.hpp b/src/server/events/Deactivate.hpp index 1b083f29..b99a2568 100644 --- a/src/server/events/Deactivate.hpp +++ b/src/server/events/Deactivate.hpp @@ -32,12 +32,15 @@ namespace Events { class Deactivate : public Event { public: - Deactivate(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) - : Event(engine, request, timestamp) + Deactivate(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp) + : Event(engine, client, id, timestamp) {} void post_process() { - _request->respond_ok(); + respond_ok(); _engine.deactivate(); } }; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index d0fbb5fa..53d77379 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -28,7 +28,6 @@ #include "PatchImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Request.hpp" using namespace std; @@ -36,11 +35,12 @@ namespace Ingen { namespace Server { namespace Events { -Delete::Delete(Engine& engine, - SharedPtr<Request> request, - FrameTime time, - const Raul::URI& uri) - : Event(engine, request, time) +Delete::Delete(Engine& engine, + ClientInterface* client, + int32_t id, + FrameTime time, + const Raul::URI& uri) + : Event(engine, client, id, time) , _uri(uri) , _store_iterator(engine.engine_store()->end()) , _garbage(NULL) @@ -52,8 +52,6 @@ Delete::Delete(Engine& engine, , _disconnect_event(NULL) , _lock(engine.engine_store()->lock(), Glib::NOT_LOCK) { - assert(request); - if (Raul::Path::is_path(uri)) _path = Raul::Path(uri.str()); } @@ -176,14 +174,14 @@ Delete::post_process() if (!Raul::Path::is_path(_uri) || _path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { // XXX: Just ignore? - //_request->respond_error(_path.chop_scheme() + " can not be deleted"); + //respond_error(_path.chop_scheme() + " can not be deleted"); } else if (!_node && !_port) { string msg = string("Could not find object ") + _path.chop_scheme() + " to delete"; - _request->respond_error(msg); + respond_error(msg); } else if (_patch_node_listnode) { assert(_node); _node->deactivate(); - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->bundle_begin(); if (_disconnect_event) _disconnect_event->post_process(); @@ -192,7 +190,7 @@ Delete::post_process() _engine.maid()->push(_patch_node_listnode); } else if (_patch_port_listnode) { assert(_port); - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->bundle_begin(); if (_disconnect_event) _disconnect_event->post_process(); @@ -200,7 +198,7 @@ Delete::post_process() _engine.broadcaster()->bundle_end(); _engine.maid()->push(_patch_port_listnode); } else { - _request->respond_error("Unable to delete object " + _path.chop_scheme()); + respond_error("Unable to delete object " + _path.chop_scheme()); } if (_driver_port) diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 926ecd47..c85d6982 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -58,10 +58,11 @@ class DisconnectAll; class Delete : public Event { public: - Delete(Engine& engine, - SharedPtr<Request> request, - FrameTime timestamp, - const Raul::URI& uri); + Delete(Engine& engine, + ClientInterface* client, + int32_t id, + FrameTime timestamp, + const Raul::URI& uri); ~Delete(); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 5fc723b5..aa5c4edb 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -32,7 +32,6 @@ #include "PatchImpl.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" -#include "Request.hpp" #include "ThreadManager.hpp" #include "events/Disconnect.hpp" @@ -43,12 +42,13 @@ namespace Ingen { namespace Server { namespace Events { -Disconnect::Disconnect(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& src_port_path, - const Raul::Path& dst_port_path) - : Event(engine, request, timestamp) +Disconnect::Disconnect(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& src_port_path, + const Raul::Path& dst_port_path) + : Event(engine, client, id, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) , _patch(NULL) @@ -227,8 +227,7 @@ void Disconnect::post_process() { if (_error == NO_ERROR) { - if (_request) - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->disconnect(_src_port->path(), _dst_port->path()); } else { string msg("Unable to disconnect "); @@ -257,8 +256,7 @@ Disconnect::post_process() break; } msg.append(")"); - if (_request) - _request->respond_error(msg); + respond_error(msg); } delete _impl; diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index 1ecb02cf..7b26e90c 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -46,11 +46,12 @@ namespace Events { class Disconnect : public Event { public: - Disconnect(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); + Disconnect(Engine& engine, + ClientInterface* client, + int32_t id, + 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/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index fde8e214..7bd9ee96 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -33,7 +33,6 @@ #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "PortImpl.hpp" -#include "Request.hpp" #include "events/Disconnect.hpp" #include "events/DisconnectAll.hpp" #include "util.hpp" @@ -45,8 +44,13 @@ namespace Ingen { namespace Server { namespace Events { -DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& parent_path, const Path& node_path) - : Event(engine, request, timestamp) +DisconnectAll::DisconnectAll(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Path& parent_path, + const Path& node_path) + : Event(engine, client, id, timestamp) , _parent_path(parent_path) , _path(node_path) , _parent(NULL) @@ -59,7 +63,9 @@ DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Request> request, SampleC /** Internal version for use by other events. */ -DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* object) +DisconnectAll::DisconnectAll(Engine& engine, + PatchImpl* parent, + GraphObjectImpl* object) : Event(engine) , _parent_path(parent->path()) , _path(object->path()) @@ -168,27 +174,24 @@ void DisconnectAll::post_process() { if (_error == NO_ERROR) { - if (_request) - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->disconnect_all(_parent_path, _path); } else { - if (_request) { - boost::format fmt("Unable to disconnect %1% (%2%)"); - fmt % _path; - switch (_error) { - case INVALID_PARENT_PATH: - fmt % string("Invalid parent path: ").append(_parent_path.str()); - break; - case PARENT_NOT_FOUND: - fmt % string("Unable to find parent: ").append(_parent_path.str()); - break; - case OBJECT_NOT_FOUND: - fmt % string("Unable to find object"); - default: - break; - } - _request->respond_error(fmt.str()); + boost::format fmt("Unable to disconnect %1% (%2%)"); + fmt % _path; + switch (_error) { + case INVALID_PARENT_PATH: + fmt % string("Invalid parent path: ").append(_parent_path.str()); + break; + case PARENT_NOT_FOUND: + fmt % string("Unable to find parent: ").append(_parent_path.str()); + break; + case OBJECT_NOT_FOUND: + fmt % string("Unable to find object"); + default: + break; } + respond_error(fmt.str()); } } diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 6d3754f0..d3f84e96 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -44,17 +44,16 @@ class Disconnect; class DisconnectAll : public Event { public: - DisconnectAll( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& parent, - const Raul::Path& object); - - DisconnectAll( - Engine& engine, - PatchImpl* parent, - GraphObjectImpl* object); + DisconnectAll(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& parent, + const Raul::Path& object); + + DisconnectAll(Engine& engine, + PatchImpl* parent, + GraphObjectImpl* object); ~DisconnectAll(); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 7cb85db4..c13054dc 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -23,7 +23,6 @@ #include "Get.hpp" #include "ObjectSender.hpp" #include "PluginImpl.hpp" -#include "Request.hpp" using namespace Raul; @@ -31,11 +30,12 @@ namespace Ingen { namespace Server { namespace Events { -Get::Get(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const URI& uri) - : Event(engine, request, timestamp) +Get::Get(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const URI& uri) + : Event(engine, client, id, timestamp) , _uri(uri) , _object(NULL) , _plugin(NULL) @@ -63,23 +63,23 @@ void Get::post_process() { if (_uri == "ingen:plugins") { - _request->respond_ok(); - if (_request->client()) { - _engine.broadcaster()->send_plugins_to(_request->client(), _plugins); + respond_ok(); + if (_request_client) { + _engine.broadcaster()->send_plugins_to(_request_client, _plugins); } } else if (!_object && !_plugin) { - _request->respond_error("Unable to find object requested."); - } else if (_request->client()) { - _request->respond_ok(); - if (_request->client()) { + respond_error("Unable to find object requested."); + } else if (_request_client) { + respond_ok(); + if (_request_client) { if (_object) { - ObjectSender::send_object(_request->client(), _object, true); + ObjectSender::send_object(_request_client, _object, true); } else if (_plugin) { - _request->client()->put(_uri, _plugin->properties()); + _request_client->put(_uri, _plugin->properties()); } } } else { - _request->respond_error("Unable to find client to send object."); + respond_error("Unable to find client to send object."); } _lock.release(); diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 5eb45982..919db0f9 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -39,10 +39,11 @@ namespace Events { class Get : public Event { public: - Get(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::URI& uri); + Get(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri); void pre_process(); void post_process(); diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 10be3bc8..3991e636 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -25,7 +25,6 @@ #include "EngineStore.hpp" #include "NodeImpl.hpp" #include "PatchImpl.hpp" -#include "Request.hpp" #include "events/Move.hpp" using namespace std; @@ -35,8 +34,13 @@ namespace Ingen { namespace Server { namespace Events { -Move::Move(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& path, const Path& new_path) - : Event(engine, request, timestamp) +Move::Move(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Path& path, + const Path& new_path) + : Event(engine, client, id, timestamp) , _old_path(path) , _new_path(new_path) , _parent_patch(NULL) @@ -114,7 +118,7 @@ Move::post_process() string msg = "Unable to rename object - "; if (_error == NO_ERROR) { - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->move(_old_path, _new_path); } else { if (_error == OBJECT_EXISTS) @@ -126,7 +130,7 @@ Move::post_process() else if (_error == PARENT_DIFFERS) msg.append(_new_path.str()).append(" is a child of a different patch"); - _request->respond_error(msg); + respond_error(msg); } } diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index bab9d047..e8e99b25 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -45,12 +45,13 @@ namespace Events { class Move : public Event { public: - Move( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::Path& old_path, - const Raul::Path& new_path); + Move(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::Path& old_path, + const Raul::Path& new_path); + ~Move(); void pre_process(); diff --git a/src/server/events/Ping.hpp b/src/server/events/Ping.hpp index ad732397..5017fd12 100644 --- a/src/server/events/Ping.hpp +++ b/src/server/events/Ping.hpp @@ -20,7 +20,6 @@ #include "Event.hpp" #include "types.hpp" -#include "Request.hpp" namespace Ingen { namespace Server { @@ -37,11 +36,14 @@ namespace Events { class Ping : public Event { public: - Ping(Engine& engine, SharedPtr<Request> request, SampleCount timestamp) - : Event(engine, request, timestamp) + Ping(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp) + : Event(engine, client, id, timestamp) {} - void post_process() { _request->respond_ok(); } + void post_process() { respond_ok(); } }; } // namespace Server diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp index 34e7a9f3..a2c0b8be 100644 --- a/src/server/events/RegisterClient.cpp +++ b/src/server/events/RegisterClient.cpp @@ -18,7 +18,6 @@ #include "ClientBroadcaster.hpp" #include "Driver.hpp" #include "Engine.hpp" -#include "Request.hpp" #include "events/RegisterClient.hpp" #include "ingen/shared/LV2URIMap.hpp" @@ -28,21 +27,20 @@ namespace Ingen { namespace Server { namespace Events { -RegisterClient::RegisterClient(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const URI& uri, - ClientInterface* client) - : Event(engine, request, timestamp) +RegisterClient::RegisterClient(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const URI& uri) + : Event(engine, client, id, timestamp) , _uri(uri) - , _client(client) { } void RegisterClient::pre_process() { - _engine.broadcaster()->register_client(_uri, _client); + _engine.broadcaster()->register_client(_uri, _request_client); Event::pre_process(); } @@ -50,7 +48,7 @@ RegisterClient::pre_process() void RegisterClient::post_process() { - _request->respond_ok(); + respond_ok(); /* Tell the client the engine's sample rate (which it needs to know to interpret control bounds for lv2:sampleRate ports). This is a bit of a @@ -58,9 +56,9 @@ RegisterClient::post_process() that to clients. */ const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); - _client->set_property(uris.ingen_engine, - uris.ingen_sampleRate, - int32_t(_engine.driver()->sample_rate())); + _request_client->set_property(uris.ingen_engine, + uris.ingen_sampleRate, + int32_t(_engine.driver()->sample_rate())); } } // namespace Server diff --git a/src/server/events/RegisterClient.hpp b/src/server/events/RegisterClient.hpp index 960e2c05..0f82a33d 100644 --- a/src/server/events/RegisterClient.hpp +++ b/src/server/events/RegisterClient.hpp @@ -33,18 +33,17 @@ namespace Events { class RegisterClient : public Event { public: - RegisterClient(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::URI& uri, - ClientInterface* client); + RegisterClient(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri); void pre_process(); void post_process(); private: - Raul::URI _uri; - ClientInterface* _client; + Raul::URI _uri; }; } // namespace Server diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 4133803b..4d6f6497 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -35,7 +35,6 @@ #include "PluginImpl.hpp" #include "PortImpl.hpp" #include "PortType.hpp" -#include "Request.hpp" #include "SetMetadata.hpp" #include "SetPortValue.hpp" #include "ingen/shared/LV2URIMap.hpp" @@ -51,16 +50,16 @@ namespace Events { typedef Resource::Properties Properties; -SetMetadata::SetMetadata( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - bool create, - Resource::Graph context, - const URI& subject, - const Properties& properties, - const Properties& remove) - : Event(engine, request, timestamp) +SetMetadata::SetMetadata(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + bool create, + Resource::Graph context, + const URI& subject, + const Properties& properties, + const Properties& remove) + : Event(engine, client, id, timestamp) , _create_event(NULL) , _subject(subject) , _properties(properties) @@ -125,23 +124,20 @@ SetMetadata::pre_process() bool is_patch = false, is_node = false, is_port = false, is_output = false; Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output); - // Create a separate request without a source so EventSource isn't unblocked twice - SharedPtr<Request> sub_request(new Request(_request->client(), _request->id())); - if (is_patch) { uint32_t poly = 1; 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, sub_request, _time, - path, poly, _properties); + _create_event = new CreatePatch(_engine, _request_client, _request_id, _time, + path, poly, _properties); } else if (is_node) { const iterator p = _properties.find(uris.rdf_instanceOf); - _create_event = new CreateNode(_engine, sub_request, _time, - path, p->second.get_uri(), _properties); + _create_event = new CreateNode(_engine, _request_client, _request_id, _time, + path, p->second.get_uri(), _properties); } else if (is_port) { - _create_event = new CreatePort(_engine, sub_request, _time, - path, is_output, _properties); + _create_event = new CreatePort(_engine, _request_client, _request_id, _time, + path, is_output, _properties); } if (_create_event) { _create_event->pre_process(); @@ -194,7 +190,8 @@ SetMetadata::pre_process() _error = BAD_VALUE_TYPE; } } else if (key == uris.ingen_value) { - SetPortValue* ev = new SetPortValue(_engine, _request, _time, port, value); + SetPortValue* ev = new SetPortValue( + _engine, _request_client, _request_id, _time, port, value); ev->pre_process(); _set_events.push_back(ev); } else if (key == uris.ingen_controlBinding) { @@ -359,7 +356,7 @@ SetMetadata::post_process() if (_create_event) { _create_event->post_process(); } else { - _request->respond_ok(); + respond_ok(); if (_create) _engine.broadcaster()->put(_subject, _properties, _context); else @@ -367,18 +364,18 @@ SetMetadata::post_process() } break; case NOT_FOUND: - _request->respond_error((boost::format( + respond_error((boost::format( "Unable to find object `%1%'") % _subject).str()); break; case INTERNAL: - _request->respond_error("Internal error"); + respond_error("Internal error"); break; case BAD_OBJECT_TYPE: - _request->respond_error((boost::format( + respond_error((boost::format( "Bad type for object `%1%'") % _subject).str()); break; case BAD_VALUE_TYPE: - _request->respond_error((boost::format( + respond_error((boost::format( "Bad metadata value type for subject `%1%' predicate `%2%'") % _subject % _error_predicate).str()); break; diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp index d8da99c0..512e35c0 100644 --- a/src/server/events/SetMetadata.hpp +++ b/src/server/events/SetMetadata.hpp @@ -69,15 +69,15 @@ class SetPortValue; class SetMetadata : public Event { public: - SetMetadata( - Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - bool create, - Resource::Graph context, - const Raul::URI& subject, - const Resource::Properties& properties, - const Resource::Properties& remove = Resource::Properties()); + SetMetadata(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + bool create, + Resource::Graph context, + const Raul::URI& subject, + const Resource::Properties& properties, + const Resource::Properties& remove = Resource::Properties()); ~SetMetadata(); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 1b0ec373..f96649b9 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -34,8 +34,6 @@ #include "ObjectBuffer.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" -#include "ProcessContext.hpp" -#include "Request.hpp" #include "SetPortValue.hpp" using namespace std; @@ -45,13 +43,14 @@ namespace Ingen { namespace Server { namespace Events { -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Request> request, - bool queued, - SampleCount timestamp, - const Raul::Path& port_path, - const Raul::Atom& value) - : Event(engine, request, timestamp) +SetPortValue::SetPortValue(Engine& engine, + ClientInterface* client, + int32_t id, + bool queued, + SampleCount timestamp, + const Raul::Path& port_path, + const Raul::Atom& value) + : Event(engine, client, id, timestamp) , _queued(queued) , _port_path(port_path) , _value(value) @@ -60,12 +59,13 @@ SetPortValue::SetPortValue(Engine& engine, } /** Internal */ -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - PortImpl* port, - const Raul::Atom& value) - : Event(engine, request, timestamp) +SetPortValue::SetPortValue(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Raul::Atom& value) + : Event(engine, client, id, timestamp) , _queued(false) , _port_path(port->path()) , _value(value) @@ -197,25 +197,25 @@ SetPortValue::post_process() switch (_error) { case NO_ERROR: assert(_port != NULL); - _request->respond_ok(); + respond_ok(); _engine.broadcaster()->set_property(_port_path, _engine.world()->uris()->ingen_value, _value); break; case TYPE_MISMATCH: ss << "Illegal value type " << _value.type() << " for port " << _port_path << endl; - _request->respond_error(ss.str()); + respond_error(ss.str()); break; case PORT_NOT_FOUND: msg = "Unable to find port "; msg.append(_port_path.str()).append(" to set value"); - _request->respond_error(msg); + 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; - _request->respond_error(ss.str()); + respond_error(ss.str()); break; } } diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index ca69c789..2ceb37f6 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -43,18 +43,20 @@ namespace Events { class SetPortValue : public Event { public: - SetPortValue(Engine& engine, - SharedPtr<Request> request, - bool queued, - SampleCount timestamp, - const Raul::Path& port_path, - const Raul::Atom& value); + SetPortValue(Engine& engine, + ClientInterface* client, + int32_t id, + bool queued, + SampleCount timestamp, + const Raul::Path& port_path, + const Raul::Atom& value); - SetPortValue(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - PortImpl* port, - const Raul::Atom& value); + SetPortValue(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Raul::Atom& value); ~SetPortValue(); diff --git a/src/server/events/UnregisterClient.cpp b/src/server/events/UnregisterClient.cpp index e5ba1b4f..64c37fb8 100644 --- a/src/server/events/UnregisterClient.cpp +++ b/src/server/events/UnregisterClient.cpp @@ -16,7 +16,6 @@ */ #include "ingen/ClientInterface.hpp" -#include "Request.hpp" #include "UnregisterClient.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -27,8 +26,12 @@ namespace Ingen { namespace Server { namespace Events { -UnregisterClient::UnregisterClient(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const URI& uri) - : Event(engine, request, timestamp) +UnregisterClient::UnregisterClient(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const URI& uri) + : Event(engine, client, id, timestamp) , _uri(uri) { } @@ -37,9 +40,9 @@ void UnregisterClient::post_process() { if (_engine.broadcaster()->unregister_client(_uri)) - _request->respond_ok(); + respond_ok(); else - _request->respond_error("Unable to unregister client"); + respond_error("Unable to unregister client"); } } // namespace Server diff --git a/src/server/events/UnregisterClient.hpp b/src/server/events/UnregisterClient.hpp index 86d24e1c..089b8d8e 100644 --- a/src/server/events/UnregisterClient.hpp +++ b/src/server/events/UnregisterClient.hpp @@ -32,10 +32,11 @@ namespace Events { class UnregisterClient : public Event { public: - UnregisterClient(Engine& engine, - SharedPtr<Request> request, - SampleCount timestamp, - const Raul::URI& uri); + UnregisterClient(Engine& engine, + ClientInterface* client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri); void post_process(); |