GNU Radio 3.4.0 C++ API
qtgui_time_sink_c.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2011 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_QTGUI_TIME_SINK_C_H
00024 #define INCLUDED_QTGUI_TIME_SINK_C_H
00025 
00026 #include <Python.h>
00027 #include <gr_qtgui_api.h>
00028 #include <gr_block.h>
00029 #include <gr_firdes.h>
00030 #include <gri_fft.h>
00031 #include <qapplication.h>
00032 #include <timedisplayform.h>
00033 
00034 class qtgui_time_sink_c;
00035 typedef boost::shared_ptr<qtgui_time_sink_c> qtgui_time_sink_c_sptr;
00036 
00037 GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
00038                                               const std::string &name,
00039                                               int nconnectons=1,
00040                                               QWidget *parent=NULL);
00041 
00042 class GR_QTGUI_API qtgui_time_sink_c : public gr_block
00043 {
00044 private:
00045   friend GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
00046                                                        const std::string &name,
00047                                                        int nconnections,
00048                                                        QWidget *parent);
00049   qtgui_time_sink_c(int size, double bw,
00050                     const std::string &name,
00051                     int nconnections,
00052                     QWidget *parent=NULL);
00053   
00054   void forecast(int noutput_items, gr_vector_int &ninput_items_required);
00055 
00056   void initialize();
00057 
00058   int d_size;
00059   double d_bandwidth;
00060   std::string d_name;
00061   int d_nconnections;
00062 
00063   int d_index;
00064   std::vector<double*> d_residbufs;
00065 
00066   double d_update_time;
00067 
00068   QWidget *d_parent;
00069   TimeDisplayForm *d_main_gui;
00070 
00071   gruel::high_res_timer_type d_current_time;
00072   gruel::high_res_timer_type d_last_time;
00073 
00074 public:
00075   ~qtgui_time_sink_c();
00076   void exec_();
00077   QWidget*  qwidget();
00078   PyObject* pyqwidget();
00079 
00080   void set_time_domain_axis(double min, double max);
00081   void set_update_time(double t);
00082   void set_title(int which, const std::string &title);
00083   void set_color(int which, const std::string &color);
00084 
00085   QApplication *d_qApplication;
00086 
00087   int general_work (int noutput_items,
00088                     gr_vector_int &ninput_items,
00089                     gr_vector_const_void_star &input_items,
00090                     gr_vector_void_star &output_items);
00091 };
00092 
00093 #endif /* INCLUDED_QTGUI_TIME_SINK_C_H */