diff options
author | jcorgan | 2008-02-24 01:54:50 +0000 |
---|---|---|
committer | jcorgan | 2008-02-24 01:54:50 +0000 |
commit | b0245c71f07edd7921f0b70d9050781b5cb0c4b2 (patch) | |
tree | 0876cb73bde3753b6a6a49057fb970e7176575be /gnuradio-core/src | |
parent | c6bb9986f005bbc2da298c637cee6748bb377ae8 (diff) | |
download | gnuradio-b0245c71f07edd7921f0b70d9050781b5cb0c4b2.tar.gz gnuradio-b0245c71f07edd7921f0b70d9050781b5cb0c4b2.tar.bz2 gnuradio-b0245c71f07edd7921f0b70d9050781b5cb0c4b2.zip |
Fix topology checking code in gr_flowgraph. Thanks to Dan Halperin.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7802 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_flowgraph.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc index f4879f085..359570347 100644 --- a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc +++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc @@ -124,7 +124,7 @@ gr_flowgraph::check_valid_port(gr_io_signature_sptr sig, int port) } int max = sig->max_streams(); - if (max >= 0 && port >= max) { + if (max != gr_io_signature::IO_INFINITE && port >= max) { msg << "port number " << port << " exceeds max of "; if (max == 0) msg << "(none)"; @@ -230,16 +230,23 @@ gr_flowgraph::check_contiguity(gr_basic_block_sptr block, int nports = used_ports.size(); int min_ports = sig->min_streams(); + int max_ports = sig->max_streams(); - if (nports == 0) { - if (min_ports == 0) - return; - else { - msg << block << ": insufficient connected " - << (check_inputs ? "input ports " : "output ports ") - << "(" << min_ports+1 << " needed, " << nports+1 << " connected)"; - throw std::runtime_error(msg.str()); - } + if (nports == 0 && min_ports == 0) + return; + + if (nports < min_ports) { + msg << block << ": insufficient connected " + << (check_inputs ? "input ports " : "output ports ") + << "(" << min_ports << " needed, " << nports << " connected)"; + throw std::runtime_error(msg.str()); + } + + if (nports > max_ports && max_ports != gr_io_signature::IO_INFINITE) { + msg << block << ": too many connected " + << (check_inputs ? "input ports " : "output ports ") + << "(" << max_ports << " allowed, " << nports << " connected)"; + throw std::runtime_error(msg.str()); } if (used_ports[nports-1]+1 != nports) { |