diff options
author | Josh Blum | 2011-10-08 10:23:00 -0700 |
---|---|---|
committer | Josh Blum | 2011-10-12 15:54:55 -0700 |
commit | 413964379c19fce5c2c0ad25d1de968a68744f4d (patch) | |
tree | cd492a076e2879e42b92375de1982841bbd24e2b /grc/python/Connection.py | |
parent | 178590c3afae08ccafd3db711e2cfa65c841403f (diff) | |
download | gnuradio-413964379c19fce5c2c0ad25d1de968a68744f4d.tar.gz gnuradio-413964379c19fce5c2c0ad25d1de968a68744f4d.tar.bz2 gnuradio-413964379c19fce5c2c0ad25d1de968a68744f4d.zip |
grc: added new IO types
Added all complex/real float/integer types.
Used volk naming convention: fc32, etc...
The port type checking now relies on IO size,
therefore a short vector of length 2 can connect to a complex short,
a float can connect to an int.
Basically, the same size checking done in gnuradio runtime.
Diffstat (limited to 'grc/python/Connection.py')
-rw-r--r-- | grc/python/Connection.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/grc/python/Connection.py b/grc/python/Connection.py index 39f915740..218baf074 100644 --- a/grc/python/Connection.py +++ b/grc/python/Connection.py @@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import Constants +from .. base.Element import Element from .. base.Connection import Connection as _Connection from .. gui.Connection import Connection as _GUIConnection @@ -32,11 +34,10 @@ class Connection(_Connection, _GUIConnection): def validate(self): """ Validate the connections. - The ports must match in type and vector length. + The ports must match in io size. """ - _Connection.validate(self) #checks type - #check vector length - source_vlen = self.get_source().get_vlen() - sink_vlen = self.get_sink().get_vlen() - if source_vlen != sink_vlen: - self.add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen)) + Element.validate(self) + source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen() + sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen() + if source_size != sink_size: + self.add_error_message('Source IO size "%s" does not match sink IO size "%s".'%(source_size, sink_size)) |