discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] SWIG/C++ Template Expansion Info


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] SWIG/C++ Template Expansion Info
Date: Wed, 29 Aug 2007 20:33:24 -0700
User-agent: Mutt/1.5.9i

On Wed, Aug 29, 2007 at 08:23:12PM -0700, Eric Blossom wrote:
> On Wed, Aug 29, 2007 at 10:48:07PM -0400, Michael Dickens wrote:
> > I've always wondered why GNU Radio didn't use C++ templates for gr- 
> > blocks (see e.g. the 'gengen' subdirectory in gnuradio-core), since  
> > they generally result in much less written code.  Might partly be  
> > that SWIG only "recently" (as of 1.3.12 or so) added C++ templates to  
> > its bag of tricks?  Also might be that the SWIG interface is  
> > challenging at its best, let alone with something as complex as C++  
> > template expansion / instantiation?
> > 
> > Last week I hacked through both the C++ and SWIG necessities to get  
> > template C++ gr-blocks to expand (instantiate) correctly into shared  
> > libraries that work correctly with both Python and C++.  After much  
> > fussing, I wrote a SWIG macro (%define), similar to  
> > "GR_SWIG_BLOCK_MAGIC", but for template C++ class expansion into  
> > uniquely named GR blocks.  While the macro might not work for  
> > everyone (or it might, testers would be appreciated), and maybe it's  
> > a bit ugly to read, the steps in it make sense according to the SWIG  
> > documentation.
> > 
> > If anyone is interested I can provide more information. - MLD
> 
> Great!
> 
> Can you point us to the code, and show for example, how you'd handle
> gr_sig_source*?

Also, if you've got time, can you see if you can figure out how
to handle the accumulator type inference in filter/generate_gr_fir_XXX.py?
There's probably a way (template metaprogramming from hell?), but beats me.

Thanks,
Eric




reply via email to

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