GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H
12 #define INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/blocks/api.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Used for testing tag propagation.
22  * \ingroup measurement_tools_blk
23  * \ingroup stream_tag_tools_blk
24  * \ingroup debug_tools_blk
25  *
26  * This block resamples the stream by a factor that starts at 0.5
27  * but varies around by some random walk. The relative rate of the
28  * block is initialized to 0.5 and the random number generator is
29  * seeded based on the time. For each input, if the random number
30  * is >= 0.5, the relative rate is increased by \p update_step;
31  * otherwise, it is decreased by \p update_step.
32  *
33  * The rate of the change of the resampling factor is set by the
34  * flag \p update_once. If this is set to true, then the rate is
35  * only updated once per work function. If it is set to false
36  * (default), then the rate is changed with every input sample.
37  *
38  * The block's ctor sets the propagation policy to TPP_DONT to
39  * stop tags from automatically propagating. Instead, we handle
40  * the tag propagation ourselves from within the work
41  * function. Because the relative_rate changes so fast, the tag
42  * placement cannot be based on a single factor after the call to
43  * work and must be handled when the samples are and based on the
44  * current resampling rate.
45  */
47 {
48 public:
49  // gr::blocks::test_tag_variable_rate_ff::sptr
50  typedef std::shared_ptr<test_tag_variable_rate_ff> sptr;
51 
52  /*!
53  * Build a test_tag_variable_rate_ff block.
54  *
55  * \param update_once Update the resampling rate once per call
56  * to work (default=false).
57  * \param update_step How much to adjust the resampling rate by
58  * when the update occurs (default=0.001).
59  */
60  static sptr make(bool update_once = false, double update_step = 0.001);
61 };
62 
63 } /* namespace blocks */
64 } /* namespace gr */
65 
66 #endif /* INCLUDED_GR_TEST_TAG_VARIABLE_RATE_FF_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Used for testing tag propagation.
Definition: test_tag_variable_rate_ff.h:47
static sptr make(bool update_once=false, double update_step=0.001)
std::shared_ptr< test_tag_variable_rate_ff > sptr
Definition: test_tag_variable_rate_ff.h:50
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29