GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2006,2013 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef INCLUDED_GR_BIN_STATISTICS_F_IMPL_H 00024 #define INCLUDED_GR_BIN_STATISTICS_F_IMPL_H 00025 00026 #include <blocks/bin_statistics_f.h> 00027 #include <gr_feval.h> 00028 #include <gr_message.h> 00029 #include <gr_msg_queue.h> 00030 00031 namespace gr { 00032 namespace blocks { 00033 00034 class bin_statistics_f_impl : public bin_statistics_f 00035 { 00036 private: 00037 enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY }; 00038 00039 size_t d_vlen; 00040 gr_msg_queue_sptr d_msgq; 00041 gr_feval_dd *d_tune; 00042 size_t d_tune_delay; 00043 size_t d_dwell_delay; 00044 double d_center_freq; 00045 00046 state_t d_state; 00047 size_t d_delay; // nsamples remaining to state transition 00048 00049 void enter_init(); 00050 void enter_tune_delay(); 00051 void enter_dwell_delay(); 00052 void leave_dwell_delay(); 00053 00054 protected: 00055 std::vector<float> d_max; // per bin maxima 00056 00057 size_t vlen() const { return d_vlen; } 00058 double center_freq() const { return d_center_freq; } 00059 gr_msg_queue_sptr msgq() const { return d_msgq; } 00060 00061 virtual void reset_stats(); 00062 virtual void accrue_stats(const float *input); 00063 virtual void send_stats(); 00064 00065 public: 00066 bin_statistics_f_impl(unsigned int vlen, 00067 gr_msg_queue_sptr msgq, 00068 gr_feval_dd *tune, 00069 size_t tune_delay, 00070 size_t dwell_delay); 00071 ~bin_statistics_f_impl(); 00072 00073 int work(int noutput_items, 00074 gr_vector_const_void_star &input_items, 00075 gr_vector_void_star &output_items); 00076 00077 }; 00078 00079 } /* namespace blocks */ 00080 } /* namespace gr */ 00081 00082 #endif /* INCLUDED_GR_BIN_STATISTICS_F_IMPL_H */