summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authorTom Rondeau2010-11-21 19:40:35 -0500
committerTom Rondeau2010-11-21 19:40:35 -0500
commit8f2b07591c404c78c9fc7b9532d3fb6c27165981 (patch)
tree02d51d3734e3f1221a887250886d79ea1e5bbadd /gnuradio-core/src/lib/runtime
parenta9777449322e6784f4e67c47d8300cef8d87dbc6 (diff)
downloadgnuradio-8f2b07591c404c78c9fc7b9532d3fb6c27165981.tar.gz
gnuradio-8f2b07591c404c78c9fc7b9532d3fb6c27165981.tar.bz2
gnuradio-8f2b07591c404c78c9fc7b9532d3fb6c27165981.zip
Tagging file source takes in sample rate and uses it to find the last time tag and adjust the time between these tags and the burst start by the sample rate.
Also added a function to gr_tag_info that can be used to sort tags based on nitems using std::sort.
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h
index 0ba699a0e..5ed30a815 100644
--- a/gnuradio-core/src/lib/runtime/gr_tag_info.h
+++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h
@@ -40,26 +40,46 @@ namespace gr_tags {
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 */