gr-baz Package
digital_probe_density_b.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2012 Free Software Foundation, Inc.
4  *
5  * GNU Radio is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * GNU Radio is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GNU Radio; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 #ifndef INCLUDED_GR_PROBE_DENSITY_B_H
21 #define INCLUDED_GR_PROBE_DENSITY_B_H
22 
23 #include <digital_api.h>
24 #include <gr_sync_block.h>
25 
27 
29 
31 digital_make_probe_density_b(double alpha);
32 
33 /*!
34  * This block maintains a running average of the input stream and
35  * makes it available as an accessor function. The input stream
36  * is type unsigned char.
37  *
38  * If you send this block a stream of unpacked bytes, it will tell
39  * you what the bit density is.
40  *
41  * \param alpha Average filter constant
42  *
43  */
44 
46 {
47 private:
49  digital_make_probe_density_b(double alpha);
50 
51  double d_alpha;
52  double d_beta;
53  double d_density;
54 
55  digital_probe_density_b(double alpha);
56 
57 public:
59 
60  /*!
61  * \brief Returns the current density value
62  */
63  double density() const { return d_density; }
64 
65  /*!
66  * \brief Set the average filter constant
67  */
68  void set_alpha(double alpha);
69 
70  int work(int noutput_items,
71  gr_vector_const_void_star &input_items,
72  gr_vector_void_star &output_items);
73 };
74 
75 #endif /* INCLUDED_GR_PROBE_DENSITY_B_H */