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