GNU Radio 3.6.3 C++ API
gr_message_debug.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2005,2012 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 <
gr_core_api.h
>
27
#include <
gr_block.h
>
28
#include <
gr_message.h
>
29
#include <
gr_msg_queue.h
>
30
#include <
gruel/thread.h
>
31
32
class
gr_message_debug;
33
typedef
boost::shared_ptr<gr_message_debug>
gr_message_debug_sptr
;
34
35
GR_CORE_API
gr_message_debug_sptr
gr_make_message_debug();
36
37
/*!
38
* \brief Print received messages to stdout
39
* \ingroup sink_blk
40
*/
41
class
GR_CORE_API
gr_message_debug :
public
gr_block
42
{
43
private
:
44
friend
GR_CORE_API
gr_message_debug_sptr
45
gr_make_message_debug();
46
47
/*!
48
* \brief Messages received in this port are printed to stdout.
49
*
50
* This port receives messages from the scheduler's message handling
51
* mechanism and prints it to stdout. This message handler function
52
* is only meant to be used by the scheduler to handle messages
53
* posted to port 'print'.
54
*
55
* \param msg A pmt message passed from the scheduler's message handling.
56
*/
57
void
print(
pmt::pmt_t
msg);
58
void
print_verbose(
pmt::pmt_t
msg);
59
60
/*!
61
* \brief Messages received in this port are stored in a vector.
62
*
63
* This port receives messages from the scheduler's message handling
64
* mechanism and stores it in a vector. Messages can be retrieved
65
* later using the 'get_message' function. This message handler
66
* function is only meant to be used by the scheduler to handle
67
* messages posted to port 'store'.
68
*
69
* \param msg A pmt message passed from the scheduler's message handling.
70
*/
71
void
store(
pmt::pmt_t
msg);
72
73
gruel::mutex
d_mutex;
74
std::vector<pmt::pmt_t> d_messages;
75
76
protected
:
77
gr_message_debug ();
78
79
public
:
80
~gr_message_debug ();
81
82
/*!
83
* \brief Reports the number of messages received by this block.
84
*/
85
int
num_messages();
86
87
/*!
88
* \brief Get a message (as a PMT) from the message vector at index \p i.
89
*
90
* Messages passed to the 'store' port will be stored in a
91
* vector. This function retrieves those messages by index. They are
92
* index in order of when they were received (all messages are just
93
* pushed onto the back of a vector). This is mostly useful in
94
* debugging message passing graphs and in QA code.
95
*
96
* \param i The index in the vector for the message to retrieve.
97
*
98
* \return a message at index \p i as a pmt_t.
99
*/
100
pmt::pmt_t
get_message(
int
i);
101
};
102
103
#endif
/* INCLUDED_GR_MESSAGE_DEBUG_H */
gnuradio
gnuradio-core
src
lib
io
gr_message_debug.h
Generated by
1.8.1.1