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.
B22e1b01ee2edc1bdd77eeb90fd4d5b4?d=identicon&s=25 Martin Braun (Guest)
on 2009-01-20 17: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
D0072e69d706bb3ca211d33a1b536e2c?d=identicon&s=25 Johnathan Corgan (Guest)
on 2009-01-20 20:06
(Received via mailing list)
On Tue, Jan 20, 2009 at 7:53 AM, Martin Braun
<braun@int.uni-karlsruhe.de> 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 Dickens at
one point had some ideas here.

-Johnathan
781e96b7bd64e8833d71e3914cb1594a?d=identicon&s=25 Michael Dickens (Guest)
on 2009-01-20 20:09
(Received via mailing list)
Hi Martin -

On Jan 20, 2009, at 10:53 AM, Martin Braun 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.