discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] implementing actual blocks in python


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] implementing actual blocks in python
Date: Tue, 6 Nov 2007 19:11:32 -0800
User-agent: Mutt/1.5.9i

On Tue, Nov 06, 2007 at 08:20:17PM -0500, Josh Blum wrote:
> Hello,
> 
> I was thinking of an interesting feature for gnuradio: Suppose that the 
> gnuradio framework could also support blocks written in python. Not 
> hier-blocks, but actual data processing done in python. Meaning, one 
> would write a python class. The class would have an io signature, and a 
> function called work, where work would take a vector of floats/ints, 
> process the data, and return a vector of floats/ints (just like in the 
> c++). Yes, of course, this would be slower than c++. The idea favors 
> rapid testing, no recompiling; just run the flow graph again after 
> changing your python file.
> 
> Most likely, we would need some kind of "generic forwarding block", 
> written in c++/swig, that would take a custom python class as an 
> argument, and swig would handle the passing of data into and out of the 
> work method of the python class.
> 
> I have no idea how this could be implemented with the current framework. 
>  But if possible, this would be a tremendous thing to have.
> 
> Thoughts?
> -Josh

Josh,

It could be implemented using SWIG directors.
They allow a C++ class w/ virtual functions to have virtual methods 
defined in python subclasses.

Take a look at "directors" in the swig documentation.

Eric




reply via email to

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