From 52c38e3c22d7c83943c0e1fc0bc69a967d6fe25c Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Wed, 19 Jun 2019 17:40:46 -0700 Subject: rfnoc: Enable users to query connections in the graph Implement uhd::rfnoc::rfnoc_graph::enumerate_*_connections() --- host/lib/rfnoc/graph.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'host/lib/rfnoc/graph.cpp') 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::enumerate_edges() +{ + auto e_iterators = boost::edges(_graph); + std::vector 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 -- cgit v1.2.3