GNU Radio 3.6.5 C++ API

gr_probe_density_b.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008 Free Software Foundation, Inc.
00004  *
00005  * GNU Radio is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 3, or (at your option)
00008  * any later version.
00009  *
00010  * GNU Radio is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with GNU Radio; see the file COPYING.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 #ifndef INCLUDED_GR_PROBE_DENSITY_B_H
00021 #define INCLUDED_GR_PROBE_DENSITY_B_H
00022 
00023 #include <gr_core_api.h>
00024 #include <gr_sync_block.h>
00025 
00026 class gr_probe_density_b;
00027 
00028 typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr;
00029 
00030 GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
00031 
00032 /*!
00033  * This block maintains a running average of the input stream and
00034  * makes it available as an accessor function.  The input stream
00035  * is type unsigned char.
00036  *
00037  * If you send this block a stream of unpacked bytes, it will tell
00038  * you what the bit density is.
00039  *
00040  * \param alpha     Average filter constant
00041  *
00042  */
00043 
00044 class GR_CORE_API gr_probe_density_b : public gr_sync_block
00045 {
00046 private:
00047   friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
00048 
00049   double d_alpha;
00050   double d_beta;
00051   double d_density;
00052 
00053   gr_probe_density_b(double alpha);
00054 
00055 public:
00056   ~gr_probe_density_b();
00057 
00058   /*!
00059    * \brief Returns the current density value
00060    */
00061   double density() const { return d_density; }
00062 
00063   /*!
00064    * \brief Set the average filter constant
00065    */
00066   void set_alpha(double alpha);
00067 
00068   int work(int noutput_items,
00069            gr_vector_const_void_star &input_items,
00070            gr_vector_void_star &output_items);
00071 };
00072 
00073 #endif /* INCLUDED_GR_PROBE_DENSITY_B_H */