GNU Radio Manual and C++ API Reference  3.9.0.0
The Free & Open Software Radio Ecosystem
tags.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2011,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_TAGS_H
12 #define INCLUDED_GR_TAGS_H
13 
14 #include <gnuradio/api.h>
15 #include <pmt/pmt.h>
16 
17 namespace gr {
18 
20  //! the item \p tag occurred at (as a uint64_t)
21  uint64_t offset;
22 
23  //! the key of \p tag (as a PMT symbol)
25 
26  //! the value of \p tag (as a PMT)
28 
29  //! the source ID of \p tag (as a PMT)
31 
32  //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually
33  //! ignore this.
34  std::vector<long> marked_deleted;
35 
36  /*!
37  * Comparison function to test which tag, \p x or \p y, came
38  * first in time
39  */
40  static inline bool offset_compare(const tag_t& x, const tag_t& y)
41  {
42  return x.offset < y.offset;
43  }
44 
45  inline bool operator==(const tag_t& t) const
46  {
47  return (t.key == key) && (t.value == value) && (t.srcid == srcid) &&
48  (t.offset == offset);
49  }
50 
52  : offset(0),
53  key(pmt::PMT_NIL),
54  value(pmt::PMT_NIL),
55  srcid(pmt::PMT_F) // consistent with default srcid value in block::add_item_tag
56  {
57  }
58 
59  tag_t(const tag_t& rhs)
60  : offset(rhs.offset), key(rhs.key), value(rhs.value), srcid(rhs.srcid)
61  {
62  }
63  tag_t& operator=(const tag_t& rhs)
64  {
65  if (this != &rhs) {
66  offset = rhs.offset;
67  key = rhs.key;
68  value = rhs.value;
69  srcid = rhs.srcid;
70  }
71  return (*this);
72  }
73 
74  ~tag_t() {}
75 };
76 
77 } /* namespace gr */
78 
79 #endif /*INCLUDED_GR_TAGS_H*/
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29
Definition: pmt.h:39
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition: pmt.h:85
#define PMT_F
Definition: pmt.h:125
#define PMT_NIL
Definition: pmt.h:123
Definition: tags.h:19
std::vector< long > marked_deleted
Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this.
Definition: tags.h:34
static bool offset_compare(const tag_t &x, const tag_t &y)
Definition: tags.h:40
tag_t()
Definition: tags.h:51
~tag_t()
Definition: tags.h:74
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition: tags.h:21
tag_t(const tag_t &rhs)
Definition: tags.h:59
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition: tags.h:30
bool operator==(const tag_t &t) const
Definition: tags.h:45
pmt::pmt_t value
the value of tag (as a PMT)
Definition: tags.h:27
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition: tags.h:24
tag_t & operator=(const tag_t &rhs)
Definition: tags.h:63