GNU Radio 3.7.3 C++ API
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_GR_MESSAGE_DEBUG_H
24 #define INCLUDED_GR_MESSAGE_DEBUG_H
25 
26 #include <gnuradio/blocks/api.h>
27 #include <gnuradio/block.h>
28 
29 namespace gr {
30  namespace blocks {
31 
32  /*!
33  * \brief Debug block for the message passing system.
34  * \ingroup message_tools_blk
35  * \ingroup measurement_tools_blk
36  * \ingroup debug_tools_blk
37  *
38  * \details
39  * The message debug block is used to capture and print or store
40  * messages as they are received. Any block that generates a
41  * message may connect that message port to one or more of the
42  * three message input ports of this debug block. The message
43  * ports are:
44  *
45  * \li print: prints the message directly to standard out.
46  * \li store: stores the message in an internal vector. May be
47  * access using the get_message function.
48  * \li print_pdu: specifically designed to handle formatted PDUs
49  * (see pdu.h).
50  */
51  class BLOCKS_API message_debug : virtual public block
52  {
53  public:
54  // gr::blocks::message_debug::sptr
56 
57  /*!
58  * \brief Build the message debug block. It takes no parameters
59  * and has three message ports: print, store, and
60  * print_pdu.
61  */
62  static sptr make();
63 
64  /*!
65  * \brief Reports the number of messages received by this block.
66  */
67  virtual int num_messages() = 0;
68 
69  /*!
70  * \brief Get a message (as a PMT) from the message vector at index \p i.
71  *
72  * Messages passed to the 'store' port will be stored in a
73  * vector. This function retrieves those messages by index. They
74  * are index in order of when they were received (all messages
75  * are just pushed onto the back of a vector). This is mostly
76  * useful in debugging message passing graphs and in QA code.
77  *
78  * \param i The index in the vector for the message to retrieve.
79  *
80  * \return a message at index \p i as a pmt_t.
81  */
82  virtual pmt::pmt_t get_message(int i) = 0;
83  };
84 
85  } /* namespace blocks */
86 } /* namespace gr */
87 
88 #endif /* INCLUDED_GR_MESSAGE_DEBUG_H */
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:56
Debug block for the message passing system.
Definition: message_debug.h:51
The abstract base class for all 'terminal' processing blocks.A signal processing flow is constructed ...
Definition: block.h:60
boost::shared_ptr< message_debug > sptr
Definition: message_debug.h:55