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/bindings/Client.hpp | 2 +- src/client/ClientStore.cpp | 6 +++++- src/client/ClientStore.hpp | 2 +- src/client/HTTPEngineSender.cpp | 9 +-------- src/client/HTTPEngineSender.hpp | 5 +---- src/client/OSCEngineSender.cpp | 12 ++---------- src/client/OSCEngineSender.hpp | 5 +---- src/client/SigClientInterface.hpp | 6 +++--- src/client/ThreadedSigClientInterface.hpp | 6 +++--- 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 +++++----- src/gui/BreadCrumbs.cpp | 4 ++-- src/gui/BreadCrumbs.hpp | 2 +- src/shared/ClashAvoider.cpp | 5 +++-- src/shared/ClashAvoider.hpp | 2 +- 23 files changed, 58 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp index 6eaa3dc8..988b941c 100644 --- a/src/bindings/Client.hpp +++ b/src/bindings/Client.hpp @@ -18,7 +18,7 @@ public: void error(const std::string& msg) {} void put(const Raul::URI& path, const Ingen::Resource::Properties& properties) {} void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) {} - void del(const Raul::Path& path) {} + void del(const Raul::URI& uri) {} void move(const Raul::Path& old_path, const Raul::Path& new_path) {} void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) {} void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) {} diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 32e115e6..690a2666 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -201,8 +201,12 @@ ClientStore::add_plugin(SharedPtr pm) /* ****** Signal Handlers ******** */ void -ClientStore::del(const Path& path) +ClientStore::del(const URI& uri) { + if (!Raul::Path::is_path(uri)) + return; + + const Raul::Path path(uri.str()); SharedPtr removed = remove_object(path); removed.reset(); LOG(debug) << "Removed object " << path << ", count: " << removed.use_count(); diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index 7bc21b99..dc02a455 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -97,7 +97,7 @@ public: void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); - void del(const Raul::Path& path); + void del(const Raul::URI& uri); sigc::signal< void, SharedPtr > signal_new_object; sigc::signal< void, SharedPtr > signal_new_plugin; diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index e188b010..98c43a12 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -78,13 +78,6 @@ HTTPEngineSender::unregister_client(const URI& uri) { } -// Engine commands - -void -HTTPEngineSender::quit() -{ -} - // Object commands void @@ -128,7 +121,7 @@ HTTPEngineSender::move(const Path& old_path, } void -HTTPEngineSender::del(const Path& uri) +HTTPEngineSender::del(const URI& uri) { const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str(); const string full_uri = _engine_url.str() + "/" + path; diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp index 549ad07a..b5653273 100644 --- a/src/client/HTTPEngineSender.hpp +++ b/src/client/HTTPEngineSender.hpp @@ -72,9 +72,6 @@ public: void register_client(ClientInterface* client); void unregister_client(const Raul::URI& uri); - // Engine commands - void quit(); - // Object commands virtual void put(const Raul::URI& path, @@ -85,7 +82,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/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index 3c9b60b4..9de1192a 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -98,14 +98,6 @@ OSCEngineSender::unregister_client(const URI& uri) send("/unregister_client", "i", next_id(), LO_ARGS_END); } -// Engine commands - -void -OSCEngineSender::quit() -{ - send("/quit", "i", next_id(), LO_ARGS_END); -} - // Object commands void @@ -144,11 +136,11 @@ OSCEngineSender::move(const Path& old_path, } void -OSCEngineSender::del(const Path& path) +OSCEngineSender::del(const URI& uri) { send("/delete", "is", next_id(), - path.c_str(), + uri.c_str(), LO_ARGS_END); } diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp index 75cf3db1..98d2d40c 100644 --- a/src/client/OSCEngineSender.hpp +++ b/src/client/OSCEngineSender.hpp @@ -73,9 +73,6 @@ public: void register_client(ClientInterface* client); void unregister_client(const Raul::URI& uri); - // Engine commands - void quit(); - // Object commands virtual void put(const Raul::URI& path, @@ -86,7 +83,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/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp index 26a64f85..17cd8556 100644 --- a/src/client/SigClientInterface.hpp +++ b/src/client/SigClientInterface.hpp @@ -55,7 +55,7 @@ public: sigc::signal signal_delta; sigc::signal signal_object_moved; - sigc::signal signal_object_deleted; + sigc::signal signal_object_deleted; sigc::signal signal_connection; sigc::signal signal_disconnection; sigc::signal signal_variable_change; @@ -100,8 +100,8 @@ protected: void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { EMIT(connection, src_port_path, dst_port_path); } - void del(const Raul::Path& path) - { EMIT(object_deleted, path); } + void del(const Raul::URI& uri) + { EMIT(object_deleted, uri); } void move(const Raul::Path& old_path, const Raul::Path& new_path) { EMIT(object_moved, old_path, new_path); } diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp index 84f9c009..00bd2767 100644 --- a/src/client/ThreadedSigClientInterface.hpp +++ b/src/client/ThreadedSigClientInterface.hpp @@ -94,8 +94,8 @@ public: void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } - void del(const Raul::Path& path) - { push_sig(sigc::bind(object_deleted_slot, path)); } + void del(const Raul::URI& uri) + { push_sig(sigc::bind(object_deleted_slot, uri)); } void move(const Raul::Path& old_path, const Raul::Path& new_path) { push_sig(sigc::bind(object_moved_slot, old_path, new_path)); } @@ -132,7 +132,7 @@ private: sigc::slot delta_slot; sigc::slot connection_slot; - sigc::slot object_deleted_slot; + sigc::slot object_deleted_slot; sigc::slot object_moved_slot; sigc::slot disconnection_slot; sigc::slot variable_change_slot; 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 diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 796e79bd..e7e7e356 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -174,10 +174,10 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb) } void -BreadCrumbs::object_destroyed(const Path& path) +BreadCrumbs::object_destroyed(const URI& uri) { for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == path) { + if ((*i)->path() == uri) { // Remove all crumbs after the removed one (inclusive) for (std::list::iterator j = i; j != _breadcrumbs.end(); ) { BreadCrumb* bc = *j; diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index 5afcf6ad..c716e33e 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -99,7 +99,7 @@ private: void breadcrumb_clicked(BreadCrumb* crumb); - void object_destroyed(const Raul::Path& path); + void object_destroyed(const Raul::URI& uri); void object_moved(const Raul::Path& old_path, const Raul::Path& new_path); Raul::Path _active_path; diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index 19a8f15d..10a26934 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -187,9 +187,10 @@ ClashAvoider::set_property(const Raul::URI& subject, } void -ClashAvoider::del(const Raul::Path& path) +ClashAvoider::del(const Raul::URI& uri) { - _target.del(map_path(path)); + if (Raul::Path::is_path(uri)) + _target.del(map_path(Raul::Path(uri.str()))); } } // namespace Shared diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp index 13eb1007..3cd5c8ba 100644 --- a/src/shared/ClashAvoider.hpp +++ b/src/shared/ClashAvoider.hpp @@ -68,7 +68,7 @@ public: const Raul::URI& predicate, const Raul::Atom& value); - virtual void del(const Raul::Path& path); + virtual void del(const Raul::URI& uri); private: const Raul::URI map_uri(const Raul::URI& in); -- cgit v1.2.1