GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
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 
17 namespace gr {
18 namespace 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  * three 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: specifically designed to handle formatted PDUs
37  * (see pdu.h).
38  */
39 class BLOCKS_API message_debug : virtual public block
40 {
41 public:
42  // gr::blocks::message_debug::sptr
43  typedef std::shared_ptr<message_debug> sptr;
44 
45  /*!
46  * \brief Build the message debug block. It takes no parameters
47  * and has three message ports: print, store, and
48  * print_pdu.
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 int 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(int 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:60
Debug block for the message passing system.
Definition: message_debug.h:40
std::shared_ptr< message_debug > sptr
Definition: message_debug.h:43
static sptr make(bool en_uvec=true)
Build the message debug block. It takes no parameters and has three message ports: print,...
virtual pmt::pmt_t get_message(int i)=0
Get a message (as a PMT) from the message vector at index i.
virtual void set_vector_print(bool en)=0
Enables or disables printing of PDU uniform vector data.
virtual int num_messages()=0
Reports the number of messages received by this block.
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:84