GNU Radio 3.6.5.1 C++ API
bin_statistics_f_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_GR_BIN_STATISTICS_F_IMPL_H
24 #define INCLUDED_GR_BIN_STATISTICS_F_IMPL_H
25 
27 #include <gr_feval.h>
28 #include <gr_message.h>
29 #include <gr_msg_queue.h>
30 
31 namespace gr {
32  namespace blocks {
33 
35  {
36  private:
37  enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY };
38 
39  size_t d_vlen;
40  gr_msg_queue_sptr d_msgq;
41  gr_feval_dd *d_tune;
42  size_t d_tune_delay;
43  size_t d_dwell_delay;
44  double d_center_freq;
45 
46  state_t d_state;
47  size_t d_delay; // nsamples remaining to state transition
48 
49  void enter_init();
50  void enter_tune_delay();
51  void enter_dwell_delay();
52  void leave_dwell_delay();
53 
54  protected:
55  std::vector<float> d_max; // per bin maxima
56 
57  size_t vlen() const { return d_vlen; }
58  double center_freq() const { return d_center_freq; }
59  gr_msg_queue_sptr msgq() const { return d_msgq; }
60 
61  virtual void reset_stats();
62  virtual void accrue_stats(const float *input);
63  virtual void send_stats();
64 
65  public:
66  bin_statistics_f_impl(unsigned int vlen,
68  gr_feval_dd *tune,
69  size_t tune_delay,
70  size_t dwell_delay);
72 
73  int work(int noutput_items,
74  gr_vector_const_void_star &input_items,
75  gr_vector_void_star &output_items);
76 
77  };
78 
79  } /* namespace blocks */
80 } /* namespace gr */
81 
82 #endif /* INCLUDED_GR_BIN_STATISTICS_F_IMPL_H */