GNU Radio 3.6.5 C++ API
|
Byte-stream CRC block. More...
#include <digital_crc32_bb.h>
Public Member Functions | |
~digital_crc32_bb () | |
int | calculate_output_stream_length (const std::vector< int > &ninput_items) |
Calculate the number of output items. | |
int | work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) |
Just like gr_block::general_work, but makes sure the input is valid. | |
Friends | |
DIGITAL_API digital_crc32_bb_sptr | digital_make_crc32_bb (bool check, const std::string &lengthtagname) |
Byte-stream CRC block.
Input: stream of bytes, which form a packet. The first byte of the packet has a tag with key "length" and the value being the number of bytes in the packet.
Output: The same bytes as incoming, but trailing a CRC32 of the packet. The tag is re-set to the new length.
digital_crc32_bb::~digital_crc32_bb | ( | ) |
int digital_crc32_bb::calculate_output_stream_length | ( | const std::vector< int > & | ninput_items | ) | [virtual] |
Calculate the number of output items.
This is basically the inverse function to forecast(): Given a number of input items, it returns the maximum number of output items.
You most likely need to override this function, unless your block is a sync block or integer interpolator/decimator.
Reimplemented from gr_tagged_stream_block.
int digital_crc32_bb::work | ( | int | noutput_items, |
gr_vector_int & | ninput_items, | ||
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [virtual] |
Just like gr_block::general_work, but makes sure the input is valid.
The user must override work to define the signal processing code. Check the documentation for general_work() to see what happens here.
Like gr_sync_block, this calls consume() for you (it consumes ninput_items[i] items from the i-th port).
A note on tag propagation: The PDU length tags are handled by other functions, but all other tags are handled just as in any other gr_block
. So, most likely, you either set the tag propagation policy to TPP_DONT and handle the tag propagation manually, or you propagate tags through the scheduler and don't do anything here.
noutput_items | The size of the writable output buffer |
ninput_items | The exact size of the items on every input for this particular PDU. These will be consumed if a length tag key is provided! |
input_items | See gr_block |
output_items | See gr_block |
Implements gr_tagged_stream_block.
DIGITAL_API digital_crc32_bb_sptr digital_make_crc32_bb | ( | bool | check, |
const std::string & | lengthtagname | ||
) | [friend] |