GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
tagged_decoder.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_FEC_TAGGED_DECODER_H
12 #define INCLUDED_FEC_TAGGED_DECODER_H
13 
14 #include <gnuradio/fec/api.h>
17 #include <memory>
18 
19 namespace gr {
20 namespace fec {
21 
22 /*!
23  * \brief General FEC decoding block that takes in a decoder
24  * variable object (derived from gr::fec::general_decoder) for use
25  * in a flowgraph.
26  *
27  * \ingroup error_coding_blk
28  *
29  * \details
30  * This block uses a decoder variable object (derived from
31  * gr::fec::generic_decoder) to decode data within a
32  * flowgraph. This block interacts with the general FECAPI
33  * architecture to handle all passing all input and output data in
34  * a flowgraph. The decoder variable takes care of understanding
35  * the requirements, data types and sizes, and boundary conditions
36  * of the specific FEC decoding algorithm.
37  *
38  * Generally, this block is used within the fec.extended_decoder
39  * Python block to handle some input/output formatting issues. In
40  * the FECAPI, the decoder variable sets properties like the input
41  * and output types and sizes and whether the output is packed or
42  * unpacked bytes. The fec.extended_decoder uses this information
43  * to set up an gr::hier_block2 structure to make sure the I/O to
44  * the variable is handled consistently, such as to make sure all
45  * inputs are floats with one soft symbol per item and the outputs
46  * are unpacked bytes with the bit in the LSB.
47  *
48  * See gr::fec::generic_decoder for detail on what information an
49  * FECAPI variable object can set if using this block directly and
50  * not as part of the fec.extended_decoder.
51  */
53 {
54 public:
55  typedef std::shared_ptr<tagged_decoder> sptr;
56 
57  /*!
58  * Create the FEC decoder block by taking in the FECAPI decoder
59  * object as well as input and output sizes.
60  *
61  * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder).
62  * \param input_item_size The size of the input items (often the my_decoder object can
63  * tell us this). \param output_item_size The size of the output items (often the
64  * my_decoder object can tell us this). \param lengthtagname Key name of the tagged
65  * stream frame size. \param mtu The Maximum Transmission Unit (MTU) of the output
66  * frame that the block will be able to
67  * process. Specified in bytes and defaults to 1500.
68  */
69  static sptr make(generic_decoder::sptr my_decoder,
70  size_t input_item_size,
71  size_t output_item_size,
72  const std::string& lengthtagname = "packet_len",
73  int mtu = 1500);
74 
75  int work(int noutput_items,
76  gr_vector_int& ninput_items,
77  gr_vector_const_void_star& input_items,
78  gr_vector_void_star& output_items) override = 0;
79  int calculate_output_stream_length(const gr_vector_int& ninput_items) override = 0;
80 };
81 
82 } /* namespace fec */
83 } /* namespace gr */
84 
85 #endif /* INCLUDED_FEC_TAGGED_DECODER_H */
std::shared_ptr< generic_decoder > sptr
Definition: generic_decoder.h:62
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_dec...
Definition: tagged_decoder.h:53
int calculate_output_stream_length(const gr_vector_int &ninput_items) override=0
Calculate the number of output items.
static sptr make(generic_decoder::sptr my_decoder, size_t input_item_size, size_t output_item_size, const std::string &lengthtagname="packet_len", int mtu=1500)
std::shared_ptr< tagged_decoder > sptr
Definition: tagged_decoder.h:55
int work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override=0
Just like gr::block::general_work, but makes sure the input is valid.
Block that operates on PDUs in form of tagged streams.
Definition: tagged_stream_block.h:26
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
std::vector< void * > gr_vector_void_star
Definition: types.h:27
std::vector< int > gr_vector_int
Definition: types.h:23