commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7802 - gnuradio/trunk/gnuradio-core/src/lib/runtime


From: jcorgan
Subject: [Commit-gnuradio] r7802 - gnuradio/trunk/gnuradio-core/src/lib/runtime
Date: Sat, 23 Feb 2008 18:54:50 -0700 (MST)

Author: jcorgan
Date: 2008-02-23 18:54:50 -0700 (Sat, 23 Feb 2008)
New Revision: 7802

Modified:
   gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
Log:
Fix topology checking code in gr_flowgraph.  Thanks to Dan Halperin.

Modified: gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_flowgraph.cc        
2008-02-24 01:42:50 UTC (rev 7801)
+++ gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_flowgraph.cc        
2008-02-24 01:54:50 UTC (rev 7802)
@@ -124,7 +124,7 @@
   }
 
   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,18 +230,25 @@
 
   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) {
     for (int i = 0; i < nports; i++) {
       if (used_ports[i] != i) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]