GNU Radio's CDMA Package
chopper.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2013 Achilleas Anastasopoulos, Zhe Feng.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21
22#ifndef INCLUDED_CDMA_CHOPPER_H
23#define INCLUDED_CDMA_CHOPPER_H
24
25#include <cdma/api.h>
26#include <gnuradio/block.h>
27
28namespace gr {
29 namespace cdma {
30
31 /*!
32 * \brief Chop the input data stream according to the flags in the input control stream.
33 * \ingroup cdma
34 *
35 * \details
36 * When flag is detected in the control stream, the chopper start to chop.
37 * The chopper outputs a copy of length_out items from the input stream to the output stream per chop.\n
38 * The chopper consumes length_in items from the input and control streams.\n
39 * Typically the flags are periodic and length_out>=length_in. Therefore, there exist three cases.\n
40 * Case 1: period <= length_in <= length_out \n
41 * For example, with length_in=4, length_out=5, period=3, the input and output streams will look like \n
42 * input:----->abcdefghijklmn...\n
43 * flags:----->10010010010010... (period=3)\n
44 * outputs:-->abcdeghijkmn...\n
45 * \n
46 * Case 2: length_in <= period <= length_out \n
47 * For example, with length_in=4, length_out=6, period=5, the input and output streams will look like \n
48 * input:----->abcdefghijklmn...\n
49 * flags:----->100001000010000... (period=5)\n
50 * outputs:-->abcdeffghijkklmnop...\n
51 * \n
52 * Case 3: length_in <=length_out <= period \n
53 * For example, with length_in=4, length_out=6, period=7, the input and output streams will look like \n
54 * input:----->abcdefghijklmnopqrst...\n
55 * flags:----->100000010000001000000...(periold=7) \n
56 * outputs:-->abcdefhijklmonqrst...\n
57 *
58 */
59 class CDMA_API chopper : virtual public gr::block
60 {
61 public:
62 typedef boost::shared_ptr<chopper> sptr;
63
64 /*!
65 * \brief Return a shared_ptr to a new instance of cdma::chopper.
66 *
67 * To avoid accidental use of raw pointers, cdma::chopper's
68 * constructor is in a private implementation
69 * class. cdma::chopper::make is the public interface for
70 * creating new instances.
71 *
72 * \param vector_length size of input item in data stream
73 * \param length_in number of items chopper consumes per chop.
74 * \param length_out number of items chopper outputs per chop. Typically length out>=length in.
75 */
76
77 static sptr make(int length_out, int length_in, size_t vector_length);
78 };
79
80 } // namespace cdma
81} // namespace gr
82
83#endif /* INCLUDED_CDMA_CHOPPER_H */
84
#define CDMA_API
Definition: api.h:30
Chop the input data stream according to the flags in the input control stream.
Definition: chopper.h:60
static sptr make(int length_out, int length_in, size_t vector_length)
Return a shared_ptr to a new instance of cdma::chopper.
boost::shared_ptr< chopper > sptr
Definition: chopper.h:62
Definition: amp_var_est.h:30