GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
regenerate_bb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2013 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_REGENERATE_BB_H
12 #define INCLUDED_GR_REGENERATE_BB_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Detect the peak of a signal and repeat every period samples
22  * \ingroup stream_operators_blk
23  *
24  * \details
25  * If a peak is detected, this block outputs a 1 repeated every
26  * period samples until reset by detection of another 1 on the
27  * input or stopped after max_regen regenerations have occurred.
28  *
29  * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
30  * will run forever.
31  */
32 class BLOCKS_API regenerate_bb : virtual public sync_block
33 {
34 public:
35  // gr::blocks::regenerate_bb::sptr
36  typedef std::shared_ptr<regenerate_bb> sptr;
37 
38  /*!
39  * \brief Make a regenerate block
40  * \param period The number of samples between regenerations
41  * \param max_regen The maximum number of regenerations to
42  * perform; if set to ULONG_MAX, it will regenerate
43  * continuously.
44  */
45  static sptr make(int period, unsigned int max_regen = 500);
46 
47  /*! \brief Reset the maximum regeneration count; this will reset
48  the current regen.
49  */
50  virtual void set_max_regen(unsigned int regen) = 0;
51 
52  /*! \brief Reset the period of regenerations; this will reset
53  the current regen.
54  */
55  virtual void set_period(int period) = 0;
56 
57  /*! \brief return the maximum regeneration count.
58  */
59  virtual unsigned int max_regen() const = 0;
60 
61  /*! \brief return the regeneration period.
62  */
63  virtual int period() const = 0;
64 };
65 
66 } /* namespace blocks */
67 } /* namespace gr */
68 
69 #endif /* INCLUDED_GR_REGENERATE_BB_H */
Detect the peak of a signal and repeat every period samples.
Definition: regenerate_bb.h:33
static sptr make(int period, unsigned int max_regen=500)
Make a regenerate block.
virtual unsigned int max_regen() const =0
return the maximum regeneration count.
virtual int period() const =0
return the regeneration period.
virtual void set_period(int period)=0
Reset the period of regenerations; this will reset the current regen.
std::shared_ptr< regenerate_bb > sptr
Definition: regenerate_bb.h:36
virtual void set_max_regen(unsigned int regen)=0
Reset the maximum regeneration count; this will reset the current regen.
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29