summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-29 20:34:32 +0000
committerDavid Robillard <d@drobilla.net>2012-12-29 20:34:32 +0000
commit79275fc579c0dbe1ce4ca109edb95f2c1e0802a5 (patch)
tree72bb18ea61f485c47514a511dd3067c57aa2fb4b /src/client
parent9bdf223f830d3b430563e96d93efc073b1882e96 (diff)
downloadingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.tar.gz
ingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.tar.bz2
ingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.zip
"edge" => "arc".
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4897 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp36
-rw-r--r--src/client/GraphModel.cpp93
2 files changed, 64 insertions, 65 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index fe79336b..6b2c1540 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -15,11 +15,11 @@
*/
#include "ingen/Log.hpp"
-#include "ingen/client/ClientStore.hpp"
-#include "ingen/client/EdgeModel.hpp"
+#include "ingen/client/ArcModel.hpp"
#include "ingen/client/BlockModel.hpp"
-#include "ingen/client/ObjectModel.hpp"
+#include "ingen/client/ClientStore.hpp"
#include "ingen/client/GraphModel.hpp"
+#include "ingen/client/ObjectModel.hpp"
#include "ingen/client/PluginModel.hpp"
#include "ingen/client/PortModel.hpp"
#include "ingen/client/SigClientInterface.hpp"
@@ -391,7 +391,7 @@ ClientStore::connection_graph(const Raul::Path& tail_path,
graph = PtrCast<GraphModel>(_object(tail_path.parent().parent()));
if (!graph)
- _log.error(Raul::fmt("Unable to find graph for edge %1% => %2%\n")
+ _log.error(Raul::fmt("Unable to find graph for arc %1% => %2%\n")
% tail_path % head_path);
return graph;
@@ -406,12 +406,12 @@ ClientStore::attempt_connection(const Raul::Path& tail_path,
if (tail && head) {
SharedPtr<GraphModel> graph = connection_graph(tail_path, head_path);
- SharedPtr<EdgeModel> cm(new EdgeModel(tail, head));
+ SharedPtr<ArcModel> arc(new ArcModel(tail, head));
tail->connected_to(head);
head->connected_to(tail);
- graph->add_edge(cm);
+ graph->add_arc(arc);
return true;
} else {
_log.warn(Raul::fmt("Failed to connect %1% => %2%\n")
@@ -442,7 +442,7 @@ ClientStore::disconnect(const Raul::Path& src_path,
SharedPtr<GraphModel> graph = connection_graph(src_path, dst_path);
if (graph)
- graph->remove_edge(tail.get(), head.get());
+ graph->remove_arc(tail.get(), head.get());
}
void
@@ -458,17 +458,17 @@ ClientStore::disconnect_all(const Raul::Path& parent_graph,
return;
}
- const GraphModel::Edges edges = graph->edges();
- for (GraphModel::Edges::const_iterator i = edges.begin();
- i != edges.end(); ++i) {
- 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());
- graph->remove_edge(c->tail().get(), c->head().get());
+ const GraphModel::Arcs arcs = graph->arcs();
+ for (GraphModel::Arcs::const_iterator i = arcs.begin();
+ i != arcs.end(); ++i) {
+ SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second);
+ if (arc->tail()->parent() == object
+ || arc->head()->parent() == object
+ || arc->tail()->path() == path
+ || arc->head()->path() == path) {
+ arc->tail()->disconnected_from(arc->head());
+ arc->head()->disconnected_from(arc->tail());
+ graph->remove_arc(arc->tail().get(), arc->head().get());
}
}
}
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index fe838725..98155138 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -17,9 +17,9 @@
#include <cassert>
#include "ingen/URIs.hpp"
+#include "ingen/client/ArcModel.hpp"
#include "ingen/client/BlockModel.hpp"
#include "ingen/client/ClientStore.hpp"
-#include "ingen/client/EdgeModel.hpp"
#include "ingen/client/GraphModel.hpp"
using namespace std;
@@ -52,19 +52,17 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o)
// Remove any connections which referred to this object,
// since they can't possibly exist anymore
- for (Edges::iterator j = _edges.begin(); j != _edges.end();) {
- Edges::iterator next = j;
+ for (Arcs::iterator j = _arcs.begin(); j != _arcs.end();) {
+ Arcs::iterator next = j;
++next;
- SharedPtr<EdgeModel> cm = PtrCast<EdgeModel>(j->second);
- assert(cm);
-
- 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_edge.emit(cm);
- _edges.erase(j); // cuts our reference
+ SharedPtr<ArcModel> arc = PtrCast<ArcModel>(j->second);
+ if (arc->tail_path().parent() == o->path()
+ || arc->tail_path() == o->path()
+ || arc->head_path().parent() == o->path()
+ || arc->head_path() == o->path()) {
+ _signal_removed_arc.emit(arc);
+ _arcs.erase(j); // cuts our reference
}
j = next;
}
@@ -84,67 +82,68 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o)
void
GraphModel::clear()
{
- _edges.clear();
+ _arcs.clear();
BlockModel::clear();
- assert(_edges.empty());
+ assert(_arcs.empty());
assert(_ports.empty());
}
-SharedPtr<EdgeModel>
-GraphModel::get_edge(const Node* tail, const Node* head)
+SharedPtr<ArcModel>
+GraphModel::get_arc(const Node* tail, const Node* head)
{
- Edges::iterator i = _edges.find(make_pair(tail, head));
- if (i != _edges.end())
- return PtrCast<EdgeModel>(i->second);
+ Arcs::iterator i = _arcs.find(make_pair(tail, head));
+ if (i != _arcs.end())
+ return PtrCast<ArcModel>(i->second);
else
- return SharedPtr<EdgeModel>();
+ return SharedPtr<ArcModel>();
}
/** Add a connection to this graph.
*
- * A reference to @a cm is taken, released on deletion or removal.
- * If @a cm only contains paths (not pointers to the actual ports), the ports
+ * A reference to @p arc is taken, released on deletion or removal.
+ * If @p arc only contains paths (not pointers to the actual ports), the ports
* will be found and set. The ports referred to not existing as children of
* this graph is a fatal error.
*/
void
-GraphModel::add_edge(SharedPtr<EdgeModel> cm)
+GraphModel::add_arc(SharedPtr<ArcModel> arc)
{
// Store should have 'resolved' the connection already
- assert(cm);
- 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_edge(
- cm->tail().get(), cm->head().get());
+ assert(arc);
+ assert(arc->tail());
+ assert(arc->head());
+ assert(arc->tail()->parent());
+ assert(arc->head()->parent());
+ assert(arc->tail_path() != arc->head_path());
+ assert(arc->tail()->parent().get() == this
+ || arc->tail()->parent()->parent().get() == this);
+ assert(arc->head()->parent().get() == this
+ || arc->head()->parent()->parent().get() == this);
+
+ SharedPtr<ArcModel> existing = get_arc(
+ arc->tail().get(), arc->head().get());
if (existing) {
- assert(cm->tail() == existing->tail());
- assert(cm->head() == existing->head());
+ assert(arc->tail() == existing->tail());
+ assert(arc->head() == existing->head());
} else {
- _edges.insert(make_pair(make_pair(cm->tail().get(),
- cm->head().get()), cm));
- _signal_new_edge.emit(cm);
+ _arcs.insert(make_pair(make_pair(arc->tail().get(),
+ arc->head().get()),
+ arc));
+ _signal_new_arc.emit(arc);
}
}
void
-GraphModel::remove_edge(const Node* tail, const Node* head)
+GraphModel::remove_arc(const Node* tail, const Node* head)
{
- Edges::iterator i = _edges.find(make_pair(tail, head));
- if (i != _edges.end()) {
- SharedPtr<EdgeModel> c = PtrCast<EdgeModel>(i->second);
- _signal_removed_edge.emit(c);
- _edges.erase(i);
+ Arcs::iterator i = _arcs.find(make_pair(tail, head));
+ if (i != _arcs.end()) {
+ SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second);
+ _signal_removed_arc.emit(arc);
+ _arcs.erase(i);
}
}