A block with different input signatures

Dear all,

How can I define a 3-input block io signatures if the inputs are:
1- two float vectors with length LENGTH1 each. (from 5 to 12)
2- a complex vector with length LENGTH1^2

output is:
float vector with length LENGTH2.

All what I dealt with before was inputs with same length but in case I
dont
know how to define this. Any help or hint, please?

Thanks,

Zoh

ps: I’m using gr_sync_block

View this message in context:
http://old.nabble.com/A-block-with-different-input-signatures-tp28864371p28864371.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Oh That’s makes sense. Thanks a lot.

Eric B. wrote:

float vector with length LENGTH2.

  • \param sizeof_stream_item2 specify the size of the items in the second

  • If there are more streams than there are entries in

    {

Eric


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://old.nabble.com/A-block-with-different-input-signatures-tp28864371p28872583.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Sat, Jun 12, 2010 at 05:21:43AM -0700, Zohair wrote:

All what I dealt with before was inputs with same length but in case I dont
know how to define this. Any help or hint, please?

Thanks,

Zoh

ps: I’m using gr_sync_block

Taking a quick look at the docs and/or the gr_io_signature.h file
reveals:

/*!

  • \brief Create an i/o signature
  • \param min_streams specify minimum number of streams (>= 0)
  • \param max_streams specify maximum number of streams (>= min_streams
    or -1 -> infinite)
  • \param sizeof_stream_item1 specify the size of the items in the first
    stream
  • \param sizeof_stream_item2 specify the size of the items in the
    second stream
  • \param sizeof_stream_item3 specify the size of the items in the third
    and subsequent streams
    */
    gr_io_signature_sptr
    gr_make_io_signature3(int min_streams, int max_streams,
    int sizeof_stream_item1,
    int sizeof_stream_item2,
    int sizeof_stream_item3
    );

For the general case see:

/*!

  • \brief Create an i/o signature
  • \param min_streams specify minimum number of streams (>= 0)
  • \param max_streams specify maximum number of streams (>= min_streams
    or -1 -> infinite)
  • \param sizeof_stream_items specify the size of the items in the
    streams
  • If there are more streams than there are entries in
    sizeof_stream_items, the
  • value of the last entry in sizeof_stream_items is used for the
    missing values.
  • sizeof_stream_items must contain at least 1 entry.
    */
    gr_io_signature_sptr
    gr_make_io_signaturev(int min_streams, int max_streams,
    const std::vector &sizeof_stream_items);

In your case:

my_block::myblock(…, size_t length1, size_t length2)
: gr_sync_block(“my_block”,
gr_make_io_signature3(3, 3,
length1 * sizeof(float),
length1 * sizeof(float),
length1 * length1 *
sizeof(gr_complex)),
gr_make_io_signature(1, 1, length2 * sizeof(float)))
{

}

If you want to enforce the range limit on length1, check length1 in
your constructor and throw std::invalid_argument(“my_block: length1 not
in [5,12]”)
if you don’t like the value.

Eric