GNU Radio 3.6.5 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 instrumentation_blk
00045  * \ingroup qtgui_blk
00046  *
00047  * \details
00048  * This is a QT-based graphical sink the takes set of a float streams
00049  * and plots them in the time domain. Each signal is plotted with a
00050  * different color, and the \a set_title and \a set_color functions
00051  * can be used to change the lable and color for a given input number.
00052  */
00053 class GR_QTGUI_API qtgui_time_sink_f : public gr_sync_block
00054 {
00055 private:
00056   friend GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
00057                                                        const std::string &name,
00058                                                        int nconnections,
00059                                                        QWidget *parent);
00060   qtgui_time_sink_f(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_f();
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_F_H */