aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/node_ctrl_base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/node_ctrl_base.cpp')
-rw-r--r--host/lib/rfnoc/node_ctrl_base.cpp88
1 files changed, 43 insertions, 45 deletions
diff --git a/host/lib/rfnoc/node_ctrl_base.cpp b/host/lib/rfnoc/node_ctrl_base.cpp
index 46a804ab9..a6ee80f8b 100644
--- a/host/lib/rfnoc/node_ctrl_base.cpp
+++ b/host/lib/rfnoc/node_ctrl_base.cpp
@@ -26,68 +26,59 @@ void node_ctrl_base::clear()
_downstream_nodes.clear();
}
-void node_ctrl_base::_register_downstream_node(
- node_ctrl_base::sptr,
- size_t
-) {
- throw uhd::runtime_error("Attempting to register a downstream block on a non-source node.");
+void node_ctrl_base::_register_downstream_node(node_ctrl_base::sptr, size_t)
+{
+ throw uhd::runtime_error(
+ "Attempting to register a downstream block on a non-source node.");
}
-void node_ctrl_base::_register_upstream_node(
- node_ctrl_base::sptr,
- size_t
-) {
- throw uhd::runtime_error("Attempting to register an upstream block on a non-sink node.");
+void node_ctrl_base::_register_upstream_node(node_ctrl_base::sptr, size_t)
+{
+ throw uhd::runtime_error(
+ "Attempting to register an upstream block on a non-sink node.");
}
-void node_ctrl_base::set_downstream_port(
- const size_t this_port,
- const size_t remote_port
-) {
+void node_ctrl_base::set_downstream_port(const size_t this_port, const size_t remote_port)
+{
if (not _downstream_nodes.count(this_port) and remote_port != ANY_PORT) {
- throw uhd::value_error(str(
- boost::format("[%s] Cannot set remote downstream port: Port %d not connected.")
- % unique_id() % this_port
- ));
+ throw uhd::value_error(
+ str(boost::format(
+ "[%s] Cannot set remote downstream port: Port %d not connected.")
+ % unique_id() % this_port));
}
_downstream_ports[this_port] = remote_port;
}
size_t node_ctrl_base::get_downstream_port(const size_t this_port)
{
- if (not _downstream_ports.count(this_port)
- or not _downstream_nodes.count(this_port)
+ if (not _downstream_ports.count(this_port) or not _downstream_nodes.count(this_port)
or _downstream_ports[this_port] == ANY_PORT) {
- throw uhd::value_error(str(
- boost::format("[%s] Cannot retrieve remote downstream port: Port %d not connected.")
- % unique_id() % this_port
- ));
+ throw uhd::value_error(
+ str(boost::format(
+ "[%s] Cannot retrieve remote downstream port: Port %d not connected.")
+ % unique_id() % this_port));
}
return _downstream_ports[this_port];
}
-void node_ctrl_base::set_upstream_port(
- const size_t this_port,
- const size_t remote_port
-) {
+void node_ctrl_base::set_upstream_port(const size_t this_port, const size_t remote_port)
+{
if (not _upstream_nodes.count(this_port) and remote_port != ANY_PORT) {
throw uhd::value_error(str(
boost::format("[%s] Cannot set remote upstream port: Port %d not connected.")
- % unique_id() % this_port
- ));
+ % unique_id() % this_port));
}
_upstream_ports[this_port] = remote_port;
}
size_t node_ctrl_base::get_upstream_port(const size_t this_port)
{
- if (not _upstream_ports.count(this_port)
- or not _upstream_nodes.count(this_port)
+ if (not _upstream_ports.count(this_port) or not _upstream_nodes.count(this_port)
or _upstream_ports[this_port] == ANY_PORT) {
- throw uhd::value_error(str(
- boost::format("[%s] Cannot retrieve remote upstream port: Port %d not connected.")
- % unique_id() % this_port
- ));
+ throw uhd::value_error(
+ str(boost::format(
+ "[%s] Cannot retrieve remote upstream port: Port %d not connected.")
+ % unique_id() % this_port));
}
return _upstream_ports[this_port];
}
@@ -95,7 +86,8 @@ size_t node_ctrl_base::get_upstream_port(const size_t this_port)
void node_ctrl_base::disconnect()
{
// Notify neighbours:
- for (node_map_t::iterator i = _downstream_nodes.begin(); i != _downstream_nodes.end(); ++i) {
+ for (node_map_t::iterator i = _downstream_nodes.begin(); i != _downstream_nodes.end();
+ ++i) {
sptr downstream_node = i->second.lock();
if (not downstream_node) {
// Actually this is not OK
@@ -103,7 +95,8 @@ void node_ctrl_base::disconnect()
}
downstream_node->disconnect_input_port(_downstream_ports[i->first]);
}
- for (node_map_t::iterator i = _upstream_nodes.begin(); i != _upstream_nodes.end(); ++i) {
+ for (node_map_t::iterator i = _upstream_nodes.begin(); i != _upstream_nodes.end();
+ ++i) {
sptr upstream_node = i->second.lock();
if (not upstream_node) {
// Actually this is not OK
@@ -120,9 +113,12 @@ void node_ctrl_base::disconnect()
void node_ctrl_base::disconnect_output_port(const size_t output_port)
{
- if (_downstream_nodes.count(output_port) == 0 or
- _downstream_ports.count(output_port) == 0) {
- throw uhd::assertion_error(str(boost::format("[%s] Attempting to disconnect output port %u, which is not registered as connected!") % unique_id() % output_port));
+ if (_downstream_nodes.count(output_port) == 0
+ or _downstream_ports.count(output_port) == 0) {
+ throw uhd::assertion_error(
+ str(boost::format("[%s] Attempting to disconnect output port %u, which is "
+ "not registered as connected!")
+ % unique_id() % output_port));
}
_downstream_nodes.erase(output_port);
_downstream_ports.erase(output_port);
@@ -130,11 +126,13 @@ void node_ctrl_base::disconnect_output_port(const size_t output_port)
void node_ctrl_base::disconnect_input_port(const size_t input_port)
{
- if (_upstream_nodes.count(input_port) == 0 or
- _upstream_ports.count(input_port) == 0) {
- throw uhd::assertion_error(str(boost::format("[%s] Attempting to disconnect input port %u, which is not registered as connected!") % unique_id() % input_port));
+ if (_upstream_nodes.count(input_port) == 0
+ or _upstream_ports.count(input_port) == 0) {
+ throw uhd::assertion_error(
+ str(boost::format("[%s] Attempting to disconnect input port %u, which is not "
+ "registered as connected!")
+ % unique_id() % input_port));
}
_upstream_nodes.erase(input_port);
_upstream_ports.erase(input_port);
}
-