|
From: | Marcus Müller |
Subject: | Re: [Discuss-gnuradio] Message passing(connect) in C++ |
Date: | Thu, 30 Apr 2015 16:37:22 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
Hi Marco, ok, I think it's best if I describe a bit of what happens behind the curtains: GRC is really just a graphical generator for python code. As soon as you hit the "generate" button (or the run button, where generating is done inherently), python code is written that has no connection, knowledge or dependency to the XML that was used to generate it. From a user-friendliness point of view, I can fully understand your approach to take the burden to explicitly connect up- and downstream blocks off your user's shoulders. You can actually hack together something like that even without the use of tags, by just implementing a start() method in your block. You'd pass a top_block::sptr to the constructor, and then, in your_block::start() get the upstream block doing your_block::detail()->input(0)->buffer()->link(), check that block for being your other block type, and if not, continue the search through the flow graph in the same matter. After you've found your other block, ou use your stored top_block::sptr to ->msg_connect(other_block, this_block). However: that breaks a lot of assumptions I would made when looking at a flow graph, mainly the assumption that downstream blocks don't invisibly influence behaviour of upstream blocks. Honestly, letting your user connect your two blocks with msg_connect doesn't sound like a bad idea in the long run. Or you come up with a hier-block-based approach: -- are sample streams, ## message passing .----------------------------------------------. | your_hier_block | |----------------------------------------------| | | | .------------------------. | | | your_upstream_block | | | |------------------------| | | --->| |---------------->to user blocks | | | | | | | '------------------------' | --------------->|--- ^ | | # | | # | | .------------------------. | | | your_downstream_block | | | |------------------------| | | | |<----------------from user blocks | | | | | '------------------------' | | | | '--------------------|-------------------------' ------------------------------>to further processing Best regards, Marcus On 04/30/2015 02:51 PM, marco Ribero wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |