summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.cc28
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.h28
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.i10
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.cc32
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.h29
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.i9
6 files changed, 50 insertions, 86 deletions
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
index 1a6cadbcf..11e2c2b4b 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
@@ -31,24 +31,22 @@
#include <iomanip>
gr_annotator_1to1_sptr
-gr_make_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate)
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item)
{
return gnuradio::get_initial_sptr (new gr_annotator_1to1
- (when, sizeof_stream_item, rel_rate));
+ (when, sizeof_stream_item));
}
-gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate)
- : gr_block ("annotator_1to1",
- gr_make_io_signature (1, -1, sizeof_stream_item),
- gr_make_io_signature (1, -1, sizeof_stream_item)),
- d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when)
+gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_1to1",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
{
set_tag_propagation_policy(TPP_ONE_TO_ONE);
d_tag_counter = 0;
- set_relative_rate(d_rel_rate);
+ set_relative_rate(1.0);
}
gr_annotator_1to1::~gr_annotator_1to1 ()
@@ -56,10 +54,9 @@ gr_annotator_1to1::~gr_annotator_1to1 ()
}
int
-gr_annotator_1to1::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+gr_annotator_1to1::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
const float *in = (const float*)input_items[0];
float *out = (float*)output_items[0];
@@ -68,7 +65,7 @@ gr_annotator_1to1::general_work (int noutput_items,
str << name() << unique_id();
uint64_t abs_N = 0;
- int ninputs = ninput_items.size();
+ int ninputs = input_items.size();
for(int i = 0; i < ninputs; i++) {
abs_N = nitems_read(i);
std::vector<pmt::pmt_t> all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items);
@@ -104,6 +101,5 @@ gr_annotator_1to1::general_work (int noutput_items,
abs_N++;
}
- consume_each(noutput_items);
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
index e9167bf39..4abc5b051 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
@@ -23,15 +23,14 @@
#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H
#define INCLUDED_GR_ANNOTATOR_1TO1_H
-#include <gr_block.h>
+#include <gr_sync_block.h>
class gr_annotator_1to1;
typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr;
// public constructor
gr_annotator_1to1_sptr
-gr_make_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate=1.0);
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
/*!
* \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
@@ -46,21 +45,13 @@ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item,
*
* This block is only meant for testing and showing how to use the tags.
*/
-class gr_annotator_1to1 : public gr_block
+class gr_annotator_1to1 : public gr_sync_block
{
public:
~gr_annotator_1to1 ();
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- void set_rel_rate(float rrate) {
- d_rel_rate = rrate;
- set_relative_rate(d_rel_rate);
- }
- float rel_rate() { return d_rel_rate; }
-
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
std::vector<pmt::pmt_t> data() const
{
@@ -68,19 +59,16 @@ class gr_annotator_1to1 : public gr_block
}
protected:
- gr_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate);
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
private:
size_t d_itemsize;
- float d_rel_rate;
uint64_t d_when;
uint64_t d_tag_counter;
std::vector<pmt::pmt_t> d_stored_tags;
friend gr_annotator_1to1_sptr
- gr_make_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate);
+ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
};
#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
index 99ab4788c..f29ecbf53 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
@@ -23,18 +23,14 @@
GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1);
gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when,
- size_t sizeof_stream_item,
- float rel_rate);
+ size_t sizeof_stream_item);
-class gr_annotator_1to1 : public gr_block
+class gr_annotator_1to1 : public gr_sync_block
{
public:
- void set_rel_rate(float rrate);
- float rel_rate();
std::vector<pmt::pmt_t> data() const;
private:
- gr_annotator_1to1 (int when, size_t sizeof_stream_item,
- float rel_rate);
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
};
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
index e7bf5d007..9306f9e37 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
@@ -31,25 +31,22 @@
#include <iomanip>
gr_annotator_alltoall_sptr
-gr_make_annotator_alltoall (int when, size_t sizeof_stream_item,
- float rel_rate)
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item)
{
return gnuradio::get_initial_sptr (new gr_annotator_alltoall
- (when, sizeof_stream_item, rel_rate));
+ (when, sizeof_stream_item));
}
gr_annotator_alltoall::gr_annotator_alltoall (int when,
- size_t sizeof_stream_item,
- float rel_rate)
- : gr_block ("annotator_alltoall",
- gr_make_io_signature (1, -1, sizeof_stream_item),
- gr_make_io_signature (1, -1, sizeof_stream_item)),
- d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when)
+ size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_alltoall",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
{
set_tag_propagation_policy(TPP_ALL_TO_ALL);
d_tag_counter = 0;
- set_relative_rate(d_rel_rate);
}
gr_annotator_alltoall::~gr_annotator_alltoall ()
@@ -57,10 +54,9 @@ gr_annotator_alltoall::~gr_annotator_alltoall ()
}
int
-gr_annotator_alltoall::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+gr_annotator_alltoall::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
@@ -68,11 +64,12 @@ gr_annotator_alltoall::general_work (int noutput_items,
std::stringstream str;
str << name() << unique_id();
- uint64_t abs_N = 0;
+ uint64_t abs_N = 0, end_N;
int ninputs = input_items.size();
for(int i = 0; i < ninputs; i++) {
abs_N = nitems_read(i);
- std::vector<pmt::pmt_t> all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items);
+ end_N = abs_N + (uint64_t)(noutput_items);
+ std::vector<pmt::pmt_t> all_tags = get_tags_in_range(i, abs_N, end_N);
std::vector<pmt::pmt_t>::iterator itr;
for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
@@ -86,7 +83,9 @@ gr_annotator_alltoall::general_work (int noutput_items,
// Work does nothing to the data stream; just copy all inputs to outputs
// Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_written(0);
int noutputs = output_items.size();
+
for(int j = 0; j < noutput_items; j++) {
for(int i = 0; i < noutputs; i++) {
if(abs_N % d_when == 0) {
@@ -105,6 +104,5 @@ gr_annotator_alltoall::general_work (int noutput_items,
abs_N++;
}
- consume_each(noutput_items);
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
index 38cb53bd6..e1e51ebf3 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
@@ -23,15 +23,14 @@
#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H
#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
-#include <gr_block.h>
+#include <gr_sync_block.h>
class gr_annotator_alltoall;
typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr;
// public constructor
gr_annotator_alltoall_sptr
-gr_make_annotator_alltoall (int when, size_t sizeof_stream_item,
- float rel_rate=1.0);
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
/*!
* \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
@@ -46,41 +45,31 @@ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item,
*
* This block is only meant for testing and showing how to use the tags.
*/
-class gr_annotator_alltoall : public gr_block
+class gr_annotator_alltoall : public gr_sync_block
{
public:
~gr_annotator_alltoall ();
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- void set_rel_rate(float rrate) {
- d_rel_rate = rrate;
- set_relative_rate(d_rel_rate);
- }
- float rel_rate() { return d_rel_rate; }
-
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
std::vector<pmt::pmt_t> data() const
{
return d_stored_tags;
}
protected:
- gr_annotator_alltoall (int when, size_t sizeof_stream_item,
- float rel_rate);
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
private:
size_t d_itemsize;
- float d_rel_rate;
uint64_t d_when;
uint64_t d_tag_counter;
std::vector<pmt::pmt_t> d_stored_tags;
friend gr_annotator_alltoall_sptr
- gr_make_annotator_alltoall (int when, size_t sizeof_stream_item,
- float rel_rate);
+ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
};
#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
index 7812e80c5..f9bf6dd9a 100644
--- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
@@ -23,17 +23,14 @@
GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall);
gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when,
- size_t sizeof_stream_item,
- float rel_rate);
+ size_t sizeof_stream_item);
-class gr_annotator_alltoall : public gr_block
+class gr_annotator_alltoall : public gr_sync_block
{
public:
- void set_rel_rate(float rrate);
- float rel_rate();
std::vector<pmt::pmt_t> data() const;
private:
- gr_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate);
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
};