summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorTom Rondeau2010-11-11 15:55:04 -0500
committerTom Rondeau2010-11-11 15:55:04 -0500
commit9aaf98cff5e03ec2821da492f3857780a767258f (patch)
tree93a0ae5a39f572a222239aff77892063723d2c7a /gnuradio-core
parentc204913321f0618ac131738088dab23065bdfa80 (diff)
downloadgnuradio-9aaf98cff5e03ec2821da492f3857780a767258f.tar.gz
gnuradio-9aaf98cff5e03ec2821da492f3857780a767258f.tar.bz2
gnuradio-9aaf98cff5e03ec2821da492f3857780a767258f.zip
Renaming random_annotator to annotator_1toall that moves tags from single input to all outputs.
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am11
-rw-r--r--gnuradio-core/src/lib/general/general.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1toall.cc (renamed from gnuradio-core/src/lib/runtime/gr_random_annotator.cc)35
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1toall.h (renamed from gnuradio-core/src/lib/runtime/gr_random_annotator.h)22
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1toall.i (renamed from gnuradio-core/src/lib/runtime/gr_random_annotator.i)8
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am3
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc23
-rw-r--r--gnuradio-core/src/lib/runtime/runtime.i2
8 files changed, 59 insertions, 49 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index 3d8a42805..a58461165 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -175,7 +175,9 @@ libgeneral_la_SOURCES = \
gr_descrambler_bb.cc \
gr_scrambler_bb.cc \
gr_probe_mpsk_snr_c.cc \
- gr_probe_density_b.cc
+ gr_probe_density_b.cc \
+ gr_annotator_1toall.cc \
+ gr_annotator_1to1.cc
libgeneral_qa_la_SOURCES = \
qa_general.cc \
@@ -344,7 +346,8 @@ grinclude_HEADERS = \
gr_descrambler_bb.h \
gr_scrambler_bb.h \
gr_probe_mpsk_snr_c.h \
- gr_probe_density_b.h
+ gr_probe_density_b.h \
+ gr_annotator_1toall.h
noinst_HEADERS = \
qa_general.h \
@@ -484,5 +487,7 @@ swiginclude_HEADERS = \
gr_descrambler_bb.i \
gr_scrambler_bb.i \
gr_probe_mpsk_snr_c.i \
- gr_probe_density_b.i
+ gr_probe_density_b.i \
+ gr_annotator_1toall.i \
+ gr_annotator_1to1.i
endif
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 68cafce2e..0dce5f68d 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -141,6 +141,8 @@
#include <gr_copy.h>
#include <gr_fll_band_edge_cc.h>
#include <gr_additive_scrambler_bb.h>
+#include <gr_annotator_1toall.h>
+#include <gr_annotator_1to1.h>
%}
%include "gr_nop.i"
@@ -262,3 +264,5 @@
%include "gr_copy.i"
%include "gr_fll_band_edge_cc.i"
%include "gr_additive_scrambler_bb.i"
+%include "gr_annotator_1toall.i"
+%include "gr_annotator_1to1.i"
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc
index 366130984..34574c9e5 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
+++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc
@@ -24,38 +24,36 @@
#include "config.h"
#endif
-#include <gr_random_annotator.h>
+#include <gr_annotator_1toall.h>
#include <gr_io_signature.h>
#include <string.h>
#include <iostream>
#include <iomanip>
-gr_random_annotator_sptr
-gr_make_random_annotator (size_t sizeof_stream_item)
+gr_annotator_1toall_sptr
+gr_make_annotator_1toall (size_t sizeof_stream_item)
{
- return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item));
+ return gnuradio::get_initial_sptr (new gr_annotator_1toall (sizeof_stream_item));
}
-gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item)
- : gr_sync_block ("random_annotator",
- gr_make_io_signature (1, -1, sizeof_stream_item),
+gr_annotator_1toall::gr_annotator_1toall (size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_1toall",
+ gr_make_io_signature (1, 1, sizeof_stream_item),
gr_make_io_signature (1, -1, sizeof_stream_item)),
d_itemsize(sizeof_stream_item)
{
- //set_tag_propagation_policy(TPP_DONT);
set_tag_propagation_policy(TPP_ALL_TO_ALL);
- //set_tag_propagation_policy(TPP_ONE_TO_ONE);
d_tag_counter = 0;
}
-gr_random_annotator::~gr_random_annotator ()
+gr_annotator_1toall::~gr_annotator_1toall ()
{
std::cout << d_sout.str();
}
int
-gr_random_annotator::work (int noutput_items,
+gr_annotator_1toall::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
@@ -84,17 +82,18 @@ gr_random_annotator::work (int noutput_items,
<< std::endl;
}
- // Work does nothing to the data stream; just copy all inputs to outputs
- int ninputs = input_items.size();
- for (int i = 0; i < ninputs; i++){
- memcpy(out[i], in[i], noutput_items * d_itemsize);
- }
// Storing the current noutput_items as the value to the "noutput_items" key
pmt::pmt_t cur_N = pmt::pmt_from_uint64(d_tag_counter++);
pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
- pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items");
- add_item_tag(0, abs_N, key, cur_N, srcid);
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ int noutputs = output_items.size();
+ for (int i = 0; i < noutputs; i++) {
+ memcpy(out[i], in[0], noutput_items * d_itemsize);
+ add_item_tag(i, abs_N, key, cur_N, srcid);
+ }
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/general/gr_annotator_1toall.h
index 5fca53830..4417e8c54 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h
+++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.h
@@ -20,36 +20,36 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_RANDOM_ANNOTATOR_H
-#define INCLUDED_GR_RANDOM_ANNOTATOR_H
+#ifndef INCLUDED_GR_ANNOTATOR_1TOALL_H
+#define INCLUDED_GR_ANNOTATOR_1TOALL_H
#include <gr_sync_block.h>
-class gr_random_annotator;
-typedef boost::shared_ptr<gr_random_annotator> gr_random_annotator_sptr;
+class gr_annotator_1toall;
+typedef boost::shared_ptr<gr_annotator_1toall> gr_annotator_1toall_sptr;
// public constructor
-gr_random_annotator_sptr
-gr_make_random_annotator (size_t sizeof_stream_item);
+gr_annotator_1toall_sptr
+gr_make_annotator_1toall (size_t sizeof_stream_item);
-class gr_random_annotator : public gr_sync_block
+class gr_annotator_1toall : public gr_sync_block
{
public:
- ~gr_random_annotator ();
+ ~gr_annotator_1toall ();
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
protected:
- gr_random_annotator (size_t sizeof_stream_item);
+ gr_annotator_1toall (size_t sizeof_stream_item);
private:
size_t d_itemsize;
std::stringstream d_sout;
uint64_t d_tag_counter;
- friend gr_random_annotator_sptr
- gr_make_random_annotator (size_t sizeof_stream_item);
+ friend gr_annotator_1toall_sptr
+ gr_make_annotator_1toall (size_t sizeof_stream_item);
};
#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.i b/gnuradio-core/src/lib/general/gr_annotator_1toall.i
index f8765a294..a8f1de3e0 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.i
+++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.i
@@ -20,13 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,random_annotator);
+GR_SWIG_BLOCK_MAGIC(gr,annotator_1toall);
-gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item);
+gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item);
-class gr_random_annotator : public gr_sync_block
+class gr_annotator_1toall : public gr_sync_block
{
private:
- gr_random_annotator (size_t sizeof_stream_item);
+ gr_annotator_1toall (size_t sizeof_stream_item);
};
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index 1af91d80d..4c52f3ab0 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -49,7 +49,6 @@ libruntime_la_SOURCES = \
gr_msg_queue.cc \
gr_pagesize.cc \
gr_preferences.cc \
- gr_random_annotator.cc \
gr_realtime.cc \
gr_scheduler.cc \
gr_scheduler_sts.cc \
@@ -104,7 +103,6 @@ grinclude_HEADERS = \
gr_msg_queue.h \
gr_pagesize.h \
gr_preferences.h \
- gr_random_annotator.h \
gr_realtime.h \
gr_runtime_types.h \
gr_scheduler.h \
@@ -155,7 +153,6 @@ swiginclude_HEADERS = \
gr_message.i \
gr_msg_handler.i \
gr_msg_queue.i \
- gr_random_annotator.i \
gr_realtime.i \
gr_single_threaded_scheduler.i \
gr_sync_block.i \
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
index 2fedb28fd..a845f70dc 100644
--- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -29,7 +29,7 @@
#include <gr_null_source.h>
#include <gr_null_sink.h>
#include <gr_head.h>
-#include <gr_random_annotator.h>
+#include <gr_annotator_1toall.h>
#include <gruel/pmt.h>
@@ -73,17 +73,24 @@ qa_block_tags::t1 ()
gr_top_block_sptr tb = gr_make_top_block("top");
gr_block_sptr src (gr_make_null_source(sizeof(int)));
gr_block_sptr head (gr_make_head(sizeof(int), N));
- gr_block_sptr ann0 (gr_make_random_annotator(sizeof(int)));
- gr_block_sptr ann1 (gr_make_random_annotator(sizeof(int)));
- gr_block_sptr ann2 (gr_make_random_annotator(sizeof(int)));
- gr_block_sptr snk (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr ann0 (gr_make_annotator_1toall(sizeof(int)));
+ gr_block_sptr ann1 (gr_make_annotator_1toall(sizeof(int)));
+ gr_block_sptr ann2 (gr_make_annotator_1toall(sizeof(int)));
+ gr_block_sptr ann3 (gr_make_annotator_1toall(sizeof(int)));
+ gr_block_sptr ann4 (gr_make_annotator_1toall(sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
tb->connect(src, 0, head, 0);
tb->connect(head, 0, ann0, 0);
+
tb->connect(ann0, 0, ann1, 0);
- tb->connect(ann1, 0, ann2, 0);
- tb->connect(ann2, 0, snk, 0);
- tb->run();
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+ tb->connect(ann1, 0, snk0, 0);
+ tb->connect(ann2, 0, snk1, 0);
+ tb->run();
}
diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i
index 51b32de17..20cf68a03 100644
--- a/gnuradio-core/src/lib/runtime/runtime.i
+++ b/gnuradio-core/src/lib/runtime/runtime.i
@@ -33,7 +33,6 @@
#include <gr_msg_queue.h>
#include <gr_dispatcher.h>
#include <gr_error_handler.h>
-#include <gr_random_annotator.h>
#include <gr_realtime.h>
#include <gr_sync_block.h>
#include <gr_sync_decimator.h>
@@ -54,7 +53,6 @@
%include <gr_msg_queue.i>
%include <gr_dispatcher.i>
%include <gr_error_handler.i>
-%include <gr_random_annotator.i>
%include <gr_realtime.i>
%include <gr_sync_block.i>
%include <gr_sync_decimator.i>