diff options
author | David Robillard <d@drobilla.net> | 2011-04-20 03:30:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-20 03:30:03 +0000 |
commit | 1119a2c71a5f6b4e23ac0a19784705002ca9cefd (patch) | |
tree | 14f1a7f2b270185defc9e99ddf03e108b6767c8b /src/client | |
parent | 7042795c8138f03124539f0efc892fe45eb2979f (diff) | |
download | ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.tar.gz ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.tar.bz2 ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.zip |
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
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 24 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 3 | ||||
-rw-r--r-- | src/client/SigClientInterface.hpp | 4 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.hpp | 5 |
4 files changed, 36 insertions, 0 deletions
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<Shared::LV2URIMap> 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<PatchModel> patch = PtrCast<PatchModel>(object(parent_patch_path)); + SharedPtr<ObjectModel> 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<ConnectionModel> c = PtrCast<ConnectionModel>(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<ObjectModel> > 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<void, Raul::URI> signal_object_deleted; sigc::signal<void, Raul::Path, Raul::Path> signal_connection; sigc::signal<void, Raul::Path, Raul::Path> signal_disconnection; + sigc::signal<void, Raul::Path, Raul::Path> signal_disconnect_all; sigc::signal<void, Raul::URI, Raul::URI, Raul::Atom> signal_variable_change; sigc::signal<void, Raul::URI, Raul::URI, Raul::Atom> signal_property_change; sigc::signal<void, Raul::Path, Raul::Atom> 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<void, Raul::URI> object_deleted_slot; sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot; sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot; + sigc::slot<void, Raul::Path, Raul::Path> disconnect_all_slot; sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> variable_change_slot; sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> property_change_slot; sigc::slot<void, Raul::Path, Raul::Atom> port_value_slot; |