GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
message_debug.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2005,2012-2013 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_GR_MESSAGE_DEBUG_H
12#define INCLUDED_GR_MESSAGE_DEBUG_H
13
14#include <gnuradio/block.h>
15#include <gnuradio/blocks/api.h>
16
17namespace gr {
18namespace blocks {
19
20/*!
21 * \brief Debug block for the message passing system.
22 * \ingroup message_tools_blk
23 * \ingroup measurement_tools_blk
24 * \ingroup debug_tools_blk
25 *
26 * \details
27 * The message debug block is used to capture and print or store
28 * messages as they are received. Any block that generates a
29 * message may connect that message port to one or more of the
30 * two message input ports of this debug block. The message
31 * ports are:
32 *
33 * \li print: prints the message directly to standard out.
34 * \li store: stores the message in an internal vector. May be
35 * access using the get_message function.
36 * \li print_pdu: DEPRECATED! use print() for all printing
37 */
38class BLOCKS_API message_debug : virtual public block
39{
40public:
41 // gr::blocks::message_debug::sptr
42 typedef std::shared_ptr<message_debug> sptr;
43
44 /*!
45 * \brief Build the message debug block. It takes a single parameter that can be used
46 * to disable PDU vector printing and has two message ports: print and store.
47 *
48 * \param en_uvec Enable PDU Vector Printing.
49 */
50 static sptr make(bool en_uvec = true);
51
52 /*!
53 * \brief Reports the number of messages received by this block.
54 */
55 virtual size_t num_messages() = 0;
56
57 /*!
58 * \brief Get a message (as a PMT) from the message vector at index \p i.
59 *
60 * Messages passed to the 'store' port will be stored in a
61 * vector. This function retrieves those messages by index. They
62 * are index in order of when they were received (all messages
63 * are just pushed onto the back of a vector). This is mostly
64 * useful in debugging message passing graphs and in QA code.
65 *
66 * \param i The index in the vector for the message to retrieve.
67 *
68 * \return a message at index \p i as a pmt_t.
69 */
70 virtual pmt::pmt_t get_message(size_t i) = 0;
71
72 /*!
73 * \brief Enables or disables printing of PDU uniform vector data.
74 */
75 virtual void set_vector_print(bool en) = 0;
76};
77
78} /* namespace blocks */
79} /* namespace gr */
80
81#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Debug block for the message passing system.
Definition: message_debug.h:39
std::shared_ptr< message_debug > sptr
Definition: message_debug.h:42
static sptr make(bool en_uvec=true)
Build the message debug block. It takes a single parameter that can be used to disable PDU vector pri...
virtual pmt::pmt_t get_message(size_t i)=0
Get a message (as a PMT) from the message vector at index i.
virtual size_t num_messages()=0
Reports the number of messages received by this block.
virtual void set_vector_print(bool en)=0
Enables or disables printing of PDU uniform vector data.
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83