GNU Radio Manual and C++ API Reference  3.7.13.4
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  * 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_REGENERATE_BB_H
24 #define INCLUDED_GR_REGENERATE_BB_H
25 
26 #include <gnuradio/blocks/api.h>
27 #include <gnuradio/sync_block.h>
28 
29 namespace gr {
30  namespace blocks {
31 
32  /*!
33  * \brief Detect the peak of a signal and repeat every period samples
34  * \ingroup stream_operators_blk
35  *
36  * \details
37  * If a peak is detected, this block outputs a 1 repeated every
38  * period samples until reset by detection of another 1 on the
39  * input or stopped after max_regen regenerations have occurred.
40  *
41  * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
42  * will run forever.
43  */
44  class BLOCKS_API regenerate_bb : virtual public sync_block
45  {
46  public:
47  // gr::blocks::regenerate_bb::sptr
48  typedef boost::shared_ptr<regenerate_bb> sptr;
49 
50  /*!
51  * \brief Make a regenerate block
52  * \param period The number of samples between regenerations
53  * \param max_regen The maximum number of regenerations to
54  * perform; if set to ULONG_MAX, it will regenerate
55  * continuously.
56  */
57  static sptr make(int period, unsigned int max_regen=500);
58 
59  /*! \brief Reset the maximum regeneration count; this will reset
60  the current regen.
61  */
62  virtual void set_max_regen(unsigned int regen) = 0;
63 
64  /*! \brief Reset the period of regenerations; this will reset
65  the current regen.
66  */
67  virtual void set_period(int period) = 0;
68 
69  /*! \brief return the maximum regeneration count.
70  */
71  virtual unsigned int max_regen() const = 0;
72 
73  /*! \brief return the regeneration period.
74  */
75  virtual int period() const = 0;
76  };
77 
78  } /* namespace blocks */
79 } /* namespace gr */
80 
81 #endif /* INCLUDED_GR_REGENERATE_BB_H */
Include this header to use the message passing features.
Definition: logger.h:695
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< regenerate_bb > sptr
Definition: regenerate_bb.h:48
Detect the peak of a signal and repeat every period samples.
Definition: regenerate_bb.h:44