GNU Radio 3.6.5.1 C++ API
message_debug_impl.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_IMPL_H
24 #define INCLUDED_GR_MESSAGE_DEBUG_IMPL_H
25 
26 #include <blocks/message_debug.h>
27 #include <gr_block.h>
28 #include <gruel/thread.h>
29 #include <gruel/pmt.h>
30 
31 namespace gr {
32  namespace blocks {
33 
35  {
36  private:
37 
38  /*!
39  * \brief Messages received in this port are printed to stdout.
40  *
41  * This port receives messages from the scheduler's message
42  * handling mechanism and prints it to stdout. This message
43  * handler function is only meant to be used by the scheduler to
44  * handle messages posted to port 'print'.
45  *
46  * \param msg A pmt message passed from the scheduler's message handling.
47  */
48  void print(pmt::pmt_t msg);
49 
50  /*!
51  * \brief PDU formatted messages received in this port are printed to stdout.
52  *
53  * This port receives messages from the scheduler's message
54  * handling mechanism and prints it to stdout. This message
55  * handler function is only meant to be used by the scheduler to
56  * handle messages posted to port 'print'.
57  *
58  * \param pdu A PDU message passed from the scheduler's message handling.
59  */
60  void print_pdu(pmt::pmt_t pdu);
61 
62  /*!
63  * \brief Messages received in this port are stored in a vector.
64  *
65  * This port receives messages from the scheduler's message
66  * handling mechanism and stores it in a vector. Messages can be
67  * retrieved later using the 'get_message' function. This
68  * message handler function is only meant to be used by the
69  * scheduler to handle messages posted to port 'store'.
70  *
71  * \param msg A pmt message passed from the scheduler's message handling.
72  */
73  void store(pmt::pmt_t msg);
74 
75  gruel::mutex d_mutex;
76  std::vector<pmt::pmt_t> d_messages;
77 
78  public:
81 
82  int num_messages();
83  pmt::pmt_t get_message(int i);
84  };
85 
86  } /* namespace blocks */
87 } /* namespace gr */
88 
89 #endif /* INCLUDED_GR_MESSAGE_DEBUG_IMPL_H */