From 927b169eb1787bc40ede591c7c7893a39b488d95 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Apr 2012 02:25:35 +0000 Subject: Use "tail" and "head" terminology instead of "src_port" and "dst_port". Use the same types for connect() and disconnect() parameters. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4292 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/ClientStore.cpp | 74 +++++++++++++++++++++++----------------------- src/client/PatchModel.cpp | 62 +++++++++++++++++++------------------- 2 files changed, 68 insertions(+), 68 deletions(-) (limited to 'src/client') diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 1356e5f7..d56c781d 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -20,7 +20,7 @@ #include "ingen/shared/LV2URIMap.hpp" #include "ingen/client/ClientStore.hpp" -#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/EdgeModel.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PatchModel.hpp" @@ -414,42 +414,42 @@ ClientStore::set_property(const URI& subject_uri, const URI& predicate, const At } SharedPtr -ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_path) +ClientStore::connection_patch(const Path& tail_path, const Path& head_path) { SharedPtr patch; - if (src_port_path.parent() == dst_port_path.parent()) - patch = PtrCast(_object(src_port_path.parent())); + if (tail_path.parent() == head_path.parent()) + patch = PtrCast(_object(tail_path.parent())); - if (!patch && src_port_path.parent() == dst_port_path.parent().parent()) - patch = PtrCast(_object(src_port_path.parent())); + if (!patch && tail_path.parent() == head_path.parent().parent()) + patch = PtrCast(_object(tail_path.parent())); - if (!patch && src_port_path.parent().parent() == dst_port_path.parent()) - patch = PtrCast(_object(dst_port_path.parent())); + if (!patch && tail_path.parent().parent() == head_path.parent()) + patch = PtrCast(_object(head_path.parent())); if (!patch) - patch = PtrCast(_object(src_port_path.parent().parent())); + patch = PtrCast(_object(tail_path.parent().parent())); if (!patch) - LOG(Raul::error) << "Unable to find connection patch " << src_port_path - << " -> " << dst_port_path << endl; + LOG(Raul::error) << "Unable to find connection patch " << tail_path + << " -> " << head_path << endl; return patch; } bool -ClientStore::attempt_connection(const Path& src_port_path, - const Path& dst_port_path) +ClientStore::attempt_connection(const Path& tail_path, + const Path& head_path) { - SharedPtr src_port = PtrCast(_object(src_port_path)); - SharedPtr dst_port = PtrCast(_object(dst_port_path)); + SharedPtr tail = PtrCast(_object(tail_path)); + SharedPtr head = PtrCast(_object(head_path)); - if (src_port && dst_port) { - SharedPtr patch = connection_patch(src_port_path, dst_port_path); - SharedPtr cm(new ConnectionModel(src_port, dst_port)); + if (tail && head) { + SharedPtr patch = connection_patch(tail_path, head_path); + SharedPtr cm(new EdgeModel(tail, head)); - src_port->connected_to(dst_port); - dst_port->connected_to(src_port); + tail->connected_to(head); + head->connected_to(tail); patch->add_connection(cm); return true; @@ -466,8 +466,8 @@ ClientStore::connect(const Path& src_path, } void -ClientStore::disconnect(const URI& src, - const URI& dst) +ClientStore::disconnect(const Path& src, + const Path& dst) { if (!Path::is_path(src) && !Path::is_path(dst)) { std::cerr << "Bad disconnect notification " << src << " => " << dst << std::endl; @@ -477,18 +477,18 @@ ClientStore::disconnect(const URI& src, const Path src_path(src.str()); const Path dst_path(dst.str()); - SharedPtr src_port = PtrCast(_object(src_path)); - SharedPtr dst_port = PtrCast(_object(dst_path)); + SharedPtr tail = PtrCast(_object(src_path)); + SharedPtr head = PtrCast(_object(dst_path)); - if (src_port) - src_port->disconnected_from(dst_port); + if (tail) + tail->disconnected_from(head); - if (dst_port) - dst_port->disconnected_from(src_port); + if (head) + head->disconnected_from(tail); SharedPtr patch = connection_patch(src_path, dst_path); if (patch) - patch->remove_connection(src_port.get(), dst_port.get()); + patch->remove_connection(tail.get(), head.get()); } void @@ -507,14 +507,14 @@ ClientStore::disconnect_all(const Raul::Path& parent_patch_path, 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()->path() == path - || c->dst_port()->path() == path) { - 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()); + SharedPtr c = PtrCast(i->second); + if (c->tail()->parent() == object + || c->head()->parent() == object + || c->tail()->path() == path + || c->head()->path() == path) { + c->tail()->disconnected_from(c->head()); + c->head()->disconnected_from(c->tail()); + patch->remove_connection(c->tail().get(), c->head().get()); } } } diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index f07c64de..ec949429 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -22,7 +22,7 @@ #include "ingen/client/PatchModel.hpp" #include "ingen/client/NodeModel.hpp" -#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/EdgeModel.hpp" #include "ingen/client/ClientStore.hpp" using namespace std; @@ -59,13 +59,13 @@ PatchModel::remove_child(SharedPtr o) Connections::iterator next = j; ++next; - SharedPtr cm = PtrCast(j->second); + SharedPtr cm = PtrCast(j->second); assert(cm); - if (cm->src_port_path().parent() == o->path() - || cm->src_port_path() == o->path() - || cm->dst_port_path().parent() == o->path() - || cm->dst_port_path() == o->path()) { + if (cm->tail_path().parent() == o->path() + || cm->tail_path() == o->path() + || cm->head_path().parent() == o->path() + || cm->head_path() == o->path()) { _signal_removed_connection.emit(cm); _connections->erase(j); // cuts our reference } @@ -94,14 +94,14 @@ PatchModel::clear() assert(_ports.empty()); } -SharedPtr -PatchModel::get_connection(const Port* src_port, const Ingen::Port* dst_port) +SharedPtr +PatchModel::get_connection(const Port* tail, const Ingen::Port* head) { - Connections::iterator i = _connections->find(make_pair(src_port, dst_port)); + Connections::iterator i = _connections->find(make_pair(tail, head)); if (i != _connections->end()) - return PtrCast(i->second); + return PtrCast(i->second); else - return SharedPtr(); + return SharedPtr(); } /** Add a connection to this patch. @@ -112,43 +112,43 @@ PatchModel::get_connection(const Port* src_port, const Ingen::Port* dst_port) * this patch is a fatal error. */ void -PatchModel::add_connection(SharedPtr cm) +PatchModel::add_connection(SharedPtr cm) { // Store should have 'resolved' the connection already assert(cm); - assert(cm->src_port()); - assert(cm->dst_port()); - assert(cm->src_port()->parent()); - assert(cm->dst_port()->parent()); - assert(cm->src_port_path() != cm->dst_port_path()); - assert(cm->src_port()->parent().get() == this - || cm->src_port()->parent()->parent().get() == this); - assert(cm->dst_port()->parent().get() == this - || cm->dst_port()->parent()->parent().get() == this); - - SharedPtr existing = get_connection( - cm->src_port().get(), cm->dst_port().get()); + assert(cm->tail()); + assert(cm->head()); + assert(cm->tail()->parent()); + assert(cm->head()->parent()); + assert(cm->tail_path() != cm->head_path()); + assert(cm->tail()->parent().get() == this + || cm->tail()->parent()->parent().get() == this); + assert(cm->head()->parent().get() == this + || cm->head()->parent()->parent().get() == this); + + SharedPtr existing = get_connection( + cm->tail().get(), cm->head().get()); if (existing) { - assert(cm->src_port() == existing->src_port()); - assert(cm->dst_port() == existing->dst_port()); + assert(cm->tail() == existing->tail()); + assert(cm->head() == existing->head()); } else { - _connections->insert(make_pair(make_pair(cm->src_port().get(), cm->dst_port().get()), cm)); + _connections->insert(make_pair(make_pair(cm->tail().get(), cm->head().get()), cm)); _signal_new_connection.emit(cm); } } void -PatchModel::remove_connection(const Port* src_port, const Ingen::Port* dst_port) +PatchModel::remove_connection(const Port* tail, const Ingen::Port* head) { - Connections::iterator i = _connections->find(make_pair(src_port, dst_port)); + Connections::iterator i = _connections->find(make_pair(tail, head)); if (i != _connections->end()) { - SharedPtr c = PtrCast(i->second); + SharedPtr c = PtrCast(i->second); _signal_removed_connection.emit(c); _connections->erase(i); } else { warn << "[PatchModel::remove_connection] Failed to find connection " << - src_port->path() << " -> " << dst_port->path() << endl; + tail->path() << " -> " << head->path() << endl; } } -- cgit v1.2.1