summaryrefslogtreecommitdiff
path: root/libs/ardour/route_graph.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-06 02:00:17 +0200
committerRobin Gareus <robin@gareus.org>2016-04-06 02:00:17 +0200
commit45019517d7d01d4af974bf0c9ab0a11dec233abb (patch)
tree10b9093bbadf8e848f13161aa100486aba96d7be /libs/ardour/route_graph.cc
parentaa2f94647633004dbcf5d7edc41397289a4ee5ff (diff)
Add an API to traverse the process graph downstream
Diffstat (limited to 'libs/ardour/route_graph.cc')
-rw-r--r--libs/ardour/route_graph.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/ardour/route_graph.cc b/libs/ardour/route_graph.cc
index ab88a0d839..910141a440 100644
--- a/libs/ardour/route_graph.cc
+++ b/libs/ardour/route_graph.cc
@@ -59,6 +59,24 @@ GraphEdges::find_in_from_to_with_sends (GraphVertex from, GraphVertex to)
return _from_to_with_sends.end ();
}
+GraphEdges::EdgeMapWithSends::iterator
+GraphEdges::find_recursively_in_from_to_with_sends (GraphVertex from, GraphVertex to)
+{
+ typedef EdgeMapWithSends::iterator Iter;
+ pair<Iter, Iter> r = _from_to_with_sends.equal_range (from);
+ for (Iter i = r.first; i != r.second; ++i) {
+ if (i->second.first == to) {
+ return i;
+ }
+ GraphEdges::EdgeMapWithSends::iterator t = find_recursively_in_from_to_with_sends (i->second.first, to);
+ if (t != _from_to_with_sends.end ()) {
+ return t;
+ }
+ }
+
+ return _from_to_with_sends.end ();
+}
+
/** @param via_sends_only if non-0, filled in with true if the edge is a
* path via a send only.
* @return true if the given edge is present.
@@ -78,6 +96,16 @@ GraphEdges::has (GraphVertex from, GraphVertex to, bool* via_sends_only)
return true;
}
+bool
+GraphEdges::feeds (GraphVertex from, GraphVertex to)
+{
+ EdgeMapWithSends::iterator i = find_recursively_in_from_to_with_sends (from, to);
+ if (i == _from_to_with_sends.end ()) {
+ return false;
+ }
+ return true;
+}
+
/** @return the vertices that are fed from `r' */
set<GraphVertex>
GraphEdges::from (GraphVertex r) const