On Wed, Oct 17, 2012 at 11:13 AM, nexy_sm <vlasi...@gmail.com> wrote: > Ok, I suppose the best and fastest way to learn gnuradio is by exploring > simple existing blocks, like adder for example. > I was first thinking about adder and the opened gr_add_cc.h. > > I was immediately stuck in the constructor part > > gr_add_cc::gr_add_cc (size_t vlen) > : gr_sync_block ("add_cc", > gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen), > gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)), > d_vlen (vlen) > { > } > > I was expecting something like: > > gr_add_cc::gr_add_cc (size_t vlen) > : gr_sync_block ("add_cc", > gr_make_io_signature (1, vlen, sizeof (gr_complex)), > gr_make_io_signature (1, 1, sizeof (gr_complex))), > d_vlen (vlen) > { > } > > I don't really understand this line: > > gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen) > > Can you just explain breafly what is idea behind, cause i was expecting > something more simpler. > > Thanks
It is actually quite simple, you just have a misunderstanding of what it's supposed to be doing. The first call is to set the input signature: gr_make_io_signature(min inputs, max inputs, input item size) The second one is for the output signature: gr_make_io_signature(min outputs, max outputs, output item size) The min value specifies how many inputs MUST be connected. The max value says how many CAN be connected. A value of -1 means it's undefined and any number can be connected. The item size is the size in bytes of each item. So for floats, this is sizeof(float). If you want to handle vectors, you treat the vector as an item. So a vector of vlen floats has a size 'sizeof(float)*vlen'. Tom _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio