GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
tag_checker.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 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_RUNTIME_TAG_CHECKER_H
12 #define INCLUDED_GR_RUNTIME_TAG_CHECKER_H
13 
14 #include <gnuradio/tags.h>
15 #include <algorithm>
16 #include <vector>
17 
18 namespace gr {
19 
20 /*!
21  * \brief deprecated class that was used to go through unsorted tag vectors
22  * \deprecated tag_checker serves no purpose and will be removed in 3.10
23  */
24 class [[deprecated("tag_checker will be removed in 3.10")]] tag_checker
25 {
26 private:
27  std::vector<tag_t> d_tags;
28  tag_t d_next_tag;
29  bool d_has_next_tag;
30  unsigned int d_next_tag_index;
31 
32 public:
33  tag_checker(std::vector<tag_t> & tags) : d_has_next_tag(false), d_next_tag_index(0)
34  {
35  d_tags = tags;
36  std::sort(d_tags.begin(), d_tags.end());
37  if (!d_tags.empty()) {
38  d_has_next_tag = true;
39  d_next_tag = tags[0];
40  }
41  };
42 
44 
45  void get_tags(std::vector<tag_t> & tag_list, unsigned int offset)
46  {
47  while (d_has_next_tag && (offset >= d_next_tag.offset)) {
48  if (offset == d_next_tag.offset) {
49  tag_list.push_back(d_next_tag);
50  }
51  d_next_tag_index += 1;
52  if (d_next_tag_index >= d_tags.size()) {
53  d_has_next_tag = false;
54  } else {
55  d_next_tag = d_tags[d_next_tag_index];
56  }
57  }
58  };
59 };
60 } // namespace gr
61 
62 #endif /* INCLUDED_GR_RUNTIME_TAG_CHECKER_H */
deprecated class that was used to go through unsorted tag vectors
Definition: tag_checker.h:25
tag_checker(std::vector< tag_t > &tags)
Definition: tag_checker.h:33
void get_tags(std::vector< tag_t > &tag_list, unsigned int offset)
Definition: tag_checker.h:45
~tag_checker()
Definition: tag_checker.h:43
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29
Definition: tags.h:19
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition: tags.h:21