GNU Radio 4.0 OOT Module Porting Guide: Difference between revisions
(Created page with "== Porting Guide for 4.0 Out of Tree Modules == '''Right now this is a placeholder with a series of notes and reminders, and not an actual porting guide''' === Zero Item Size Blocks === * Head * Copy * Null Source * Null Sink The parameter for item size has been moved to the end, and defaults to 0. This means the item size will be deduced from the connection of the previous block. To make a block with a deduced item size, you need to get the size of items from the...") |
|||
Line 19: | Line 19: | ||
... | ... | ||
}</code> | }</code> | ||
=== Coding Guidelines === | |||
* Use #pragma once instead of include guards | |||
=== Kernel Namespaces === | |||
In-tree, things that can be separated from the block implementations have been placed (or should be placed) into the kernel library. | |||
This includes things such as filter or math routines, that are not blocks, but carry some computational function that could be | |||
useful by more than one block, or outside of GNU Radio altogether | |||
The general namespace mapping of these objects is: | |||
<code>namespace gr { | |||
namespace kernel { | |||
namespace [modulename] { | |||
} | |||
} | |||
} | |||
</code> | |||
So when including things that used to just be at the module level, now live one level deeper | |||
In python, this can be seen as | |||
<code>from gnuradio.kernel.filter import firdes</code> |
Revision as of 13:28, 13 October 2022
Porting Guide for 4.0 Out of Tree Modules
Right now this is a placeholder with a series of notes and reminders, and not an actual porting guide
Zero Item Size Blocks
- Head
- Copy
- Null Source
- Null Sink
The parameter for item size has been moved to the end, and defaults to 0. This means the item size will be deduced from the connection of the previous block.
To make a block with a deduced item size, you need to get the size of items from the buffer object in the work function
work(work_io& wio) {
...
auto size = wio.outputs()[0].n_items * wio.outputs()[0].buf().item_size();
...
}
Coding Guidelines
- Use #pragma once instead of include guards
Kernel Namespaces
In-tree, things that can be separated from the block implementations have been placed (or should be placed) into the kernel library. This includes things such as filter or math routines, that are not blocks, but carry some computational function that could be useful by more than one block, or outside of GNU Radio altogether
The general namespace mapping of these objects is:
namespace gr {
namespace kernel {
namespace [modulename] {
}
}
}
So when including things that used to just be at the module level, now live one level deeper
In python, this can be seen as
from gnuradio.kernel.filter import firdes