https://wiki.gnuradio.org/index.php?title=FASSWG_msg_actions&feed=atom&action=history
FASSWG msg actions - Revision history
2024-03-28T09:12:21Z
Revision history for this page on the wiki
MediaWiki 1.39.5
https://wiki.gnuradio.org/index.php?title=FASSWG_msg_actions&diff=719&oldid=prev
Devnulling: Fix formatting - html entities
2017-03-21T01:23:38Z
<p>Fix formatting - html entities</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:23, 21 March 2017</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l11">Line 11:</td>
<td colspan="2" class="diff-lineno">Line 11:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Theory of operation: ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Theory of operation: ==</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Registering a <del style="font-weight: bold; text-decoration: none;">&quot;</del>normal<del style="font-weight: bold; text-decoration: none;">&quot; </del>class methods or functions as action to be executed on message won't work, because <del style="font-weight: bold; text-decoration: none;">&quot;</del>normal<del style="font-weight: bold; text-decoration: none;">&quot; </del>methods don't take <code>pmt_t</code>.</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Registering a <ins style="font-weight: bold; text-decoration: none;">"</ins>normal<ins style="font-weight: bold; text-decoration: none;">" </ins>class methods or functions as action to be executed on message won't work, because <ins style="font-weight: bold; text-decoration: none;">"</ins>normal<ins style="font-weight: bold; text-decoration: none;">" </ins>methods don't take <code>pmt_t</code>.</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Define a combined converter + <del style="font-weight: bold; text-decoration: none;">&quot;</del>normal<del style="font-weight: bold; text-decoration: none;">&quot; </del>method: Input is <code>pmt_t</code>, output is void, but in between, <code>pmt_t</code> gets converted to the native argument type of the method</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Define a combined converter + <ins style="font-weight: bold; text-decoration: none;">"</ins>normal<ins style="font-weight: bold; text-decoration: none;">" </ins>method: Input is <code>pmt_t</code>, output is void, but in between, <code>pmt_t</code> gets converted to the native argument type of the method</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Define a converter function; in most case, the PMT standard converters do, e.g. <code>pmt::to_long</code><br /></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Define a converter function; in most case, the PMT standard converters do, e.g. <code>pmt::to_long</code><br /></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l24">Line 24:</td>
<td colspan="2" class="diff-lineno">Line 24:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><code>basic_block::register_msg_action(key,conv,action)</code> method (or rather four methods, including three convenience wrappers):</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><code>basic_block::register_msg_action(key,conv,action)</code> method (or rather four methods, including three convenience wrappers):</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* '''<code>register_msg_action</code>''' <code>(pmt_t </code> '''<code>key</code>''' <code>, function<del style="font-weight: bold; text-decoration: none;">&lt;</del>ArbitraryType(pmt_t)<del style="font-weight: bold; text-decoration: none;">&gt;</del></code> '''<code>converter</code>''' <code>, function<del style="font-weight: bold; text-decoration: none;">&lt;</del>void(ArbitraryType)<del style="font-weight: bold; text-decoration: none;">&gt;</del></code> '''<code>action</code>''' <code>)</code><br /></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* '''<code>register_msg_action</code>''' <code>(pmt_t </code> '''<code>key</code>''' <code>, function<ins style="font-weight: bold; text-decoration: none;"><</ins>ArbitraryType(pmt_t)<ins style="font-weight: bold; text-decoration: none;">></ins></code> '''<code>converter</code>''' <code>, function<ins style="font-weight: bold; text-decoration: none;"><</ins>void(ArbitraryType)<ins style="font-weight: bold; text-decoration: none;">></ins></code> '''<code>action</code>''' <code>)</code><br /></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>registers an action by generating a function chain functor, and putting that in a std::vector in a std::map.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>registers an action by generating a function chain functor, and putting that in a std::vector in a std::map.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* <code>basic_block::trigger_actions(key, value)</code><br /></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* <code>basic_block::trigger_actions(key, value)</code><br /></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>triggers all actions registered for a single key</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>triggers all actions registered for a single key</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* <code>basic_block::process_action_msg(pmt::pair)</code><br /></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* <code>basic_block::process_action_msg(pmt::pair)</code><br /></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>takes in pairs like <code>pmt::cons(pmt::mp(<del style="font-weight: bold; text-decoration: none;">&quot;</del>interpolation<del style="font-weight: bold; text-decoration: none;">&quot;</del>), pmt::from_long(100))</code></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>takes in pairs like <code>pmt::cons(pmt::mp(<ins style="font-weight: bold; text-decoration: none;">"</ins>interpolation<ins style="font-weight: bold; text-decoration: none;">"</ins>), pmt::from_long(100))</code></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* the <code>boost::bind</code> magic that GR already uses when doing <code>register_msg_handler</code> gets used, so (hopefully) no new dependencies or boost strangenesses.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* the <code>boost::bind</code> magic that GR already uses when doing <code>register_msg_handler</code> gets used, so (hopefully) no new dependencies or boost strangenesses.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* the <code>basic_block</code> constructor now sets up a message port to which one can send such pairs, and registers <code>process_action_msg</code> as handler</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* the <code>basic_block</code> constructor now sets up a message port to which one can send such pairs, and registers <code>process_action_msg</code> as handler</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l37">Line 37:</td>
<td colspan="2" class="diff-lineno">Line 37:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Intrinsic:''' <code>gr::blocks::repeat_impl</code> has a non-thread-safe <code>set_interpolation(int)</code> method. It wants to keep that private and expose a message action. It does</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Intrinsic:''' <code>gr::blocks::repeat_impl</code> has a non-thread-safe <code>set_interpolation(int)</code> method. It wants to keep that private and expose a message action. It does</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><pre>boost::function action = boost::bind(&<del style="font-weight: bold; text-decoration: none;">amp;</del>repeat_impl::set_interpolation, this, _1);@</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><pre>boost::function action = boost::bind(&repeat_impl::set_interpolation, this, _1);@</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>register_msg_action(pmt::mp(<del style="font-weight: bold; text-decoration: none;">&quot;</del>interpolation<del style="font-weight: bold; text-decoration: none;">&quot;</del>), pmt::to_long, action);</pre></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>register_msg_action(pmt::mp(<ins style="font-weight: bold; text-decoration: none;">"</ins>interpolation<ins style="font-weight: bold; text-decoration: none;">"</ins>), pmt::to_long, action);</pre></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Extrinsic:''' User/GRC knows there's a <code>multiply_const_x::set_k(float)</code> method, but <code>multiply_const</code> doesn't offer a message passing interface. Instead of despairing, we now can do</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Extrinsic:''' User/GRC knows there's a <code>multiply_const_x::set_k(float)</code> method, but <code>multiply_const</code> doesn't offer a message passing interface. Instead of despairing, we now can do</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><pre>boost::function action = boost::bind(&<del style="font-weight: bold; text-decoration: none;">amp;</del>repeat_impl::set_interpolation, this, _1);</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><pre>boost::function action = boost::bind(&repeat_impl::set_interpolation, this, _1);</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>multiply_const_0-<del style="font-weight: bold; text-decoration: none;">&gt;</del>register_msg_action(pmt::mp(<del style="font-weight: bold; text-decoration: none;">&quot;</del>factor<del style="font-weight: bold; text-decoration: none;">&quot;</del>), pmt::to_float, action);</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>multiply_const_0-<ins style="font-weight: bold; text-decoration: none;">></ins>register_msg_action(pmt::mp(<ins style="font-weight: bold; text-decoration: none;">"</ins>factor<ins style="font-weight: bold; text-decoration: none;">"</ins>), pmt::to_float, action);</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></pre>and send pairs (key, value) to the <code>pmt::mp(<del style="font-weight: bold; text-decoration: none;">&quot;</del>actions<del style="font-weight: bold; text-decoration: none;">&quot;</del>)</code> msg port of the respective block</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></pre>and send pairs (key, value) to the <code>pmt::mp(<ins style="font-weight: bold; text-decoration: none;">"</ins>actions<ins style="font-weight: bold; text-decoration: none;">"</ins>)</code> msg port of the respective block</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Discussion ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Discussion ==</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* How to do getters?</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* How to do getters?</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Should GR have one central settings <del style="font-weight: bold; text-decoration: none;">&quot;</del>bus<del style="font-weight: bold; text-decoration: none;">&quot;</del>, to which blocks' setters automatically are subscribed?</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Should GR have one central settings <ins style="font-weight: bold; text-decoration: none;">"</ins>bus<ins style="font-weight: bold; text-decoration: none;">"</ins>, to which blocks' setters automatically are subscribed?</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Yet to do ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Yet to do ==</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l56">Line 56:</td>
<td colspan="2" class="diff-lineno">Line 56:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* replacing GRC's callback mechanism by something that registers a python function as action handler</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* replacing GRC's callback mechanism by something that registers a python function as action handler</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Will require that <del style="font-weight: bold; text-decoration: none;">&quot;</del>Variable<del style="font-weight: bold; text-decoration: none;">&quot; </del>GRC blocks are aware of this<br /></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Will require that <ins style="font-weight: bold; text-decoration: none;">"</ins>Variable<ins style="font-weight: bold; text-decoration: none;">" </ins>GRC blocks are aware of this<br /></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* All blocks <del style="font-weight: bold; text-decoration: none;">&quot;</del>observing<del style="font-weight: bold; text-decoration: none;">&quot; </del>variable get their <del style="font-weight: bold; text-decoration: none;">&quot;</del>actions<del style="font-weight: bold; text-decoration: none;">&quot; </del>port subscribed to the variable's message_publisher</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* All blocks <ins style="font-weight: bold; text-decoration: none;">"</ins>observing<ins style="font-weight: bold; text-decoration: none;">" </ins>variable get their <ins style="font-weight: bold; text-decoration: none;">"</ins>actions<ins style="font-weight: bold; text-decoration: none;">" </ins>port subscribed to the variable's message_publisher</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>As you can see, not nearly complete, but already useful. I'm not quite sure the naming and architecture take things in the right direction, so I RFC before I PR.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>As you can see, not nearly complete, but already useful. I'm not quite sure the naming and architecture take things in the right direction, so I RFC before I PR.</div></td></tr>
<!-- diff cache key mediawiki:diff::1.12:old-666:rev-719 -->
</table>
Devnulling
https://wiki.gnuradio.org/index.php?title=FASSWG_msg_actions&diff=666&oldid=prev
MurrayThomson123: Removed: Extra empty spaces
2017-03-20T12:11:38Z
<p>Removed: Extra empty spaces</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:11, 20 March 2017</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l41">Line 41:</td>
<td colspan="2" class="diff-lineno">Line 41:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Extrinsic:''' User/GRC knows there's a <code>multiply_const_x::set_k(float)</code> method, but <code>multiply_const</code> doesn't offer a message passing interface. Instead of despairing, we now can do</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* '''Extrinsic:''' User/GRC knows there's a <code>multiply_const_x::set_k(float)</code> method, but <code>multiply_const</code> doesn't offer a message passing interface. Instead of despairing, we now can do</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><pre> <del style="font-weight: bold; text-decoration: none;"> </del>boost::function action = boost::bind(&amp;repeat_impl::set_interpolation, this, _1);</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><pre>boost::function action = boost::bind(&amp;repeat_impl::set_interpolation, this, _1);</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del>multiply_const_0-&gt;register_msg_action(pmt::mp(&quot;factor&quot;), pmt::to_float, action);</pre></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>multiply_const_0-&gt;register_msg_action(pmt::mp(&quot;factor&quot;), pmt::to_float, action);</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>and send pairs (key, value) to the <code>pmt::mp(&quot;actions&quot;)</code> msg port of the respective block</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></pre>and send pairs (key, value) to the <code>pmt::mp(&quot;actions&quot;)</code> msg port of the respective block</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Discussion ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Discussion ==</div></td></tr>
<!-- diff cache key mediawiki:diff::1.12:old-45:rev-666 -->
</table>
MurrayThomson123
https://wiki.gnuradio.org/index.php?title=FASSWG_msg_actions&diff=45&oldid=prev
Mbr0wn: Imported from Redmine
2017-03-08T01:36:16Z
<p>Imported from Redmine</p>
<p><b>New page</b></p><div>= msg_actions PROPOSAL =<br />
<br />
== Problem ==<br />
<br />
Millions of setters in GNU Radio. Some safe to call from another thread whilst general_work is running, others not. No unified scheme of communicating settings.<br />
<br />
== Approach ==<br />
<br />
Harnessing the power of message passing, and using a bit of old school boost magic to put functions into STL containers, so that they can be automagically called.<br />
<br />
== Theory of operation: ==<br />
<br />
* Registering a &quot;normal&quot; class methods or functions as action to be executed on message won't work, because &quot;normal&quot; methods don't take <code>pmt_t</code>.<br />
* Define a combined converter + &quot;normal&quot; method: Input is <code>pmt_t</code>, output is void, but in between, <code>pmt_t</code> gets converted to the native argument type of the method<br />
<br />
* Define a converter function; in most case, the PMT standard converters do, e.g. <code>pmt::to_long</code><br /><br />
* Find a way to do something like a lambda without breaking with old Boost / C++-pre-0x<br />
<br />
* Registry can then be of function(al)s that are <code>void action(pmt_t)</code><br />
* Registry has <code>std::vector</code> of actions to be taken upon a specific key<br />
<br />
== [https://github.com/marcusmueller/gnuradio/tree/runtime_add_message_port_wrappers Implementation so far] ==<br />
<br />
<code>basic_block::register_msg_action(key,conv,action)</code> method (or rather four methods, including three convenience wrappers):<br />
<br />
* '''<code>register_msg_action</code>''' <code>(pmt_t </code> '''<code>key</code>''' <code>, function&lt;ArbitraryType(pmt_t)&gt;</code> '''<code>converter</code>''' <code>, function&lt;void(ArbitraryType)&gt;</code> '''<code>action</code>''' <code>)</code><br /><br />
registers an action by generating a function chain functor, and putting that in a std::vector in a std::map.<br />
* <code>basic_block::trigger_actions(key, value)</code><br /><br />
triggers all actions registered for a single key<br />
* <code>basic_block::process_action_msg(pmt::pair)</code><br /><br />
takes in pairs like <code>pmt::cons(pmt::mp(&quot;interpolation&quot;), pmt::from_long(100))</code><br />
* the <code>boost::bind</code> magic that GR already uses when doing <code>register_msg_handler</code> gets used, so (hopefully) no new dependencies or boost strangenesses.<br />
* the <code>basic_block</code> constructor now sets up a message port to which one can send such pairs, and registers <code>process_action_msg</code> as handler<br />
<br />
== Use Cases ==<br />
<br />
* '''Intrinsic:''' <code>gr::blocks::repeat_impl</code> has a non-thread-safe <code>set_interpolation(int)</code> method. It wants to keep that private and expose a message action. It does<br />
<br />
<pre>boost::function action = boost::bind(&amp;repeat_impl::set_interpolation, this, _1);@<br />
register_msg_action(pmt::mp(&quot;interpolation&quot;), pmt::to_long, action);</pre><br />
* '''Extrinsic:''' User/GRC knows there's a <code>multiply_const_x::set_k(float)</code> method, but <code>multiply_const</code> doesn't offer a message passing interface. Instead of despairing, we now can do<br />
<br />
<pre> boost::function action = boost::bind(&amp;repeat_impl::set_interpolation, this, _1);<br />
multiply_const_0-&gt;register_msg_action(pmt::mp(&quot;factor&quot;), pmt::to_float, action);</pre><br />
and send pairs (key, value) to the <code>pmt::mp(&quot;actions&quot;)</code> msg port of the respective block<br />
<br />
== Discussion ==<br />
<br />
* How to do getters?<br />
* Should GR have one central settings &quot;bus&quot;, to which blocks' setters automatically are subscribed?<br />
<br />
== Yet to do ==<br />
<br />
* drawing pretty pictures and expanding docs beyond the doxygen method docs<br />
* block_gateway to enable python methods to be registered. Should be relatively simple, if it weren't for swig.<br />
* replacing GRC's callback mechanism by something that registers a python function as action handler<br />
<br />
* Will require that &quot;Variable&quot; GRC blocks are aware of this<br /><br />
* All blocks &quot;observing&quot; variable get their &quot;actions&quot; port subscribed to the variable's message_publisher<br />
<br />
As you can see, not nearly complete, but already useful. I'm not quite sure the naming and architecture take things in the right direction, so I RFC before I PR.</div>
Mbr0wn