On Mon, Jan 07, 2008 at 10:28:39AM +0800, Jonas Gacrama wrote:
These are some of the input parameters of gr_block::general_work() :
input_items vector of pointers to the input items, one entry per input stream
output_items vector of pointers to the output items, one entry per
output stream
Am I correct in understanding that the input_items CAN point to a
vector type of inputs?
No, the data items must be “plain-old-data”…
Something that can be copied safely with memcpy.
I plan to implement two input channels
of vector type. Therefore I plan to pass TWO POINTERS of
vector type as “input_items” to general_work.
Do you mean that each “item” is conceptually a vector of 10,000
floats? And that your block operates on two input streams, each of
which contains “items” that are vectors of 10,000 floats?
If so, you input signature should be:
gr_make_io_signature(2, 2, 10000 * sizeof(float))
Unless your block has a time varying i/o rate between input and
output, I’d recommend that you derive your class from gr_sync_block
instead of gr_block. It’s easier that way.
Note that the discussion on this website:
“http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html”
only used one
“channel” of inputs since it only took values from a single stream. I
plan to take TWO CHANNELS of inputs wherein each channel contains
10000 inputs.
One of the joys of Free Software is that the code is available to
inspect. There are 100’s of blocks to look at, and at least 1/2 of
them take more than a single input.
In particular, you may want to look at the code for
gr_add_vff.{h,cc} which adds streams of vectors of floats together and
gr_add_ff.{h,cc} which adds streams of floats together.
Eric