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