Head: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Copies the first N items to the output then signals done. Very useful for limiting how many samples get saved to a file when using the File Sink. If the flowgraph opti...") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Block Docs]] | |||
Copies the first N items to the output then signals done. Very useful for limiting how many samples get saved to a file when using the [[File Sink]]. | Copies the first N items to the output then signals done. Very useful for limiting how many samples get saved to a file when using the [[File Sink]]. | ||
If the flowgraph options are set to "No GUI" and "Run until completion", then as long as there is only one branch in the flowgraph, this block will cause the flowgraph to finish when N samples are reached. | If the flowgraph options are set to "No GUI" and "Run until completion", then as long as there is only one branch in the flowgraph, this block will cause the flowgraph execution to finish when N samples are reached. | ||
When branching, may block others branches: samples are not consumed and fill upstream buffers. | |||
== Parameters == | |||
; Num Items | |||
: Number of samples to copy | |||
; Vec Length | |||
: Size of the input and output vector | |||
== Example Flowgraph == | |||
In this setup, both Time sinks will stop after the Head has reach the specified number of items. The Upstream time sink may see more items than the downstream one, depending on the size of the buffer between the source and the head. | |||
[[File:Blocking-head-ex.png]] | |||
== Source Files == | |||
; C++ Files | |||
[https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/head_impl.cc head_impl.cc] | |||
; Header files | |||
[https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/head_impl.h head_impl.h] | |||
; Public header files | |||
[https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/include/gnuradio/blocks/head.h head.h] | |||
; Block definition | |||
[https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_head.block.yml blocks_head.block.yml] |
Latest revision as of 05:36, 16 February 2022
Copies the first N items to the output then signals done. Very useful for limiting how many samples get saved to a file when using the File Sink.
If the flowgraph options are set to "No GUI" and "Run until completion", then as long as there is only one branch in the flowgraph, this block will cause the flowgraph execution to finish when N samples are reached.
When branching, may block others branches: samples are not consumed and fill upstream buffers.
Parameters
- Num Items
- Number of samples to copy
- Vec Length
- Size of the input and output vector
Example Flowgraph
In this setup, both Time sinks will stop after the Head has reach the specified number of items. The Upstream time sink may see more items than the downstream one, depending on the size of the buffer between the source and the head.
Source Files
- C++ Files
- Header files
- Public header files
- Block definition