GNU Radio Manual and C++ API Reference  3.7.13.4
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_FEC_TAGGED_DECODER_H
24 #define INCLUDED_FEC_TAGGED_DECODER_H
25 
26 #include <gnuradio/fec/api.h>
29 #include <boost/shared_ptr.hpp>
30 #include <boost/shared_array.hpp>
31 
32 namespace gr {
33  namespace fec {
34 
35  /*!
36  * \brief General FEC decoding block that takes in a decoder
37  * variable object (derived from gr::fec::general_decoder) for use
38  * in a flowgraph.
39  *
40  * \ingroup error_coding_blk
41  *
42  * \details
43  * This block uses a decoder variable object (derived from
44  * gr::fec::generic_decoder) to decode data within a
45  * flowgraph. This block interacts with the general FECAPI
46  * architecture to handle all passing all input and output data in
47  * a flowgraph. The decoder variable takes care of understanding
48  * the requirements, data types and sizes, and boundary conditions
49  * of the specific FEC decoding algorithm.
50  *
51  * Generally, this block is used within the fec.extended_decoder
52  * Python block to handle some input/output formatting issues. In
53  * the FECAPI, the decoder variable sets properties like the input
54  * and output types and sizes and whether the output is packed or
55  * unpacked bytes. The fec.extended_decoder uses this information
56  * to set up an gr::hier_block2 structure to make sure the I/O to
57  * the variable is handled consistently, such as to make sure all
58  * inputs are floats with one soft symbol per item and the outputs
59  * are unpacked bytes with the bit in the LSB.
60  *
61  * See gr::fec::generic_decoder for detail on what information an
62  * FECAPI variable object can set if using this block directly and
63  * not as part of the fec.extended_decoder.
64  */
66  {
67  public:
68  typedef boost::shared_ptr<tagged_decoder> sptr;
69  typedef boost::shared_array<unsigned char> buf_sptr;
70 
71  /*!
72  * Create the FEC decoder block by taking in the FECAPI decoder
73  * object as well as input and output sizes.
74  *
75  * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder).
76  * \param input_item_size The size of the input items (often the my_decoder object can tell us this).
77  * \param output_item_size The size of the output items (often the my_decoder object can tell us this).
78  * \param lengthtagname Key name of the tagged stream frame size.
79  * \param mtu The Maximum Transmission Unit (MTU) of the output
80  * frame that the block will be able to
81  * process. Specified in bytes and defaults to 1500.
82  */
83  static sptr make(generic_decoder::sptr my_decoder,
84  size_t input_item_size,
85  size_t output_item_size,
86  const std::string &lengthtagname="packet_len",
87  int mtu=1500);
88 
89  virtual int work(int noutput_items,
90  gr_vector_int& ninput_items,
91  gr_vector_const_void_star &input_items,
92  gr_vector_void_star &output_items) = 0;
93  virtual int calculate_output_stream_length(const gr_vector_int &ninput_items) = 0;
94  };
95 
96  } /* namespace fec */
97 } /* namespace gr */
98 
99 #endif /* INCLUDED_FEC_TAGGED_DECODER_H */
Block that operates on PDUs in form of tagged streamsOverride work to provide the signal processing i...
Definition: tagged_stream_block.h:37
std::vector< const void * > gr_vector_const_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:40
std::vector< void * > gr_vector_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:39
std::vector< int > gr_vector_int
Definition: gnuradio-runtime/include/gnuradio/types.h:35
Include this header to use the message passing features.
Definition: logger.h:695
boost::shared_ptr< tagged_decoder > sptr
Definition: tagged_decoder.h:68
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_dec...
Definition: tagged_decoder.h:65
boost::shared_ptr< generic_decoder > sptr
Definition: generic_decoder.h:75