From 1119a2c71a5f6b4e23ac0a19784705002ca9cefd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 20 Apr 2011 03:30:03 +0000 Subject: Move disconnect_all to CommonInterface and implement in clients. Factor out process thread implementation of Disconnect into Disconnect::Impl. Implement DisconnectAll in terms of DisconnectImpl rather than abusing Disconnect. Dramatically reduce notification communication overhead of DisconnectAll. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3179 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/ClientStore.cpp | 24 ++++++++++++++++++++++++ src/client/ClientStore.hpp | 3 +++ src/client/SigClientInterface.hpp | 4 ++++ src/client/ThreadedSigClientInterface.hpp | 5 +++++ 4 files changed, 36 insertions(+) (limited to 'src/client') diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 690a2666..be7d4186 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -63,6 +63,7 @@ ClientStore::ClientStore(SharedPtr uris, CONNECT(delta, delta); CONNECT(connection, connect); CONNECT(disconnection, disconnect); + CONNECT(disconnect_all, disconnect_all); CONNECT(property_change, set_property); CONNECT(activity, activity); } @@ -475,6 +476,29 @@ ClientStore::disconnect(const Path& src_path, patch->remove_connection(src_port.get(), dst_port.get()); } +void +ClientStore::disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path) +{ + SharedPtr patch = PtrCast(object(parent_patch_path)); + SharedPtr object = this->object(path); + + if (!patch || !object) + return; + + const PatchModel::Connections connections = patch->connections(); + for (PatchModel::Connections::const_iterator i = connections.begin(); + i != connections.end(); ++i) { + SharedPtr c = PtrCast(i->second); + if (c->src_port()->parent() == object + || c->dst_port()->parent() == object) { + c->src_port()->disconnected_from(c->dst_port()); + c->dst_port()->disconnected_from(c->src_port()); + patch->remove_connection(c->src_port().get(), c->dst_port().get()); + } + } +} + } // namespace Client } // namespace Ingen diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index dc02a455..c5dc023a 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -97,6 +97,9 @@ public: void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); + void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + void del(const Raul::URI& uri); sigc::signal< void, SharedPtr > signal_new_object; diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp index 17cd8556..7d968524 100644 --- a/src/client/SigClientInterface.hpp +++ b/src/client/SigClientInterface.hpp @@ -58,6 +58,7 @@ public: sigc::signal signal_object_deleted; sigc::signal signal_connection; sigc::signal signal_disconnection; + sigc::signal signal_disconnect_all; sigc::signal signal_variable_change; sigc::signal signal_property_change; sigc::signal signal_port_value; @@ -109,6 +110,9 @@ protected: void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { EMIT(disconnection, src_port_path, dst_port_path); } + void disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) + { EMIT(disconnect_all, parent_patch_path, path); } + void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) { EMIT(property_change, subject, key, value); } diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp index 00bd2767..d9f89503 100644 --- a/src/client/ThreadedSigClientInterface.hpp +++ b/src/client/ThreadedSigClientInterface.hpp @@ -57,6 +57,7 @@ public: , object_deleted_slot(signal_object_deleted.make_slot()) , object_moved_slot(signal_object_moved.make_slot()) , disconnection_slot(signal_disconnection.make_slot()) + , disconnect_all_slot(signal_disconnect_all.make_slot()) , variable_change_slot(signal_variable_change.make_slot()) , property_change_slot(signal_property_change.make_slot()) , port_value_slot(signal_port_value.make_slot()) @@ -103,6 +104,9 @@ public: void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } + void disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) + { push_sig(sigc::bind(disconnect_all_slot, parent_patch_path, path)); } + void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) { push_sig(sigc::bind(property_change_slot, subject, key, value)); } @@ -135,6 +139,7 @@ private: sigc::slot object_deleted_slot; sigc::slot object_moved_slot; sigc::slot disconnection_slot; + sigc::slot disconnect_all_slot; sigc::slot variable_change_slot; sigc::slot property_change_slot; sigc::slot port_value_slot; -- cgit v1.2.1