GNU Radio 3.7.2git-47-g5cfb1151 C++ API
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 
29 namespace gr {
30  namespace 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  * The tags from the last call to this work function are stored
51  * and can be retrieved using the function 'current_tags'.
52  */
53  class BLOCKS_API tag_debug : virtual public sync_block
54  {
55  public:
56  // gr::blocks::tag_debug::sptr
58 
59  /*!
60  * Build a tag debug block
61  *
62  * \param sizeof_stream_item size of the items in the incoming stream.
63  * \param name name to identify which debug sink generated the info.
64  */
65  static sptr make(size_t sizeof_stream_item,
66  const std::string &name);
67 
68  /*!
69  * \brief Returns a vector of tag_t items as of the last call to
70  * work.
71  */
72  virtual std::vector<tag_t> current_tags() = 0;
73 
74  /*!
75  * \brief Return the total number of tags in the tag queue.
76  */
77  virtual int num_tags() = 0;
78 
79  /*!
80  * \brief Set the display of tags to stdout on/off.
81  */
82  virtual void set_display(bool d) = 0;
83  };
84 
85  } /* namespace blocks */
86 } /* namespace gr */
87 
88 #endif /* INCLUDED_GR_TAG_DEBUG_H */