discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] call the work() method


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] call the work() method
Date: Sat, 31 May 2014 11:56:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Hi Xianda,

         I know every block should have it's work or general_work function.And i know it's used by scheduler.
Right!
         Now I want to write my c++ code just call work function.Is right to do it?
I hope I understand you correctly:
You want to write a C++ program that calls your work function?

As usual, it would be quite helpful if you explained *why* you would want to do this!

Short Answer:
*Usually* you don't do that, so it's not right to do.
Long Answer:
You can not generally do this because a block can only exist within GNU Radio, and relies on GNU Radio scheduler mechanisms.
If you however, wrote a work() that only uses the the input_items, output_items buffers and only relies on noutput_items as runtime information,
than that's technically possible. I would *not* recommend that, though. Better write a new function, e.g. "signal_processing(in,out, howmany)" in a non-block class
and call that from your work() as well as from your new C++ program.
         If ok,can someone explain how to call work function?
It's a C++ method, and the function signature is
int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
(from the official documentation, http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html)
You could call it like you would call every other method. Since I assume you already know how input_ and output_items should look like from writing a work() function,
I don't understand where the "how to call question" comes from.

Best Regards,
Marcus Müller

reply via email to

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