GNU Radio 3.6.5 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 * \ingroup measurement_tools_blk 00035 * 00036 * This block maintains a running average of the input stream and 00037 * makes it available as an accessor function. The input stream 00038 * is type unsigned char. 00039 * 00040 * If you send this block a stream of unpacked bytes, it will tell 00041 * you what the bit density is. 00042 * 00043 * \param alpha Average filter constant 00044 * 00045 */ 00046 00047 class DIGITAL_API digital_probe_density_b : public gr_sync_block 00048 { 00049 private: 00050 friend DIGITAL_API digital_probe_density_b_sptr 00051 digital_make_probe_density_b(double alpha); 00052 00053 double d_alpha; 00054 double d_beta; 00055 double d_density; 00056 00057 digital_probe_density_b(double alpha); 00058 00059 public: 00060 ~digital_probe_density_b(); 00061 00062 /*! 00063 * \brief Returns the current density value 00064 */ 00065 double density() const { return d_density; } 00066 00067 /*! 00068 * \brief Set the average filter constant 00069 */ 00070 void set_alpha(double alpha); 00071 00072 int work(int noutput_items, 00073 gr_vector_const_void_star &input_items, 00074 gr_vector_void_star &output_items); 00075 }; 00076 00077 #endif /* INCLUDED_GR_PROBE_DENSITY_B_H */