discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: EXTERNAL: Re: OOT block with variable sink types


From: Jeff Long
Subject: Re: EXTERNAL: Re: OOT block with variable sink types
Date: Wed, 11 May 2022 18:27:51 -0400

The input type in File Sink is selected by the user. GRC generates the appropriate call to the Python wrapper for the C++ block. Take a look at the generated Python for a couple different input types.

On Mon, May 9, 2022 at 6:16 PM Price, Rodney D. <Price-Rodney@zai.com> wrote:

I see. So you just pass in the itemsize explicitly, (or in Python, as you suggest, pass in the type and look up the item size). The itemsize is all that matters. That leads me to a related question: how do you tell GRC what the input type is? I looked at the yaml file for blocks.file_sink, and just saw some options for complex, float, etc. In order to work with GRC, don’t you need to explicitly say somewhere what the input type is?

 

From: Discuss-gnuradio [mailto:discuss-gnuradio-bounces+price-rodney=zai.com@gnu.org] On Behalf Of Jeff Long
Sent: Monday, May 09, 2022 3:29 PM
To: discuss-gnuradio@gnu.org
Subject: EXTERNAL: Re: OOT block with variable sink types

 

From the framework's point of view, only item size is defined, not type. So, it is up to the block code and the GRC yaml files to coordinate user selection of a type and block interpretation of a type. This can be tricky if two types have the same size, e.g., complex int16 vs. real float.

 

Some of the C++ blocks use templates to make whatever_ff vs whatever_cc. You could make separate blocks in Python that subclass a common one, using some decorator trickery maybe.

 

The sink constructor could take a type, in Python, then the block can do the appropriate thing on instantiation.

 

The important thing to understand is that, unless templating is used, I/O types are managed "out-of-band".

 

Take a look at gr-blocks/lib/file_sink_impl.cc for an example of a sink with a variable type (that is not templated).

 

On Mon, May 9, 2022 at 5:08 PM Price, Rodney D. <Price-Rodney@zai.com> wrote:

Hi,

 

I have a Python OOT block that right now has a sink with complex type. I’d like to give the user the option to change that to float or int. Many blocks do this, and I’ve looked at the source code (C++), but I haven’t been able to suss out how it’s being done. Is there some straightforward way to give the user options on the type of streams in and out?

 

Thanks,

-Rod Price

 


This message is intended only for the use of the individual or entity to which it is addressed and may contain ZETA Associates confidential or proprietary information. If you are not the intended recipient, any use, dissemination, or distribution of this communication is prohibited. If you have received this communication in error, please notify the sender and delete all copies.


This message is intended only for the use of the individual or entity to which it is addressed and may contain ZETA Associates confidential or proprietary information. If you are not the intended recipient, any use, dissemination, or distribution of this communication is prohibited. If you have received this communication in error, please notify the sender and delete all copies.

reply via email to

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