Loading...
Searching...
No Matches
tags.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_GR_TAGS_H
#define INCLUDED_GR_TAGS_H
#include <gnuradio/api.h>
#include <pmt/pmt.h>
namespace gr {
struct GR_RUNTIME_API tag_t {
//! the item \p tag occurred at (as a uint64_t)
uint64_t offset;
//! the key of \p tag (as a PMT symbol)
pmt::pmt_t key;
//! the value of \p tag (as a PMT)
pmt::pmt_t value;
//! the source ID of \p tag (as a PMT)
pmt::pmt_t srcid;
//! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually
//! ignore this.
std::vector<long> marked_deleted;
//! Comparison function to test which tag, \p x or \p y, came first in time
friend inline bool operator<(const tag_t& x, const tag_t& y)
{
return x.offset < y.offset;
}
//! Comparison function to test which tag, \p x or \p y, came first in time
static inline bool offset_compare(const tag_t& x, const tag_t& y) { return x < y; }
//! equality comparison. Compares all details, except marked_delete
inline bool operator==(const tag_t& t) const
{
return (t.key == key) && (t.value == value) && (t.srcid == srcid) &&
(t.offset == offset);
}
tag_t()
: offset(0),
key(pmt::PMT_NIL),
value(pmt::PMT_NIL),
srcid(pmt::PMT_F) // consistent with default srcid value in block::add_item_tag
{
}
//! Copy constructor; constructs identical tag, but doesn't copy marked_delete
tag_t(const tag_t& rhs)
: offset(rhs.offset), key(rhs.key), value(rhs.value), srcid(rhs.srcid)
{
}
tag_t& operator=(const tag_t& rhs)
{
if (this != &rhs) {
offset = rhs.offset;
key = rhs.key;
value = rhs.value;
srcid = rhs.srcid;
}
return (*this);
}
~tag_t() {}
};
} /* namespace gr */
#endif /*INCLUDED_GR_TAGS_H*/
api.h
GR_RUNTIME_API
#define GR_RUNTIME_API
Definition gnuradio-runtime/include/gnuradio/api.h:18
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
pmt
Definition pmt.h:38
pmt::pmt_t
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition pmt.h:83
pmt.h
PMT_F
#define PMT_F
Definition pmt.h:123
PMT_NIL
#define PMT_NIL
Definition pmt.h:121
gr::tag_t::operator=
tag_t & operator=(const tag_t &rhs)
Definition tags.h:64
gr::tag_t::marked_deleted
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
gr::tag_t::offset_compare
static bool offset_compare(const tag_t &x, const tag_t &y)
Comparison function to test which tag, x or y, came first in time.
Definition tags.h:42
gr::tag_t::operator<
friend bool operator<(const tag_t &x, const tag_t &y)
Comparison function to test which tag, x or y, came first in time.
Definition tags.h:37
gr::tag_t::tag_t
tag_t()
Definition tags.h:51
gr::tag_t::~tag_t
~tag_t()
Definition tags.h:75
gr::tag_t::offset
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition tags.h:21
gr::tag_t::tag_t
tag_t(const tag_t &rhs)
Copy constructor; constructs identical tag, but doesn't copy marked_delete.
Definition tags.h:60
gr::tag_t::srcid
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition tags.h:30
gr::tag_t::operator==
bool operator==(const tag_t &t) const
equality comparison. Compares all details, except marked_delete
Definition tags.h:45
gr::tag_t::value
pmt::pmt_t value
the value of tag (as a PMT)
Definition tags.h:27
gr::tag_t::key
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition tags.h:24