aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/graph.cpp
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-06-19 17:40:46 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:29 -0800
commit52c38e3c22d7c83943c0e1fc0bc69a967d6fe25c (patch)
tree1fec490bc9297c21b43805f942cf8982b7c98260 /host/lib/rfnoc/graph.cpp
parent50f8e9f35f776016ec8df7edad570d9d8084afdb (diff)
downloaduhd-52c38e3c22d7c83943c0e1fc0bc69a967d6fe25c.tar.gz
uhd-52c38e3c22d7c83943c0e1fc0bc69a967d6fe25c.tar.bz2
uhd-52c38e3c22d7c83943c0e1fc0bc69a967d6fe25c.zip
rfnoc: Enable users to query connections in the graph
Implement uhd::rfnoc::rfnoc_graph::enumerate_*_connections()
Diffstat (limited to 'host/lib/rfnoc/graph.cpp')
-rw-r--r--host/lib/rfnoc/graph.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/host/lib/rfnoc/graph.cpp b/host/lib/rfnoc/graph.cpp
index cbb7ab140..174d72389 100644
--- a/host/lib/rfnoc/graph.cpp
+++ b/host/lib/rfnoc/graph.cpp
@@ -189,6 +189,20 @@ void graph_t::release()
_release_count++;
}
+std::vector<graph_t::graph_edge_t> graph_t::enumerate_edges()
+{
+ auto e_iterators = boost::edges(_graph);
+ std::vector<graph_edge_t> result;
+ for (auto e_it = e_iterators.first; e_it != e_iterators.second; ++e_it) {
+ graph_edge_t edge_info = boost::get(edge_property_t(), _graph, *e_it);
+ // This is probably the dumbest way to make sure that the in- and out-
+ // edges don't both get stashed, but it works for now
+ if (std::find(result.begin(), result.end(), edge_info) == result.end()) {
+ result.push_back(boost::get(edge_property_t(), _graph, *e_it));
+ }
+ }
+ return result;
+}
/******************************************************************************
* Private methods to be called by friends