diff options
author | michael-west <michael.west@ettus.com> | 2020-06-12 10:13:35 -0700 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-04 15:41:07 -0500 |
commit | 5a00f4d7864c6258f0d070b4753569413c7cfc4f (patch) | |
tree | 51a0a4634a4f385b10297c5cf191d3cf26f53473 /host/lib/include | |
parent | d7c64eb4b13670dbc5728f994e70dca60616af63 (diff) | |
download | uhd-5a00f4d7864c6258f0d070b4753569413c7cfc4f.tar.gz uhd-5a00f4d7864c6258f0d070b4753569413c7cfc4f.tar.bz2 uhd-5a00f4d7864c6258f0d070b4753569413c7cfc4f.zip |
RFNoC: Add disconnect methods to graph
- Added method to disconnect an edge
- Added method to remove a node
- Fixed algorithm to check edges during connect. Previous code was
checking some edges twice and allowing duplicate edges to be created
for existing edges.
Signed-off-by: michael-west <michael.west@ettus.com>
Diffstat (limited to 'host/lib/include')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/graph.hpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/graph.hpp b/host/lib/include/uhdlib/rfnoc/graph.hpp index a3f6d4e28..fa9921cf6 100644 --- a/host/lib/include/uhdlib/rfnoc/graph.hpp +++ b/host/lib/include/uhdlib/rfnoc/graph.hpp @@ -39,11 +39,24 @@ public: */ void connect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t edge_info); - // void disconnect(node_ref_t src_node, - // node_ref_t dst_node, - // const size_t src_port, - // const size_t dst_port); - // + /*! Remove a connection from the graph + * + * After this function returns, the nodes will be considered disconnected + * along the ports specified in \p edge_info. + * + * \param src_node A reference to the source node + * \param dst_node A reference to the destination node + * \param edge_info Information about the type of edge + */ + void disconnect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t edge_info); + + /*! Remove a node from the graph + * + * Disconnects all edges and removes the node from the graph. + * + * \param src_node A reference to the node + */ + void remove(node_ref_t node); /*! Commit graph and run initial checks * @@ -222,6 +235,12 @@ private: */ void _add_node(node_ref_t node); + /*! Remove a node, but only if it's in the graph. + * + * If it's not there, do nothing. + */ + void _remove_node(node_ref_t node); + /*! Find the neighbouring node for \p origin based on \p port_info * * This function will check port_info to identify the port number and the |