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