GNU Radio 3.5.3.2 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_sync_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 /*!
00043  * \brief A graphical sink to display multiple signals in time.
00044  * \ingroup qtgui_blk
00045  *
00046  * This is a QT-based graphical sink the takes set of a complex
00047  * streams and plots them in the time domain. For each signal, both
00048  * the signal's I and Q parts are plotted, and they are all plotted
00049  * with a different color, and the \a set_title and \a set_color
00050  * functions can be used to change the lable and color for a given
00051  * input number.
00052  */
00053 class GR_QTGUI_API qtgui_time_sink_c : public gr_sync_block
00054 {
00055 private:
00056   friend GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
00057                                                                     const std::string &name,
00058                                                                     int nconnections,
00059                                                                     QWidget *parent);
00060   qtgui_time_sink_c(int size, double bw,
00061                     const std::string &name,
00062                     int nconnections,
00063                     QWidget *parent=NULL);
00064   
00065   void initialize();
00066 
00067   int d_size;
00068   double d_bandwidth;
00069   std::string d_name;
00070   int d_nconnections;
00071 
00072   int d_index;
00073   std::vector<double*> d_residbufs;
00074 
00075   double d_update_time;
00076 
00077   QWidget *d_parent;
00078   TimeDisplayForm *d_main_gui;
00079 
00080   gruel::high_res_timer_type d_current_time;
00081   gruel::high_res_timer_type d_last_time;
00082 
00083 public:
00084   ~qtgui_time_sink_c();
00085   void exec_();
00086   QWidget*  qwidget();
00087   PyObject* pyqwidget();
00088 
00089   void set_time_domain_axis(double min, double max);
00090   void set_update_time(double t);
00091   void set_title(int which, const std::string &title);
00092   void set_color(int which, const std::string &color);
00093 
00094   QApplication *d_qApplication;
00095 
00096   int work (int noutput_items,
00097             gr_vector_const_void_star &input_items,
00098             gr_vector_void_star &output_items);
00099 };
00100 
00101 #endif /* INCLUDED_QTGUI_TIME_SINK_C_H */