another distcheck fix
[debian/gnuradio] / grc / src / grc_gnuradio / Connection.py
1 """
2 Copyright 2008 Free Software Foundation, Inc.
3 This file is part of GNU Radio
4
5 GNU Radio Companion is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 GNU Radio Companion is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18 """
19 ##@package grc_gnuradio.Connection
20 #Flow graph connection.
21 #A connection exists between 2 ports.
22 #One port must be input, one output.
23 #The port decided whether it can have the connection.
24
25 from grc.elements.Connection import Connection as _Connection
26
27 class Connection(_Connection):
28         
29         def validate(self):
30                 """
31                 Validate the connections.
32                 The ports must match in type and vector length.
33                 """
34                 _Connection.validate(self) #checks type
35                 #check vector length
36                 source_vlen = self.get_source().get_vlen()
37                 sink_vlen = self.get_sink().get_vlen()
38                 try: assert(source_vlen == sink_vlen)
39                 except AssertionError: self._add_error_message('Source vector length "%s" does not match sink vector length "%s".'%(source_vlen, sink_vlen))
40                 
41