summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/CMakeLists.txt3
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc11
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h25
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.cc28
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.h18
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc25
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.h4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.cc12
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h14
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.cc38
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.h87
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tags.h55
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc28
14 files changed, 135 insertions, 216 deletions
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
index 52cb39c40..e0774154e 100644
--- a/gnuradio-core/src/lib/runtime/CMakeLists.txt
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -64,7 +64,6 @@ list(APPEND gnuradio_core_sources
${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_createfilemapping.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_sysv_shm.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.cc
)
########################################################################
@@ -128,7 +127,7 @@ install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/gr_types.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_unittests.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.h
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_tag_info.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_tags.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio
COMPONENT "core_devel"
)
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index eca92e526..b4a59337e 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -69,7 +69,6 @@ libruntime_la_SOURCES = \
gr_vmcircbuf_createfilemapping.cc \
gr_vmcircbuf_sysv_shm.cc \
gr_select_handler.cc \
- gr_tag_info.cc
libruntime_qa_la_SOURCES = \
qa_gr_block.cc \
@@ -125,7 +124,7 @@ grinclude_HEADERS = \
gr_types.h \
gr_unittests.h \
gr_vmcircbuf.h \
- gr_tag_info.h
+ gr_tags.h
noinst_HEADERS = \
gr_vmcircbuf_mmap_shm_open.h \
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 81a55af9d..9463869f5 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -144,16 +144,13 @@ gr_block::nitems_written(unsigned int which_output)
void
gr_block::add_item_tag(unsigned int which_output,
- uint64_t offset,
- const pmt::pmt_t &key,
- const pmt::pmt_t &value,
- const pmt::pmt_t &srcid)
+ const gr_tag_t &tag)
{
- d_detail->add_item_tag(which_output, offset, key, value, srcid);
+ d_detail->add_item_tag(which_output, tag);
}
void
-gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+gr_block::get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_output,
uint64_t start, uint64_t end)
{
@@ -161,7 +158,7 @@ gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
}
void
-gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+gr_block::get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_output,
uint64_t start, uint64_t end,
const pmt::pmt_t &key)
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index 2453e97b8..86e0583e9 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -25,6 +25,7 @@
#include <gr_core_api.h>
#include <gr_basic_block.h>
+#include <gr_tags.h>
/*!
* \brief The abstract base class for all 'terminal' processing blocks.
@@ -255,11 +256,27 @@ class GR_CORE_API gr_block : public gr_basic_block {
* \param value any PMT holding any value for the given key
* \param srcid optional source ID specifier; defaults to PMT_F
*/
- void add_item_tag(unsigned int which_output,
+ inline void add_item_tag(unsigned int which_output,
uint64_t abs_offset,
const pmt::pmt_t &key,
const pmt::pmt_t &value,
- const pmt::pmt_t &srcid=pmt::PMT_F);
+ const pmt::pmt_t &srcid=pmt::PMT_F)
+ {
+ gr_tag_t tag;
+ tag.offset = abs_offset;
+ tag.key = key;
+ tag.value = value;
+ tag.srcid = srcid;
+ this->add_item_tag(which_output, tag);
+ }
+
+ /*!
+ * \brief Adds a new tag onto the given output buffer.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param tag the tag object to add
+ */
+ void add_item_tag(unsigned int which_output, const gr_tag_t &tag);
/*!
* \brief Given a [start,end), returns a vector of all tags in the range.
@@ -274,7 +291,7 @@ class GR_CORE_API gr_block : public gr_basic_block {
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
*/
- void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end);
@@ -294,7 +311,7 @@ class GR_CORE_API gr_block : public gr_basic_block {
* \param abs_end a uint64 count of the end of the range of interest
* \param key a PMT symbol key to filter only tags of this key
*/
- void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end,
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
index a360240c0..cbd4239f3 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
@@ -150,27 +150,19 @@ gr_block_detail::nitems_written(unsigned int which_output)
}
void
-gr_block_detail::add_item_tag(unsigned int which_output,
- uint64_t abs_offset,
- const pmt_t &key,
- const pmt_t &value,
- const pmt_t &srcid)
-{
- if(!pmt_is_symbol(key)) {
- throw pmt_wrong_type("gr_block_detail::add_item_tag key", key);
+gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag)
+{
+ if(!pmt_is_symbol(tag.key)) {
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key);
}
else {
- // build tag tuple
- pmt_t nitem = pmt_from_uint64(abs_offset);
- pmt_t tuple = pmt_make_tuple(nitem, srcid, key, value);
-
// Add tag to gr_buffer's deque tags
- d_output[which_output]->add_item_tag(tuple);
+ d_output[which_output]->add_item_tag(tag);
}
}
void
-gr_block_detail::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end)
@@ -180,13 +172,13 @@ gr_block_detail::get_tags_in_range(std::vector<pmt::pmt_t> &v,
}
void
-gr_block_detail::get_tags_in_range(std::vector<pmt_t> &v,
+gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end,
const pmt_t &key)
{
- std::vector<pmt_t> found_items;
+ std::vector<gr_tag_t> found_items;
v.resize(0);
@@ -195,9 +187,9 @@ gr_block_detail::get_tags_in_range(std::vector<pmt_t> &v,
// Filter further by key name
pmt_t itemkey;
- std::vector<pmt_t>::iterator itr;
+ std::vector<gr_tag_t>::iterator itr;
for(itr = found_items.begin(); itr != found_items.end(); itr++) {
- itemkey = pmt_tuple_ref(*itr, 2);
+ itemkey = (*itr).key;
if(pmt_eqv(key, itemkey)) {
v.push_back(*itr);
}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h
index 633da1b0c..89081156a 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h
@@ -26,7 +26,7 @@
#include <gr_core_api.h>
#include <gr_runtime_types.h>
#include <gr_tpb_detail.h>
-#include <gr_tag_info.h>
+#include <gr_tags.h>
#include <stdexcept>
/*!
@@ -105,17 +105,9 @@ class GR_CORE_API gr_block_detail {
* which appends the tag onto its deque.
*
* \param which_output an integer of which output stream to attach the tag
- * \param abs_offset a uint64 number of the absolute item number
- * assicated with the tag. Can get from nitems_written.
- * \param key the tag key as a PMT symbol
- * \param value any PMT holding any value for the given key
- * \param srcid a PMT source ID specifier
+ * \param tag the tag object to add
*/
- void add_item_tag(unsigned int which_output,
- uint64_t abs_offset,
- const pmt::pmt_t &key,
- const pmt::pmt_t &value,
- const pmt::pmt_t &srcid);
+ void add_item_tag(unsigned int which_output, const gr_tag_t &tag);
/*!
* \brief Given a [start,end), returns a vector of all tags in the range.
@@ -131,7 +123,7 @@ class GR_CORE_API gr_block_detail {
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
*/
- void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end);
@@ -153,7 +145,7 @@ class GR_CORE_API gr_block_detail {
* \param abs_end a uint64 count of the end of the range of interest
* \param key a PMT symbol to select only tags of this key
*/
- void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end,
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index b3f987f72..737b26f67 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -91,7 +91,7 @@ min_available_space (gr_block_detail *d, int output_multiple)
static bool
propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
const std::vector<uint64_t> &start_nitems_read, double rrate,
- std::vector<pmt::pmt_t> &rtags)
+ std::vector<gr_tag_t> &rtags)
{
// Move tags downstream
// if a sink, we don't need to move downstream
@@ -109,7 +109,7 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
d->get_tags_in_range(rtags, i, start_nitems_read[i],
d->nitems_read(i));
- std::vector<pmt::pmt_t>::iterator t;
+ std::vector<gr_tag_t>::iterator t;
if(rrate == 1.0) {
for(t = rtags.begin(); t != rtags.end(); t++) {
for(int o = 0; o < d->noutputs(); o++)
@@ -118,14 +118,10 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
}
else {
for(t = rtags.begin(); t != rtags.end(); t++) {
- uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
- pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
- pmt::pmt_tuple_ref(*t, 1),
- pmt::pmt_tuple_ref(*t, 2),
- pmt::pmt_tuple_ref(*t, 3));
-
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= rrate;
for(int o = 0; o < d->noutputs(); o++)
- d->output(o)->add_item_tag(newtup);
+ d->output(o)->add_item_tag(new_tag);
}
}
}
@@ -139,14 +135,11 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
d->get_tags_in_range(rtags, i, start_nitems_read[i],
d->nitems_read(i));
- std::vector<pmt::pmt_t>::iterator t;
+ std::vector<gr_tag_t>::iterator t;
for(t = rtags.begin(); t != rtags.end(); t++) {
- uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
- pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
- pmt::pmt_tuple_ref(*t, 1),
- pmt::pmt_tuple_ref(*t, 2),
- pmt::pmt_tuple_ref(*t, 3));
- d->output(i)->add_item_tag(newtup);
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= rrate;
+ d->output(i)->add_item_tag(new_tag);
}
}
}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h
index cd93212e1..15279f273 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h
@@ -26,7 +26,7 @@
#include <gr_core_api.h>
#include <gr_runtime_types.h>
#include <fstream>
-#include <gruel/pmt.h>
+#include <gr_tags.h>
//class gr_block_executor;
//typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr;
@@ -50,7 +50,7 @@ protected:
std::vector<bool> d_input_done;
gr_vector_void_star d_output_items;
std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work
- std::vector<pmt::pmt_t> d_returned_tags;
+ std::vector<gr_tag_t> d_returned_tags;
public:
gr_block_executor(gr_block_sptr block);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc
index fa3722714..8ccc9db32 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.cc
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc
@@ -227,7 +227,7 @@ gr_buffer::drop_reader (gr_buffer_reader *reader)
}
void
-gr_buffer::add_item_tag(const pmt::pmt_t &tag)
+gr_buffer::add_item_tag(const gr_tag_t &tag)
{
gruel::scoped_lock guard(*mutex());
d_item_tags.push_back(tag);
@@ -245,7 +245,7 @@ gr_buffer::prune_tags(uint64_t max_time)
buffer's mutex al la the scoped_lock line below.
*/
//gruel::scoped_lock guard(*mutex());
- std::deque<pmt::pmt_t>::iterator itr = d_item_tags.begin();
+ std::deque<gr_tag_t>::iterator itr = d_item_tags.begin();
uint64_t item_time;
@@ -255,7 +255,7 @@ gr_buffer::prune_tags(uint64_t max_time)
// to find more. Mostly, we wil be erasing from the front and
// therefore lose little time this way.
while(itr != d_item_tags.end()) {
- item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+ item_time = (*itr).offset;
if(item_time < max_time) {
d_item_tags.erase(itr);
itr = d_item_tags.begin();
@@ -307,18 +307,18 @@ gr_buffer_reader::update_read_pointer (int nitems)
}
void
-gr_buffer_reader::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+gr_buffer_reader::get_tags_in_range(std::vector<gr_tag_t> &v,
uint64_t abs_start,
uint64_t abs_end)
{
gruel::scoped_lock guard(*mutex());
v.resize(0);
- std::deque<pmt::pmt_t>::iterator itr = d_buffer->get_tags_begin();
+ std::deque<gr_tag_t>::iterator itr = d_buffer->get_tags_begin();
uint64_t item_time;
while(itr != d_buffer->get_tags_end()) {
- item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+ item_time = (*itr).offset;
if((item_time >= abs_start) && (item_time < abs_end)) {
v.push_back(*itr);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index e7c0a06a5..e8e393756 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -27,7 +27,7 @@
#include <gr_runtime_types.h>
#include <boost/weak_ptr.hpp>
#include <gruel/thread.h>
-#include <gruel/pmt.h>
+#include <gr_tags.h>
#include <deque>
class gr_vmcircbuf;
@@ -97,9 +97,9 @@ class GR_CORE_API gr_buffer {
/*!
* \brief Adds a new tag to the buffer.
*
- * \param tag a PMT tuple containing the new tag
+ * \param tag the new tag
*/
- void add_item_tag(const pmt::pmt_t &tag);
+ void add_item_tag(const gr_tag_t &tag);
/*!
* \brief Removes all tags before \p max_time from buffer
@@ -108,8 +108,8 @@ class GR_CORE_API gr_buffer {
*/
void prune_tags(uint64_t max_time);
- std::deque<pmt::pmt_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
- std::deque<pmt::pmt_t>::iterator get_tags_end() { return d_item_tags.end(); }
+ std::deque<gr_tag_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
+ std::deque<gr_tag_t>::iterator get_tags_end() { return d_item_tags.end(); }
// -------------------------------------------------------------------------
@@ -136,7 +136,7 @@ class GR_CORE_API gr_buffer {
unsigned int d_write_index; // in items [0,d_bufsize)
uint64_t d_abs_write_offset; // num items written since the start
bool d_done;
- std::deque<pmt::pmt_t> d_item_tags;
+ std::deque<gr_tag_t> d_item_tags;
uint64_t d_last_min_items_read;
unsigned
@@ -268,7 +268,7 @@ class GR_CORE_API gr_buffer_reader {
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
*/
- void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
uint64_t abs_start,
uint64_t abs_end);
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc
deleted file mode 100644
index f15329f9b..000000000
--- a/gnuradio-core/src/lib/runtime/gr_tag_info.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gr_tag_info.h>
-#include <gruel/pmt.h>
-
-namespace gr_tags {
-/*
- const pmt::pmt_t key_time = pmt::pmt_string_to_symbol("time");
- const pmt::pmt_t key_sample_rate = pmt::pmt_string_to_symbol("sample_rate");
- const pmt::pmt_t key_frequency = pmt::pmt_string_to_symbol("frequency");
- const pmt::pmt_t key_rssi = pmt::pmt_string_to_symbol("rssi");
- const pmt::pmt_t key_rx_gain = pmt::pmt_string_to_symbol("gain");
-*/
-}
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h
deleted file mode 100644
index 5a1e1555a..000000000
--- a/gnuradio-core/src/lib/runtime/gr_tag_info.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_TAG_INFO_H
-#define INCLUDED_GR_TAG_INFO_H
-
-#include <gruel/pmt.h>
-
-namespace gr_tags {
-
- enum {
- TAG_NITEM_REF = 0,
- TAG_SRCID_REF,
- TAG_KEY_REF,
- TAG_VALUE_REF
- };
-
- /*
- extern const pmt::pmt_t key_time;
- extern const pmt::pmt_t key_sample_rate;
- extern const pmt::pmt_t key_frequency;
- extern const pmt::pmt_t key_rssi;
- extern const pmt::pmt_t key_gain;
- */
-
- /*!
- * \brief Returns the item \p tag occurred at (as a uint64_t)
- */
- static inline uint64_t
- get_nitems(const pmt::pmt_t &tag) {
- return pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tag, TAG_NITEM_REF));
- }
-
- /*!
- * \brief Returns the source ID of \p tag (as a PMT)
- */
- static inline pmt::pmt_t
- get_srcid(const pmt::pmt_t &tag) {
- return pmt::pmt_tuple_ref(tag, TAG_SRCID_REF);
- }
-
- /*!
- * \brief Returns the key of \p tag (as a PMT symbol)
- */
- static inline pmt::pmt_t
- get_key(const pmt::pmt_t &tag) {
- return pmt::pmt_tuple_ref(tag, TAG_KEY_REF);
- }
-
- /*!
- * \brief Returns the value of \p tag (as a PMT)
- */
- static inline pmt::pmt_t
- get_value(const pmt::pmt_t &tag) {
- return pmt::pmt_tuple_ref(tag, TAG_VALUE_REF);
- }
-
- /*!
- * \brief Comparison function to test which tag, \p x or \p y, came first in time
- */
- static inline bool
- nitems_compare(pmt::pmt_t x, pmt::pmt_t y) {
- return get_nitems(x) < get_nitems(y);
- }
-
-}; /* namespace tags */
-
-#endif /* GR_TAG_INFO */
diff --git a/gnuradio-core/src/lib/runtime/gr_tags.h b/gnuradio-core/src/lib/runtime/gr_tags.h
new file mode 100644
index 000000000..e410e76a4
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tags.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TAGS_H
+#define INCLUDED_GR_TAGS_H
+
+#include <gr_core_api.h>
+#include <gruel/pmt.h>
+
+//dummy namespace so the line below makes swig happy
+namespace pmt{}
+//stupid using namespace because pmt::pmt_t confuses swig
+using namespace pmt;
+
+struct GR_CORE_API gr_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_t key;
+
+ //! the value of \p tag (as a PMT)
+ pmt_t value;
+
+ //! the source ID of \p tag (as a PMT)
+ pmt_t srcid;
+
+ //! Comparison function to test which tag, \p x or \p y, came first in time
+ static inline bool offset_compare(
+ const gr_tag_t &x, const gr_tag_t &y
+ ){
+ return x.offset < y.offset;
+ }
+};
+
+#endif /*INCLUDED_GR_TAGS_H*/
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
index 07ce5c276..ab5840c6d 100644
--- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -103,9 +103,9 @@ qa_block_tags::t1 ()
tb->run();
- std::vector<pmt::pmt_t> tags0 = ann0->data();
- std::vector<pmt::pmt_t> tags3 = ann3->data();
- std::vector<pmt::pmt_t> tags4 = ann4->data();
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
// The first annotator does not receive any tags from the null sink upstream
CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
@@ -187,11 +187,11 @@ qa_block_tags::t2 ()
tb->run();
- std::vector<pmt::pmt_t> tags0 = ann0->data();
- std::vector<pmt::pmt_t> tags1 = ann1->data();
- std::vector<pmt::pmt_t> tags2 = ann2->data();
- std::vector<pmt::pmt_t> tags3 = ann4->data();
- std::vector<pmt::pmt_t> tags4 = ann4->data();
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
+ std::vector<gr_tag_t> tags3 = ann4->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
// The first annotator does not receive any tags from the null sink upstream
CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
@@ -287,9 +287,9 @@ qa_block_tags::t3 ()
tb->run();
- std::vector<pmt::pmt_t> tags0 = ann0->data();
- std::vector<pmt::pmt_t> tags3 = ann3->data();
- std::vector<pmt::pmt_t> tags4 = ann4->data();
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
// The first annotator does not receive any tags from the null sink upstream
CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
@@ -394,9 +394,9 @@ qa_block_tags::t5 ()
tb->run();
- std::vector<pmt::pmt_t> tags0 = ann0->data();
- std::vector<pmt::pmt_t> tags1 = ann1->data();
- std::vector<pmt::pmt_t> tags2 = ann2->data();
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
// The first annotator does not receive any tags from the null sink upstream
CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);