GNU Radio 3.5.1 C++ API
qtgui_time_sink_f.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_F_H
00024 #define INCLUDED_QTGUI_TIME_SINK_F_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_f;
00035 typedef boost::shared_ptr<qtgui_time_sink_f> qtgui_time_sink_f_sptr;
00036 
00037 GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(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 float streams
00047  * and plots them in the time domain. Each signal is plotted with a
00048  * different color, and the \a set_title and \a set_color functions
00049  * can be used to change the lable and color for a given input number.
00050  */
00051 class GR_QTGUI_API qtgui_time_sink_f : public gr_sync_block
00052 {
00053 private:
00054   friend GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
00055                                                        const std::string &name,
00056                                                        int nconnections,
00057                                                        QWidget *parent);
00058   qtgui_time_sink_f(int size, double bw,
00059                     const std::string &name,
00060                     int nconnections,
00061                     QWidget *parent=NULL);
00062   
00063   void initialize();
00064 
00065   int d_size;
00066   double d_bandwidth;
00067   std::string d_name;
00068   int d_nconnections;
00069 
00070   int d_index;
00071   std::vector<double*> d_residbufs;
00072 
00073   double d_update_time;
00074 
00075   QWidget *d_parent;
00076   TimeDisplayForm *d_main_gui;
00077 
00078   gruel::high_res_timer_type d_current_time;
00079   gruel::high_res_timer_type d_last_time;
00080 
00081 public:
00082   ~qtgui_time_sink_f();
00083   void exec_();
00084   QWidget*  qwidget();
00085   PyObject* pyqwidget();
00086 
00087   void set_time_domain_axis(double min, double max);
00088   void set_update_time(double t);
00089   void set_title(int which, const std::string &title);
00090   void set_color(int which, const std::string &color);
00091 
00092   QApplication *d_qApplication;
00093 
00094   int work (int noutput_items,
00095             gr_vector_const_void_star &input_items,
00096             gr_vector_void_star &output_items);
00097 };
00098 
00099 #endif /* INCLUDED_QTGUI_TIME_SINK_F_H */