[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3403 - in gnuradio/trunk/gnuradio-core/src: lib/runti
From: |
eb |
Subject: |
[Commit-gnuradio] r3403 - in gnuradio/trunk/gnuradio-core/src: lib/runtime python/gnuradio/gr |
Date: |
Thu, 24 Aug 2006 12:50:19 -0600 (MDT) |
Author: eb
Date: 2006-08-24 12:50:19 -0600 (Thu, 24 Aug 2006)
New Revision: 3403
Modified:
gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.cc
gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.h
gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.i
gnuradio/trunk/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/flow_graph.py
Log:
Trial fix for ticket:45
Changed interpretation of second argument to gr_buffer_add_reader from
"history" to "nzero_preload". If the argument is 0, no zeros are
preloaded into the buffer. This is a less surprising interpretation
than the old behavior, which when passed a zero, inserted buffersize-1
zeros ;)
Modified: gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.cc 2006-08-24
05:54:17 UTC (rev 3402)
+++ gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.cc 2006-08-24
18:50:19 UTC (rev 3403)
@@ -179,11 +179,14 @@
}
gr_buffer_reader_sptr
-gr_buffer_add_reader (gr_buffer_sptr buf, int history)
+gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload)
{
+ if (nzero_preload < 0)
+ throw std::invalid_argument("gr_buffer_add_reader: nzero_preload must be
>= 0");
+
gr_buffer_reader_sptr r (new gr_buffer_reader (buf,
buf->index_sub(buf->d_write_index,
- history-1)));
+
nzero_preload)));
buf->d_readers.push_back (r.get ());
return r;
Modified: gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.h 2006-08-24
05:54:17 UTC (rev 3402)
+++ gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.h 2006-08-24
18:50:19 UTC (rev 3403)
@@ -73,7 +73,7 @@
friend class gr_buffer_reader;
friend gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item);
- friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
history);
+ friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
nzero_preload);
protected:
char *d_base; // base address of
buffer
@@ -129,8 +129,11 @@
};
-//! create a new gr_buffer_reader and attach it to buffer \p buf
-gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int history);
+/*!
+ * \brief create a new gr_buffer_reader and attach it to buffer \p buf
+ * \param nzero_preload -- number of zero items to "preload" into buffer.
+ */
+gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
nzero_preload);
//! returns # of gr_buffers currently allocated
long gr_buffer_ncurrently_allocated ();
@@ -179,7 +182,7 @@
private:
friend class gr_buffer;
- friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
history);
+ friend gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
nzero_preload);
gr_buffer_sptr d_buffer;
Modified: gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.i
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.i 2006-08-24
05:54:17 UTC (rev 3402)
+++ gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_buffer.i 2006-08-24
18:50:19 UTC (rev 3403)
@@ -43,7 +43,7 @@
%ignore gr_buffer_reader;
%rename(buffer_add_reader) gr_buffer_add_reader;
-gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int history);
+gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int
nzero_preload);
class gr_buffer_reader {
public:
Modified: gnuradio/trunk/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
2006-08-24 05:54:17 UTC (rev 3402)
+++ gnuradio/trunk/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
2006-08-24 18:50:19 UTC (rev 3403)
@@ -88,7 +88,7 @@
int read_counter = 0;
gr_buffer_sptr buf (gr_make_buffer (nitems, sizeof (int)));
- gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 1));
+ gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0));
int sa;
@@ -163,7 +163,7 @@
int nitems = (64 * (1L << 10)) / sizeof (int); // 64K worth of ints
gr_buffer_sptr buf (gr_make_buffer (nitems, sizeof (int)));
- gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 1));
+ gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0));
int read_counter = 0;
int write_counter = 0;
@@ -237,7 +237,7 @@
for (int i = 0; i < N; i++){
read_counter[i] = 0;
- reader[i] = gr_buffer_add_reader (buf, 1);
+ reader[i] = gr_buffer_add_reader (buf, 0);
}
for (int lc = 0; lc < 1000; lc++){
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/flow_graph.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/flow_graph.py
2006-08-24 05:54:17 UTC (rev 3402)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/flow_graph.py
2006-08-24 18:50:19 UTC (rev 3403)
@@ -151,7 +151,7 @@
upstream_block = e.src.block
upstream_port = e.src.port
upstream_buffer = upstream_block.detail().output(upstream_port)
- d.set_input(our_port, buffer_add_reader(upstream_buffer,
m.history()))
+ d.set_input(our_port, buffer_add_reader(upstream_buffer,
m.history()-1))
def topological_sort (self, all_v):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3403 - in gnuradio/trunk/gnuradio-core/src: lib/runtime python/gnuradio/gr,
eb <=