|
From: | Marcus Müller |
Subject: | Re: [Discuss-gnuradio] something about forecast() |
Date: | Wed, 04 Jun 2014 09:10:40 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Hi Xianda, Easiest answer first: 2. You need to write a forecast if, and only if, you're using general_work. I generally try to avoid doing that. Then: 1. ninput_items_required is, as you can see in the function signature, a reference to a vector. The size of the vector is the number of input ports. Compare to http://gnuradio.org/doc/doxygen/classgr_1_1block.html#a5bc118d94944d2ff71e378f807fb8d28 Greetings, Marcus On 04.06.2014 08:22, xianda wrote:
Hi all: I want to know something about the forecast(). I have already known that forcast() can tell scheduler how many input items are required for each output item. 1.But now i have read two example: The first one: void your_block::forecast(int noutput_items,gr_vector_int &ninput_items_required){ ninput_items_required[0]=100 * noutput_items; ninput_items_required[1]=100 * noutput_items; } I have already understand it. But the second one: void forecast (int noutput_items, gr_vector_int &ninput_items_required) { unsigned ninputs = ninput_items_required.size (); for (unsigned i = 0; i < ninputs; i++) ninput_items_required[i] = 1;} I can't understand since we can't know how many input items we required,why use ninput_items_required.size ().Can someone help me? 2.I want to know if we use the general_work().Is it means that we must use the forcast()?Thanks. Best regards |
[Prev in Thread] | Current Thread | [Next in Thread] |