GNU Radio C++ API
gr_probe_density_b.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 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 <gr_core_api.h>
24 #include <gr_sync_block.h>
25 
26 class gr_probe_density_b;
27 
29 
31 
32 /*!
33  * This block maintains a running average of the input stream and
34  * makes it available as an accessor function. The input stream
35  * is type unsigned char.
36  *
37  * If you send this block a stream of unpacked bytes, it will tell
38  * you what the bit density is.
39  *
40  * \param alpha Average filter constant
41  *
42  */
43 
45 {
46 private:
48 
49  double d_alpha;
50  double d_beta;
51  double d_density;
52 
53  gr_probe_density_b(double alpha);
54 
55 public:
57 
58  /*!
59  * \brief Returns the current density value
60  */
61  double density() const { return d_density; }
62 
63  /*!
64  * \brief Set the average filter constant
65  */
66  void set_alpha(double alpha);
67 
68  int work(int noutput_items,
69  gr_vector_const_void_star &input_items,
70  gr_vector_void_star &output_items);
71 };
72 
73 #endif /* INCLUDED_GR_PROBE_DENSITY_B_H */