summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gnuradio/block.hpp31
-rw-r--r--include/gnuradio/gr_block.h20
-rw-r--r--include/gnuradio/gr_tags.h23
-rw-r--r--include/gnuradio/tags.hpp35
4 files changed, 69 insertions, 40 deletions
diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp
index 23274b1..bcce34a 100644
--- a/include/gnuradio/block.hpp
+++ b/include/gnuradio/block.hpp
@@ -22,6 +22,7 @@
#include <gnuradio/tags.hpp>
#include <vector>
#include <string>
+#include <boost/range.hpp> //iterator range
namespace gnuradio
{
@@ -214,32 +215,14 @@ struct GRAS_API Block : Element
void set_tag_propagation_policy(tag_propagation_policy_t p);
- void add_item_tag(
- const size_t which_output, const Tag &tag
- );
-
- void add_item_tag(
- const size_t which_output,
- uint64_t abs_offset,
- const pmt::pmt_t &key,
- const pmt::pmt_t &value,
- const pmt::pmt_t &srcid=pmt::PMT_F
- );
+ //! Send a tag to the downstream on the given output port
+ void post_output_tag(const size_t which_output, const Tag &tag);
- void get_tags_in_range(
- std::vector<Tag> &tags,
- const size_t which_input,
- uint64_t abs_start,
- uint64_t abs_end
- );
+ //! Iterator return type get_input_tags - stl and boost compliant
+ typedef boost::iterator_range<std::vector<Tag>::const_iterator> TagIter;
- void get_tags_in_range(
- std::vector<Tag> &tags,
- const size_t which_input,
- uint64_t abs_start,
- uint64_t abs_end,
- const pmt::pmt_t &key
- );
+ //! Get an iterator of item tags for the given input
+ TagIter get_input_tags(const size_t which_input = 0);
/*******************************************************************
* Work related routines from basic block
diff --git a/include/gnuradio/gr_block.h b/include/gnuradio/gr_block.h
index 7328dd1..8e0c40e 100644
--- a/include/gnuradio/gr_block.h
+++ b/include/gnuradio/gr_block.h
@@ -80,6 +80,26 @@ struct GRAS_API gr_block : gnuradio::Block
gr_vector_void_star &output_items
);
+ void add_item_tag(
+ const size_t which_output, const gr_tag_t &tag
+ );
+
+ void add_item_tag(
+ const size_t which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid=pmt::PMT_F
+ );
+
+ void get_tags_in_range(
+ std::vector<gr_tag_t> &tags,
+ const size_t which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key = pmt::pmt_t()
+ );
+
unsigned history(void) const;
void set_history(unsigned history);
diff --git a/include/gnuradio/gr_tags.h b/include/gnuradio/gr_tags.h
index e4c9508..cb268da 100644
--- a/include/gnuradio/gr_tags.h
+++ b/include/gnuradio/gr_tags.h
@@ -19,6 +19,27 @@
#include <gnuradio/tags.hpp>
-typedef gnuradio::Tag gr_tag_t;
+struct GRAS_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::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;
+
+ //! 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/include/gnuradio/tags.hpp b/include/gnuradio/tags.hpp
index d8414d8..c8eafba 100644
--- a/include/gnuradio/tags.hpp
+++ b/include/gnuradio/tags.hpp
@@ -18,34 +18,39 @@
#define INCLUDED_GNURADIO_TAGS_HPP
#include <gnuradio/gras.hpp>
+#include <boost/operators.hpp>
+
+//TODO -- this is a stub for the PMC libray
#include <gruel/pmt.h>
+typedef pmt::pmt_t PMC;
+typedef pmt::pmt_t PMCC;
namespace gnuradio
{
-struct GRAS_API Tag
+struct GRAS_API Tag : boost::less_than_comparable<Tag>
{
+ //! Make an empty tag with null members
+ Tag(void);
- //! the item \p tag occurred at (as a uint64_t)
- uint64_t offset;
+ //! Make a tag from parameters to initialize the members
+ Tag(const uint64_t &offset, const PMCC &key, const PMCC &value, const PMCC &srcid = PMCC());
- //! the key of \p tag (as a PMT symbol)
- pmt::pmt_t key;
+ //! the absolute item count associated with this tag
+ uint64_t offset;
- //! the value of \p tag (as a PMT)
- pmt::pmt_t value;
+ //! A symbolic name identifying the type of tag
+ PMCC key;
- //! the source ID of \p tag (as a PMT)
- pmt::pmt_t srcid;
+ //! The value of this tag -> the sample metadata
+ PMCC value;
- //! Comparison function to test which tag, \p x or \p y, came first in time
- static inline bool offset_compare(
- const Tag &x, const Tag &y
- ){
- return x.offset < y.offset;
- }
+ //! The optional source ID -> something unique
+ PMCC srcid;
};
+GRAS_API bool operator<(const Tag &lhs, const Tag &rhs);
+
} //namespace gnuradio
#endif /*INCLUDED_GNURADIO_TAGS_HPP*/