GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
test_tag_variable_rate_ff.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2015 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_GR_TEST_TAG_VARIABLE_RATE_FF_H
24#define INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H
25
26#include <gnuradio/block.h>
27#include <gnuradio/blocks/api.h>
28
29namespace gr {
30namespace blocks {
31
32/*!
33 * \brief Used for testing tag propagation.
34 * \ingroup measurement_tools_blk
35 * \ingroup stream_tag_tools_blk
36 * \ingroup debug_tools_blk
37 *
38 * This block resamples the stream by a factor that starts at 0.5
39 * but varies around by some random walk. The relative rate of the
40 * block is initialized to 0.5 and the random number generator is
41 * seeded based on the time. For each input, if the random number
42 * is >= 0.5, the relative rate is increased by \p update_step;
43 * otherwise, it is decreased by \p update_step.
44 *
45 * The rate of the change of the resampling factor is set by the
46 * flag \p update_once. If this is set to true, then the rate is
47 * only updated once per work function. If it is set to false
48 * (default), then the rate is changed with every input sample.
49 *
50 * The block's ctor sets the propagation policy to TPP_DONT to
51 * stop tags from automatically propagating. Instead, we handle
52 * the tag propagation ourselves from within the work
53 * function. Because the relative_rate changes so fast, the tag
54 * placement cannot be based on a single factor after the call to
55 * work and must be handled when the samples are and based on the
56 * current resampling rate.
57 */
59{
60public:
61 // gr::blocks::test_tag_variable_rate_ff::sptr
62 typedef boost::shared_ptr<test_tag_variable_rate_ff> sptr;
63
64 /*!
65 * Build a test_tag_variable_rate_ff block.
66 *
67 * \param update_once Update the resampling rate once per call
68 * to work (default=false).
69 * \param update_step How much to adjust the resampling rate by
70 * when the update occurs (default=0.001).
71 */
72 static sptr make(bool update_once = false, double update_step = 0.001);
73};
74
75} /* namespace blocks */
76} /* namespace gr */
77
78#endif /* INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H */
The abstract base class for all 'terminal' processing blocks.
Definition: block.h:66
Used for testing tag propagation.
Definition: test_tag_variable_rate_ff.h:59
static sptr make(bool update_once=false, double update_step=0.001)
boost::shared_ptr< test_tag_variable_rate_ff > sptr
Definition: test_tag_variable_rate_ff.h:62
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
Include this header to use the message passing features.
Definition: basic_block.h:45