GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
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 <boost/shared_array.hpp>
18 #include <memory>
19 
20 namespace gr {
21 namespace fec {
22 
23 /*!
24  * \brief General FEC decoding block that takes in a decoder
25  * variable object (derived from gr::fec::general_decoder) for use
26  * in a flowgraph.
27  *
28  * \ingroup error_coding_blk
29  *
30  * \details
31  * This block uses a decoder variable object (derived from
32  * gr::fec::generic_decoder) to decode data within a
33  * flowgraph. This block interacts with the general FECAPI
34  * architecture to handle all passing all input and output data in
35  * a flowgraph. The decoder variable takes care of understanding
36  * the requirements, data types and sizes, and boundary conditions
37  * of the specific FEC decoding algorithm.
38  *
39  * Generally, this block is used within the fec.extended_decoder
40  * Python block to handle some input/output formatting issues. In
41  * the FECAPI, the decoder variable sets properties like the input
42  * and output types and sizes and whether the output is packed or
43  * unpacked bytes. The fec.extended_decoder uses this information
44  * to set up an gr::hier_block2 structure to make sure the I/O to
45  * the variable is handled consistently, such as to make sure all
46  * inputs are floats with one soft symbol per item and the outputs
47  * are unpacked bytes with the bit in the LSB.
48  *
49  * See gr::fec::generic_decoder for detail on what information an
50  * FECAPI variable object can set if using this block directly and
51  * not as part of the fec.extended_decoder.
52  */
54 {
55 public:
56  typedef std::shared_ptr<tagged_decoder> sptr;
57  typedef boost::shared_array<unsigned char> buf_sptr;
58 
59  /*!
60  * Create the FEC decoder block by taking in the FECAPI decoder
61  * object as well as input and output sizes.
62  *
63  * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder).
64  * \param input_item_size The size of the input items (often the my_decoder object can
65  * tell us this). \param output_item_size The size of the output items (often the
66  * my_decoder object can tell us this). \param lengthtagname Key name of the tagged
67  * stream frame size. \param mtu The Maximum Transmission Unit (MTU) of the output
68  * frame that the block will be able to
69  * process. Specified in bytes and defaults to 1500.
70  */
71  static sptr make(generic_decoder::sptr my_decoder,
72  size_t input_item_size,
73  size_t output_item_size,
74  const std::string& lengthtagname = "packet_len",
75  int mtu = 1500);
76 
77  int work(int noutput_items,
78  gr_vector_int& ninput_items,
79  gr_vector_const_void_star& input_items,
80  gr_vector_void_star& output_items) override = 0;
81  int calculate_output_stream_length(const gr_vector_int& ninput_items) override = 0;
82 };
83 
84 } /* namespace fec */
85 } /* namespace gr */
86 
87 #endif /* INCLUDED_FEC_TAGGED_DECODER_H */
std::shared_ptr< generic_decoder > sptr
Definition: generic_decoder.h:63
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_dec...
Definition: tagged_decoder.h:54
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:56
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 for log4cpp library (C++ port of log4j)
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