summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-28 02:25:35 +0000
committerDavid Robillard <d@drobilla.net>2012-04-28 02:25:35 +0000
commit927b169eb1787bc40ede591c7c7893a39b488d95 (patch)
tree70337e073d9ddd301e118bbda6b43481e88de4ed /src/client
parenteed06c66b6f54687cc148d45d00352a85ad2d3d3 (diff)
downloadingen-927b169eb1787bc40ede591c7c7893a39b488d95.tar.gz
ingen-927b169eb1787bc40ede591c7c7893a39b488d95.tar.bz2
ingen-927b169eb1787bc40ede591c7c7893a39b488d95.zip
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
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp74
-rw-r--r--src/client/PatchModel.cpp62
2 files changed, 68 insertions, 68 deletions
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<PatchModel>
-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<PatchModel> patch;
- if (src_port_path.parent() == dst_port_path.parent())
- patch = PtrCast<PatchModel>(_object(src_port_path.parent()));
+ if (tail_path.parent() == head_path.parent())
+ patch = PtrCast<PatchModel>(_object(tail_path.parent()));
- if (!patch && src_port_path.parent() == dst_port_path.parent().parent())
- patch = PtrCast<PatchModel>(_object(src_port_path.parent()));
+ if (!patch && tail_path.parent() == head_path.parent().parent())
+ patch = PtrCast<PatchModel>(_object(tail_path.parent()));
- if (!patch && src_port_path.parent().parent() == dst_port_path.parent())
- patch = PtrCast<PatchModel>(_object(dst_port_path.parent()));
+ if (!patch && tail_path.parent().parent() == head_path.parent())
+ patch = PtrCast<PatchModel>(_object(head_path.parent()));
if (!patch)
- patch = PtrCast<PatchModel>(_object(src_port_path.parent().parent()));
+ patch = PtrCast<PatchModel>(_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<PortModel> src_port = PtrCast<PortModel>(_object(src_port_path));
- SharedPtr<PortModel> dst_port = PtrCast<PortModel>(_object(dst_port_path));
+ SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(tail_path));
+ SharedPtr<PortModel> head = PtrCast<PortModel>(_object(head_path));
- if (src_port && dst_port) {
- SharedPtr<PatchModel> patch = connection_patch(src_port_path, dst_port_path);
- SharedPtr<ConnectionModel> cm(new ConnectionModel(src_port, dst_port));
+ if (tail && head) {
+ SharedPtr<PatchModel> patch = connection_patch(tail_path, head_path);
+ SharedPtr<EdgeModel> 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<PortModel> src_port = PtrCast<PortModel>(_object(src_path));
- SharedPtr<PortModel> dst_port = PtrCast<PortModel>(_object(dst_path));
+ SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(src_path));
+ SharedPtr<PortModel> head = PtrCast<PortModel>(_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<PatchModel> 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<ConnectionModel> c = PtrCast<ConnectionModel>(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<EdgeModel> c = PtrCast<EdgeModel>(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<ObjectModel> o)
Connections::iterator next = j;
++next;
- SharedPtr<ConnectionModel> cm = PtrCast<ConnectionModel>(j->second);
+ SharedPtr<EdgeModel> cm = PtrCast<EdgeModel>(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<ConnectionModel>
-PatchModel::get_connection(const Port* src_port, const Ingen::Port* dst_port)
+SharedPtr<EdgeModel>
+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<ConnectionModel>(i->second);
+ return PtrCast<EdgeModel>(i->second);
else
- return SharedPtr<ConnectionModel>();
+ return SharedPtr<EdgeModel>();
}
/** 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<ConnectionModel> cm)
+PatchModel::add_connection(SharedPtr<EdgeModel> 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<ConnectionModel> 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<EdgeModel> 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<ConnectionModel> c = PtrCast<ConnectionModel>(i->second);
+ SharedPtr<EdgeModel> c = PtrCast<EdgeModel>(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;
}
}