GNU Radio 3.9 OOT Module Porting Guide: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
Line 26: Line 26:


Pybind11 bound methods do not implicitly convert int to enum, so blocks that take enum as input, must have either "raw" or "enum" in the grc yml definition of the block.  "Raw" will allow the value to be changed by another variable in the flowgraph.
Pybind11 bound methods do not implicitly convert int to enum, so blocks that take enum as input, must have either "raw" or "enum" in the grc yml definition of the block.  "Raw" will allow the value to be changed by another variable in the flowgraph.
Block inheritance must be specified completely in the python bindings in order to use the inherited methods.  For instance, if a block inherits from sync_block, both block and basic_block must be included in the inheritance specification of the class:
<nowiki>    py::class_<atsc_interleaver,
              gr::sync_block,
              gr::block,
              gr::basic_block,
              std::shared_ptr<atsc_interleaver>>(
        m, "atsc_interleaver", D(atsc_interleaver)) </nowiki>

Revision as of 23:58, 10 June 2020

The major changes in the (in-progress) GNU Radio 3.9 release that will impact OOTs are:

  • C++ modernization (C++11/14?)
  • Replacement of SWIG with Pybind11



C++ Modernization

(Currently merged onto master branch)

The most obvious change that will impact OOTs is that Boost shared pointers have been replaced with std:: shared pointers and memory management. At the top level of each block, the instantiation will need to change, e.g.

In include/blockname_xx.h:

typedef std::shared_ptr<blockname_xx> sptr;

Pybind11 Python Bindings

(NOT MERGED - future changes)

OOT Workflow

OOT Migration

Caveats

Pybind11 bound methods do not implicitly convert int to enum, so blocks that take enum as input, must have either "raw" or "enum" in the grc yml definition of the block. "Raw" will allow the value to be changed by another variable in the flowgraph.

Block inheritance must be specified completely in the python bindings in order to use the inherited methods. For instance, if a block inherits from sync_block, both block and basic_block must be included in the inheritance specification of the class:

    py::class_<atsc_interleaver,
               gr::sync_block,
               gr::block,
               gr::basic_block,
               std::shared_ptr<atsc_interleaver>>(
        m, "atsc_interleaver", D(atsc_interleaver))