Forum: GNU Radio C++ Templates and SWIG

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Martin B. (Guest)
on 2009-01-20 18:00
(Received via mailing list)
Hi,

I am probably going to need some templates in C++ blocks in the near
future, so I had a look at the code in gnuradio-core, where the
templates are processed before the compiler gets to see the code (all
the *X.cc.t files). If I read correctly, there was some discussion a
while ago to change this to C++ templates.

Question: could this now be done with C++ templates, or is there a
(SWIGgy) reason to use the custom template system?

TIA,
MB
Johnathan C. (Guest)
on 2009-01-20 21:06
(Received via mailing list)
On Tue, Jan 20, 2009 at 7:53 AM, Martin B.
<removed_email_address@domain.invalid> wrote:

> I am probably going to need some templates in C++ blocks in the near
> future, so I had a look at the code in gnuradio-core, where the
> templates are processed before the compiler gets to see the code (all
> the *X.cc.t files). If I read correctly, there was some discussion a
> while ago to change this to C++ templates.
>
> Question: could this now be done with C++ templates, or is there a
> (SWIGgy) reason to use the custom template system?

The original reason this was done was that SWIG did not work very well
with C++ templates and it was simpler and easier to implement our own
technique.  SWIG has come along way and the original justification may
not hold anymore.

We're open to suggestions in this area.  I think Michael D. at
one point had some ideas here.

-Johnathan
Michael D. (Guest)
on 2009-01-20 21:09
(Received via mailing list)
Hi Martin -

On Jan 20, 2009, at 10:53 AM, Martin B. wrote:
> I am probably going to need some templates in C++ blocks in the near
> future, so I had a look at the code in gnuradio-core, where the
> templates are processed before the compiler gets to see the code (all
> the *X.cc.t files). If I read correctly, there was some discussion a
> while ago to change this to C++ templates.

Yes, see <
http://lists.gnu.org/archive/html/discuss-gnuradio...
  > and follow-up threads.  Maybe Eric or Johnathan can chime in on
any transition plans or thoughts?

> Question: could this now be done with C++ templates, or is there a
> (SWIGgy) reason to use the custom template system?

I've done this in my personal block making space; it works cleanly and
well in those cases I've tried.  That said, I'm sure there are cases
where using GR's template method makes more sense.  Further, using C++
templates can result in messy and/or non-obvious programming ... I
don't have a good examples, but I'm confident that these are the cases
since they're part of the "power of C++". - MLD
This topic is locked and can not be replied to.