[Top][All Lists]
[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:23:12 -0700 |
User-agent: |
Mutt/1.5.9i |
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*?
Thanks,
Eric