From 74c76bd82792b03bd12f30aa875fae3e5047ccc2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 19 Apr 2011 21:27:38 +0000 Subject: Remove EngineInterface::quit(). Use del("ingen:engine") instead. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3172 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/ClientBroadcaster.hpp | 4 ++-- src/engine/HTTPClientSender.cpp | 5 ++--- src/engine/HTTPClientSender.hpp | 2 +- src/engine/OSCClientSender.cpp | 4 ++-- src/engine/OSCClientSender.hpp | 2 +- src/engine/OSCEngineReceiver.cpp | 21 ++------------------- src/engine/QueuedEngineInterface.cpp | 18 +++++++----------- src/engine/QueuedEngineInterface.hpp | 5 +---- src/engine/events/Delete.cpp | 13 ++++++++++--- src/engine/events/Delete.hpp | 10 +++++----- 10 files changed, 33 insertions(+), 51 deletions(-) (limited to 'src/engine') diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp index 989ed41b..ec0e7492 100644 --- a/src/engine/ClientBroadcaster.hpp +++ b/src/engine/ClientBroadcaster.hpp @@ -84,8 +84,8 @@ public: BROADCAST(move, old_path, new_path); } - void del(const Raul::Path& path) { - BROADCAST(del, path); + void del(const Raul::URI& uri) { + BROADCAST(del, uri); } void connect(const Raul::Path& src_port_path, diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index c9e0eaa2..6d91a2c0 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -75,10 +75,9 @@ HTTPClientSender::delta(const URI& uri, } void -HTTPClientSender::del(const Path& path) +HTTPClientSender::del(const URI& uri) { - assert(!path.is_root()); - send_chunk(string("<").append(path.str()).append("> a .")); + send_chunk(string("<").append(uri.str()).append("> a .")); } void diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp index aa7baf88..1b741071 100644 --- a/src/engine/HTTPClientSender.hpp +++ b/src/engine/HTTPClientSender.hpp @@ -74,7 +74,7 @@ public: const Resource::Properties& remove, const Resource::Properties& add); - virtual void del(const Raul::Path& path); + virtual void del(const Raul::URI& uri); virtual void move(const Raul::Path& old_path, const Raul::Path& new_path); diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp index ca2eb49f..020fb922 100644 --- a/src/engine/OSCClientSender.cpp +++ b/src/engine/OSCClientSender.cpp @@ -148,9 +148,9 @@ OSCClientSender::move(const Path& old_path, const Path& new_path) * DELETE an object (see \ref methods). */ void -OSCClientSender::del(const Path& path) +OSCClientSender::del(const URI& uri) { - send("/delete", "s", path.c_str(), LO_ARGS_END); + send("/delete", "s", uri.c_str(), LO_ARGS_END); } /** \page client_osc_namespace diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp index 6ce8d684..7352ebc2 100644 --- a/src/engine/OSCClientSender.hpp +++ b/src/engine/OSCClientSender.hpp @@ -77,7 +77,7 @@ public: const Resource::Properties& remove, const Resource::Properties& add); - virtual void del(const Raul::Path& path); + virtual void del(const Raul::URI& uri); virtual void move(const Raul::Path& old_path, const Raul::Path& new_path); diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index 1b8d1179..9e2193e5 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -94,7 +94,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t // Commands lo_server_add_method(_server, "/ping", "i", ping_cb, this); lo_server_add_method(_server, "/ping_queued", "i", ping_slow_cb, this); - lo_server_add_method(_server, "/quit", "i", quit_cb, this); lo_server_add_method(_server, "/register_client", "i", register_client_cb, this); lo_server_add_method(_server, "/unregister_client", "i", unregister_client_cb, this); lo_server_add_method(_server, "/put", NULL, put_cb, this); @@ -268,22 +267,6 @@ OSCEngineReceiver::_ping_slow_cb(const char* path, const char* types, lo_arg** a return 0; } -/** \page engine_osc_namespace - *

/quit

- * \arg \b response-id (integer) - * - * Terminate the engine. - * Note that there are NO order guarantees with this command at all. You could - * send 10 messages then quit, and the quit reply could come immediately and the - * 10 messages would never get executed. - */ -int -OSCEngineReceiver::_quit_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - quit(); - return 0; -} - /** \page engine_osc_namespace *

/register_client

* \arg \b response-id (integer) @@ -388,9 +371,9 @@ OSCEngineReceiver::_move_cb(const char* path, const char* types, lo_arg** argv, int OSCEngineReceiver::_del_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - const char* obj_path = &argv[1]->s; + const char* uri = &argv[1]->s; - del(obj_path); + del(uri); return 0; } diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 1fc68799..456a32ff 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -97,15 +97,6 @@ QueuedEngineInterface::unregister_client(const URI& uri) } } -// Engine commands - -void -QueuedEngineInterface::quit() -{ - _request->respond_ok(); - _engine.quit(); -} - // Bundle commands void @@ -146,9 +137,14 @@ QueuedEngineInterface::move(const Path& old_path, } void -QueuedEngineInterface::del(const Path& path) +QueuedEngineInterface::del(const URI& uri) { - push_queued(new Events::Delete(_engine, _request, now(), path)); + if (uri == "ingen:engine") { + _request->respond_ok(); + _engine.quit(); + } else { + push_queued(new Events::Delete(_engine, _request, now(), uri)); + } } void diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index dede135e..3cabf0a9 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -59,9 +59,6 @@ public: virtual void register_client(ClientInterface* client); virtual void unregister_client(const Raul::URI& uri); - // Engine commands - virtual void quit(); - // Bundles virtual void bundle_begin(); virtual void bundle_end(); @@ -89,7 +86,7 @@ public: const Raul::URI& predicate, const Raul::Atom& value); - virtual void del(const Raul::Path& path); + virtual void del(const Raul::URI& uri); // EngineInterface object commands diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp index 50b9174a..4a6e520b 100644 --- a/src/engine/events/Delete.cpp +++ b/src/engine/events/Delete.cpp @@ -36,9 +36,12 @@ namespace Ingen { namespace Engine { namespace Events { -Delete::Delete(Engine& engine, SharedPtr request, FrameTime time, const Raul::Path& path) +Delete::Delete(Engine& engine, + SharedPtr request, + FrameTime time, + const Raul::URI& uri) : QueuedEvent(engine, request, time, true) - , _path(path) + , _uri(uri) , _store_iterator(engine.engine_store()->end()) , _garbage(NULL) , _driver_port(NULL) @@ -50,6 +53,9 @@ Delete::Delete(Engine& engine, SharedPtr request, FrameTime time, const { assert(request); assert(request->source()); + + if (Raul::Path::is_path(uri)) + _path = Raul::Path(uri.str()); } Delete::~Delete() @@ -166,7 +172,8 @@ Delete::post_process() { _removed_bindings.reset(); - if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { + 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"); } else if (!_node && !_port) { diff --git a/src/engine/events/Delete.hpp b/src/engine/events/Delete.hpp index 234d8977..f00ad847 100644 --- a/src/engine/events/Delete.hpp +++ b/src/engine/events/Delete.hpp @@ -58,11 +58,10 @@ class DisconnectAll; class Delete : public QueuedEvent { public: - Delete( - Engine& engine, - SharedPtr request, - FrameTime timestamp, - const Raul::Path& path); + Delete(Engine& engine, + SharedPtr request, + FrameTime timestamp, + const Raul::URI& uri); ~Delete(); @@ -71,6 +70,7 @@ public: void post_process(); private: + Raul::URI _uri; Raul::Path _path; EngineStore::iterator _store_iterator; SharedPtr _node; ///< Non-NULL iff a node -- cgit v1.2.1