diff options
author | Tom Rondeau | 2010-11-04 11:38:27 -0400 |
---|---|---|
committer | Tom Rondeau | 2010-11-04 11:38:27 -0400 |
commit | c3725a7269a7e96252a957b6d078686352365de6 (patch) | |
tree | 4060f59123c6e1227500ff6e3d1bab991d75b5b0 | |
parent | e70f8a0d50474784c1f1b64b94907feb9b913a2b (diff) | |
download | gnuradio-c3725a7269a7e96252a957b6d078686352365de6.tar.gz gnuradio-c3725a7269a7e96252a957b6d078686352365de6.tar.bz2 gnuradio-c3725a7269a7e96252a957b6d078686352365de6.zip |
Fixing buffer to update abs_write_offset counter. Keeping access to counters exposed through gr_block for now, just remaining to nitem_*.
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.cc | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.h | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.i | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.cc | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/qa_block_tags.cc | 18 |
5 files changed, 16 insertions, 15 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index c00a034de..13035aa96 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -118,7 +118,7 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) } gr_uint64 -gr_block::n_items_read(unsigned int which_input) +gr_block::nitems_read(unsigned int which_input) { if(d_detail) { return d_detail->nitems_read(which_input); @@ -130,7 +130,7 @@ gr_block::n_items_read(unsigned int which_input) } gr_uint64 -gr_block::n_items_written(unsigned int which_output) +gr_block::nitems_written(unsigned int which_output) { if(d_detail) { return d_detail->nitems_written(which_output); diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 888ca811a..7564acd87 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -200,10 +200,10 @@ class gr_block : public gr_basic_block { virtual int fixed_rate_noutput_to_ninput(int noutput); // Return the number of items read on input stream which_input - gr_uint64 n_items_read(unsigned int which_input); + gr_uint64 nitems_read(unsigned int which_input); // Return the number of items written on output stream which_output - gr_uint64 n_items_written(unsigned int which_output); + gr_uint64 nitems_written(unsigned int which_output); void add_item_tag(unsigned int which_output, gr_uint64 offset, diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index d70a5854a..4684bd2f2 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -49,8 +49,8 @@ class gr_block : public gr_basic_block { bool start(); bool stop(); - gr_uint64 n_items_read(unsigned int which_input); - gr_uint64 n_items_written(unsigned int which_output); + gr_uint64 nitems_read(unsigned int which_input); + gr_uint64 nitems_written(unsigned int which_output); // internal use gr_block_detail_sptr detail () const { return d_detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 42d00e06f..89db99b69 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -177,6 +177,7 @@ gr_buffer::update_write_pointer (int nitems) { gruel::scoped_lock guard(*mutex()); d_write_index = index_add (d_write_index, nitems); + d_abs_write_offset += nitems; } void diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index c9ec788b0..73faa6ca7 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -49,17 +49,17 @@ qa_block_tags::t0 () tb->connect(src, 0, head, 0); tb->connect(head, 0, snk, 0); - //CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::runtime_error); - //CPPUNIT_ASSERT_THROW(src->n_items_written(0), std::runtime_error); - CPPUNIT_ASSERT_EQUAL(src->n_items_read(0), (gr_uint64)0); - CPPUNIT_ASSERT_EQUAL(src->n_items_written(0), (gr_uint64)0); + //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error); + //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error); + CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (gr_uint64)0); + CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (gr_uint64)0); tb->run(); - CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::invalid_argument); - CPPUNIT_ASSERT(src->n_items_written(0) >= N); - CPPUNIT_ASSERT_EQUAL(snk->n_items_read(0), (gr_uint64)1000); - CPPUNIT_ASSERT_THROW(snk->n_items_written(0), std::invalid_argument); + CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument); + CPPUNIT_ASSERT(src->nitems_written(0) >= N); + CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (gr_uint64)1000); + CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument); } @@ -78,7 +78,7 @@ qa_block_tags::t1 () tb->connect(head, 0, snk, 0); tb->run(); - gr_uint64 W = src->n_items_written(0); + gr_uint64 W = src->nitems_written(0); src->add_item_tag(0, N, pmt::pmt_string_to_symbol("test1"), pmt::pmt_from_double(1.234)); |