diff options
author | Håkon Vågsether <hakon.vagsether@gmail.com> | 2021-01-06 18:26:48 +0100 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2021-02-11 04:30:57 -0800 |
commit | 7e77ea24382ce2b2c14872653037603e391f2a41 (patch) | |
tree | b9a1756d33e543b32c766d07f21b5ab62ea15b9a | |
parent | 128a40029c686123554de4d65abd6842714b84c6 (diff) |
grc: Call connect() for hier blocks that don't have ports
Signed-off-by: Håkon Vågsether <hakon.vagsether@gmail.com>
-rw-r--r-- | grc/core/generator/cpp_hier_block.py | 3 | ||||
-rw-r--r-- | grc/core/generator/hier_block.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/grc/core/generator/cpp_hier_block.py b/grc/core/generator/cpp_hier_block.py index c4d98e854b..5a17854226 100644 --- a/grc/core/generator/cpp_hier_block.py +++ b/grc/core/generator/cpp_hier_block.py @@ -124,6 +124,9 @@ class CppHierBlockGenerator(CppTopBlockGenerator): ) else: t['make'] = '{cls}()'.format(cls=block_id) + # Self-connect if there aren't any ports + if not data['inputs'] and not data['outputs']: + t['make'] += '\nthis->connect(this->${id});' # Callback data t['callbacks'] = [ diff --git a/grc/core/generator/hier_block.py b/grc/core/generator/hier_block.py index b56ed223c0..9c80271235 100644 --- a/grc/core/generator/hier_block.py +++ b/grc/core/generator/hier_block.py @@ -117,6 +117,10 @@ class HierBlockGenerator(TopBlockGenerator): ) else: t['make'] = '{cls}()'.format(cls=block_id) + # Self-connect if there aren't any ports + if not data['inputs'] and not data['outputs']: + t['make'] += '\nself.connect(self.${id})' + # Callback data t['callbacks'] = [ 'set_{key}(${{ {key} }})'.format(key=param_block.name) for param_block in parameters |