GNU Radio Manual and C++ API Reference 3.10.3.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
number_sink.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_QTGUI_NUMBER_SINK_H
12#define INCLUDED_QTGUI_NUMBER_SINK_H
13
14#ifdef ENABLE_PYTHON
15#pragma push_macro("slots")
16#undef slots
17#include "Python.h"
18#pragma pop_macro("slots")
19#endif
20
21#include <gnuradio/qtgui/api.h>
24#include <gnuradio/sync_block.h>
25#include <qapplication.h>
26
27namespace gr {
28namespace qtgui {
29
30/*!
31 * \brief A graphical sink to display numerical values of input streams.
32 * \ingroup instrumentation_blk
33 * \ingroup qtgui_blk
34 *
35 * \details
36 *
37 * Displays the data stream in as a number in a simple text box
38 * GUI along with an optional bar graph. The bar graph can be set
39 * to horizontal (NUM_GRAPH_HORIZ), vertical (NUM_GRAPH_VERT), or
40 * no graph (NUM_GRAPH_NONE).
41 *
42 * The displayed value can be the average of the input stream, in
43 * which case all items received are averaged. If not averaging,
44 * the display simply samples a value in the data stream based on
45 * the update time of this block.
46 *
47 * Note that due to a flaw in the implementation, this block
48 * cannot receive integer value inputs. It will take chars,
49 * shorts, and floats and properly convert them by setting
50 * itemsize of the constructor to one of these three values
51 * (sizeof_char, sizeof_short, and sizeof_float, respectively). If
52 * using integers, the block treats these as floats. Instead, put
53 * the integer input stream through an gr::blocks::int_to_float
54 * converter block.
55 */
56class QTGUI_API number_sink : virtual public sync_block
57{
58public:
59 // gr::qtgui::number_sink::sptr
60 typedef std::shared_ptr<number_sink> sptr;
61
62 /*!
63 * \brief Build a number sink
64 *
65 * \param itemsize Size of input item stream
66 * \param average Averaging coefficient (0 - 1)
67 * \param graph_type Type of graph to use (number_sink::graph_t)
68 * \param nconnections number of signals connected to sink
69 * \param parent a QWidget parent object, if any
70 */
71 static sptr make(size_t itemsize,
72 float average = 0,
73 graph_t graph_type = NUM_GRAPH_HORIZ,
74 int nconnections = 1,
75 QWidget* parent = NULL);
76
77 virtual void exec_() = 0;
78 virtual QWidget* qwidget() = 0;
79
80 virtual void set_update_time(double t) = 0;
81 virtual void set_average(const float avg) = 0;
82 virtual void set_graph_type(const graph_t type) = 0;
83 virtual void
84 set_color(unsigned int which, const std::string& min, const std::string& max) = 0;
85 virtual void set_color(unsigned int which, int min, int max) = 0;
86 virtual void set_label(unsigned int which, const std::string& label) = 0;
87 virtual void set_min(unsigned int which, float min) = 0;
88 virtual void set_max(unsigned int which, float max) = 0;
89 virtual void set_title(const std::string& title) = 0;
90 virtual void set_unit(unsigned int which, const std::string& unit) = 0;
91 virtual void set_factor(unsigned int which, float factor) = 0;
92
93 virtual float average() const = 0;
94 virtual graph_t graph_type() const = 0;
95 virtual std::string color_min(unsigned int which) const = 0;
96 virtual std::string color_max(unsigned int which) const = 0;
97 virtual std::string label(unsigned int which) const = 0;
98 virtual float min(unsigned int which) const = 0;
99 virtual float max(unsigned int which) const = 0;
100 virtual std::string title() const = 0;
101 virtual std::string unit(unsigned int which) const = 0;
102 virtual float factor(unsigned int which) const = 0;
103
104 virtual void enable_menu(bool en = true) = 0;
105 virtual void enable_autoscale(bool en = true) = 0;
106
107 virtual void reset() = 0;
108
109 QApplication* d_qApplication;
110};
111
112} /* namespace qtgui */
113} /* namespace gr */
114
115#endif /* INCLUDED_QTGUI_NUMBER_SINK_H */
A graphical sink to display numerical values of input streams.
Definition: number_sink.h:57
virtual float min(unsigned int which) const =0
virtual void set_color(unsigned int which, int min, int max)=0
static sptr make(size_t itemsize, float average=0, graph_t graph_type=NUM_GRAPH_HORIZ, int nconnections=1, QWidget *parent=NULL)
Build a number sink.
virtual void set_color(unsigned int which, const std::string &min, const std::string &max)=0
virtual float average() const =0
virtual std::string title() const =0
virtual std::string color_min(unsigned int which) const =0
virtual void set_min(unsigned int which, float min)=0
virtual void enable_menu(bool en=true)=0
virtual void reset()=0
virtual void set_graph_type(const graph_t type)=0
virtual void set_label(unsigned int which, const std::string &label)=0
QApplication * d_qApplication
Definition: number_sink.h:109
virtual void set_max(unsigned int which, float max)=0
virtual std::string unit(unsigned int which) const =0
virtual float max(unsigned int which) const =0
virtual std::string label(unsigned int which) const =0
virtual void set_unit(unsigned int which, const std::string &unit)=0
virtual void set_title(const std::string &title)=0
virtual void set_average(const float avg)=0
std::shared_ptr< number_sink > sptr
Definition: number_sink.h:60
virtual float factor(unsigned int which) const =0
virtual void set_factor(unsigned int which, float factor)=0
virtual std::string color_max(unsigned int which) const =0
virtual void enable_autoscale(bool en=true)=0
virtual void set_update_time(double t)=0
virtual QWidget * qwidget()=0
virtual void exec_()=0
virtual graph_t graph_type() const =0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18
graph_t
Definition: qtgui_types.h:119
GNU Radio logging wrapper.
Definition: basic_block.h:29