diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-06-03 23:28:19 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:24 -0800 |
commit | 01f08d3fa5ae0cd8a2fc3c6e1112117a1f7f9768 (patch) | |
tree | 7fb49f7e0ab5329c29c292df001cd61390eae5f0 /host/lib/rfnoc/node.cpp | |
parent | 802afa6eecee368ec8e28044ce22fd39c0f93ae8 (diff) | |
download | uhd-01f08d3fa5ae0cd8a2fc3c6e1112117a1f7f9768.tar.gz uhd-01f08d3fa5ae0cd8a2fc3c6e1112117a1f7f9768.tar.bz2 uhd-01f08d3fa5ae0cd8a2fc3c6e1112117a1f7f9768.zip |
rfnoc: Add check_topology() API to nodes
This API lets blocks decide if their current topology is OK for them,
and make decisions based on their topology.
Diffstat (limited to 'host/lib/rfnoc/node.cpp')
-rw-r--r-- | host/lib/rfnoc/node.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/host/lib/rfnoc/node.cpp b/host/lib/rfnoc/node.cpp index 33649b23f..7eff22eab 100644 --- a/host/lib/rfnoc/node.cpp +++ b/host/lib/rfnoc/node.cpp @@ -154,6 +154,23 @@ void node_t::post_action( _post_action_cb(edge_info, action); } +bool node_t::check_topology(const std::vector<size_t>& connected_inputs, + const std::vector<size_t>& connected_outputs) +{ + for (size_t port : connected_inputs) { + if (port >= get_num_input_ports()) { + return false; + } + } + for (size_t port : connected_outputs) { + if (port >= get_num_output_ports()) { + return false; + } + } + + return true; +} + /*** Private methods *********************************************************/ property_base_t* node_t::_find_property( res_source_info src_info, const std::string& id) const |