discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] IO Signatures


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] IO Signatures
Date: Tue, 28 Jul 2015 11:01:59 -0400

On Tue, Jul 28, 2015 at 6:57 AM, Galiero Casay Gabriele <address@hidden> wrote:
Hello,

During my studies in building C++ blocks I came up with the need of one block which needs two input signatures. The input should consist of two inputs: the first one a vector of pkt_len*sizeof(float) and the second one sync_word_len*sizeof(float).

pkt_len and sync_word_len are unsigned integers.

In the tutorials I have read that for different type or size io signatures the way to proceed would be:

std::vector<int> inp_sizes;
input_sizes.push_back(pkt_len*sizeof(float));         ---> Defined before and outside the private constructor
input_sizes.push_back(sync_word_len*sizeof(float));

gr_sync_block("my block", gr_make_io_signaturev(2, 2, input_sizes), gr_make_io_signature(1, 1, sizeof(float)))

But in this case, pkt_len and sync_word_len are input parameters and hence they are defined only in the constructor body.

My question is, is there any way to tackle this? Like, any way to be able to define different size for input signatures, where the size of the vector is determined by input parameters?

Thanks before hand.
Best Rgeards,

Gabriele Galiero

Gabriele,

First, it looks like you are using an older version of GNU Radio (pre 3.7). You should really update.

As to the specific question, there are two ways to do this. With just 2 inputs, you can use the "make2" constructor instead of "makev," which would look something like:

gr::sync_block("my block",
                       gr::io_signature::make2(2, 2, pkt_len*sizeof(float), sync_word_len*sizeof(float)),
                       gr::io_signature::make(1, 1, sizeof(float)))

If you want to stick with the more flexible "makev" way of doing this, I suggest you look at the source code in gr-blocks/lib/vector_map_impl.cc. This shows how you can call a function with the ctor parameters to construct the vector you need.

Tom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]