GNU Radio 3.3.0 C++ API
|
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_sync_block.h> 00024 00025 class gr_probe_density_b; 00026 00027 typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr; 00028 00029 gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); 00030 00031 /*! 00032 * This block maintains a running average of the input stream and 00033 * makes it available as an accessor function. The input stream 00034 * is type unsigned char. 00035 * 00036 * If you send this block a stream of unpacked bytes, it will tell 00037 * you what the bit density is. 00038 * 00039 * \param alpha Average filter constant 00040 * 00041 */ 00042 00043 class gr_probe_density_b : public gr_sync_block 00044 { 00045 private: 00046 friend gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); 00047 00048 double d_alpha; 00049 double d_beta; 00050 double d_density; 00051 00052 gr_probe_density_b(double alpha); 00053 00054 public: 00055 ~gr_probe_density_b(); 00056 00057 /*! 00058 * \brief Returns the current density value 00059 */ 00060 double density() const { return d_density; } 00061 00062 /*! 00063 * \brief Set the average filter constant 00064 */ 00065 void set_alpha(double alpha); 00066 00067 int work(int noutput_items, 00068 gr_vector_const_void_star &input_items, 00069 gr_vector_void_star &output_items); 00070 }; 00071 00072 #endif /* INCLUDED_GR_PROBE_DENSITY_B_H */