GNU Radio 3.6.4.1 C++ API
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 <blocks/api.h>
27 #include <gr_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 level_blk
35  *
36  * If a peak is detected, this block outputs a 1 repeated every
37  * period samples until reset by detection of another 1 on the
38  * input or stopped after max_regen regenerations have occurred.
39  *
40  * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
41  * will run forever.
42  */
43  class BLOCKS_API regenerate_bb : virtual public gr_sync_block
44  {
45  public:
46  // gr::blocks::regenerate_bb::sptr
48 
49  /*!
50  * \brief Make a regenerate block
51  * \param period The number of samples between regenerations
52  * \param max_regen The maximum number of regenerations to
53  * perform; if set to ULONG_MAX, it will regenerate
54  * continuously.
55  */
56  static sptr make(int period, unsigned int max_regen=500);
57 
58  /*! \brief Reset the maximum regeneration count; this will reset
59  the current regen.
60  */
61  virtual void set_max_regen(unsigned int regen) = 0;
62 
63  /*! \brief Reset the period of regenerations; this will reset
64  the current regen.
65  */
66  virtual void set_period(int period) = 0;
67 
68  /*! \brief return the maximum regeneration count.
69  */
70  virtual unsigned int max_regen() const = 0;
71 
72  /*! \brief return the regeneration period.
73  */
74  virtual int period() const = 0;
75  };
76 
77  } /* namespace blocks */
78 } /* namespace gr */
79 
80 #endif /* INCLUDED_GR_REGENERATE_BB_H */