GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
tag_debug.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 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_TAG_DEBUG_H
24#define INCLUDED_GR_TAG_DEBUG_H
25
26#include <gnuradio/blocks/api.h>
27#include <gnuradio/sync_block.h>
28
29namespace gr {
30namespace blocks {
31
32/*!
33 * \brief Bit bucket that prints out any tag received.
34 * \ingroup measurement_tools_blk
35 * \ingroup stream_tag_tools_blk
36 * \ingroup debug_tools_blk
37 *
38 * \details
39 * This block collects all tags sent to it on all input ports and
40 * displays them to stdout in a formatted way. The \p name
41 * parameter is used to identify which debug sink generated the
42 * tag, so when connecting a block to this debug sink, an
43 * appropriate name is something that identifies the input block.
44 *
45 * This block otherwise acts as a NULL sink in that items from the
46 * input stream are ignored. It is designed to be able to attach
47 * to any block and watch all tags streaming out of that block for
48 * debugging purposes.
49 *
50 * Specifying a key will allow this block to filter out all other
51 * tags and only display tags that match the given key. This can
52 * help clean up the output and allow you to focus in on a
53 * particular tag of interest.
54 *
55 * The tags from the last call to this work function are stored
56 * and can be retrieved using the function 'current_tags'.
57 */
58class BLOCKS_API tag_debug : virtual public sync_block
59{
60public:
61 // gr::blocks::tag_debug::sptr
62 typedef boost::shared_ptr<tag_debug> sptr;
63
64 /*!
65 * Build a tag debug block
66 *
67 * \param sizeof_stream_item size of the items in the incoming stream.
68 * \param name name to identify which debug sink generated the info.
69 * \param key_filter Specify a tag's key value to use as a filter.
70 */
71 static sptr make(size_t sizeof_stream_item,
72 const std::string& name,
73 const std::string& key_filter = "");
74
75 /*!
76 * \brief Returns a vector of tag_t items as of the last call to
77 * work.
78 */
79 virtual std::vector<tag_t> current_tags() = 0;
80
81 /*!
82 * \brief Return the total number of tags in the tag queue.
83 */
84 virtual int num_tags() = 0;
85
86 /*!
87 * \brief Set the display of tags to stdout on/off.
88 */
89 virtual void set_display(bool d) = 0;
90
91 /*!
92 * \brief Set a new key to filter with.
93 */
94 virtual void set_key_filter(const std::string& key_filter) = 0;
95
96 /*!
97 * \brief Get the current filter key.
98 */
99 virtual std::string key_filter() const = 0;
100};
101
102} /* namespace blocks */
103} /* namespace gr */
104
105#endif /* INCLUDED_GR_TAG_DEBUG_H */
Bit bucket that prints out any tag received.
Definition tag_debug.h:59
static sptr make(size_t sizeof_stream_item, const std::string &name, const std::string &key_filter="")
virtual void set_key_filter(const std::string &key_filter)=0
Set a new key to filter with.
virtual void set_display(bool d)=0
Set the display of tags to stdout on/off.
boost::shared_ptr< tag_debug > sptr
Definition tag_debug.h:62
virtual std::vector< tag_t > current_tags()=0
Returns a vector of tag_t items as of the last call to work.
virtual int num_tags()=0
Return the total number of tags in the tag queue.
virtual std::string key_filter() const =0
Get the current filter key.
synchronous 1:1 input to output with history
Definition sync_block.h:38
#define BLOCKS_API
Definition gr-blocks/include/gnuradio/blocks/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46