GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
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
29namespace gr {
30
32 //! the item \p tag occurred at (as a uint64_t)
33 uint64_t offset;
34
35 //! the key of \p tag (as a PMT symbol)
37
38 //! the value of \p tag (as a PMT)
40
41 //! the source ID of \p tag (as a PMT)
43
44 //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually
45 //! 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, const tag_t& y)
53 {
54 return x.offset < y.offset;
55 }
56
57 inline bool operator==(const tag_t& t) const
58 {
59 return (t.key == key) && (t.value == value) && (t.srcid == srcid) &&
60 (t.offset == offset);
61 }
62
64 : offset(0),
65 key(pmt::PMT_NIL),
66 value(pmt::PMT_NIL),
67 srcid(pmt::PMT_F) // consistent with default srcid value in block::add_item_tag
68 {
69 }
70
71 tag_t(const tag_t& rhs)
72 : offset(rhs.offset), key(rhs.key), value(rhs.value), srcid(rhs.srcid)
73 {
74 }
75 tag_t& operator=(const tag_t& rhs)
76 {
77 if (this != &rhs) {
78 offset = rhs.offset;
79 key = rhs.key;
80 value = rhs.value;
81 srcid = rhs.srcid;
82 }
83 return (*this);
84 }
85
86 ~tag_t() {}
87};
88
89} /* namespace gr */
90
91#endif /*INCLUDED_GR_TAGS_H*/
#define GR_RUNTIME_API
Definition gnuradio-runtime/include/gnuradio/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
Definition pmt.h:51
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition pmt.h:96
#define PMT_F
Definition pmt.h:136
#define PMT_NIL
Definition pmt.h:134
Definition tags.h:31
tag_t & operator=(const tag_t &rhs)
Definition tags.h:75
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
static bool offset_compare(const tag_t &x, const tag_t &y)
Definition tags.h:52
tag_t()
Definition tags.h:63
~tag_t()
Definition tags.h:86
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition tags.h:33
tag_t(const tag_t &rhs)
Definition tags.h:71
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition tags.h:42
bool operator==(const tag_t &t) const
Definition tags.h:57
pmt::pmt_t value
the value of tag (as a PMT)
Definition tags.h:39
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition tags.h:36