GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * 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_TAGS_H
24 #define INCLUDED_GR_TAGS_H
25 
26 #include <gnuradio/api.h>
27 #include <pmt/pmt.h>
28 
29 namespace gr {
30 
32  {
33  //! the item \p tag occurred at (as a uint64_t)
34  uint64_t offset;
35 
36  //! the key of \p tag (as a PMT symbol)
38 
39  //! the value of \p tag (as a PMT)
41 
42  //! the source ID of \p tag (as a PMT)
44 
45  //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this.
46  std::vector<long> marked_deleted;
47 
48  /*!
49  * Comparison function to test which tag, \p x or \p y, came
50  * first in time
51  */
52  static inline bool offset_compare(const tag_t &x,
53  const tag_t &y)
54  {
55  return x.offset < y.offset;
56  }
57 
58  inline bool operator == (const tag_t &t) const
59  {
60  return (t.key == key) && (t.value == value) && \
61  (t.srcid == srcid) && (t.offset == offset);
62  }
63 
65  : offset(0),
66  key(pmt::PMT_NIL),
67  value(pmt::PMT_NIL),
68  srcid(pmt::PMT_F) // consistent with default srcid value in block::add_item_tag
69  {
70  }
71 
73  {
74  }
75  };
76 
77 } /* namespace gr */
78 
79 #endif /*INCLUDED_GR_TAGS_H*/
pmt::pmt_t value
the value of tag (as a PMT)
Definition: tags.h:40
Definition: tags.h:31
static bool offset_compare(const tag_t &x, const tag_t &y)
Definition: tags.h:52
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition: tags.h:34
#define PMT_F
Definition: pmt.h:105
tag_t()
Definition: tags.h:64
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:30
~tag_t()
Definition: tags.h:72
Include this header to use the message passing features.
Definition: logger.h:131
#define PMT_NIL
Definition: pmt.h:103
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition: tags.h:37
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition: tags.h:43
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:56
Definition: pmt.h:51
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:46