[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Using the private implementation ("pimpl") patter
Re: [Discuss-gnuradio] Using the private implementation ("pimpl") pattern for GNU Radio API classes
Tue, 13 Mar 2012 09:10:25 +0100
I'm a big fan of this (in some way or another, I've been doing similar
stuff already in gr-specest etc.). It also really eases up
interoperation with external libraries.
Also, I really don't think this comes as extra effort. Code-generation
tools can help here a lot (the files containing the block definition
would be pretty similar in most cases, anyway). If anything, it makes
coding simpler because you're dealing with less problems per file.
On Mon, Mar 12, 2012 at 12:31:53PM -0700, Johnathan Corgan wrote:
> However, some implementation details (sorry) we think need to change.
> Currently, the blocks following this pattern have a public header file
> based on the block class name, like gr_foo_ff.h, which contains the
> pure virtual class and nothing else. Secondly, there exists the
> implemention class, gr_foo_ff.cc, which contains both the
> gr_foo_ff_impl class declaration and gr_foo_ff_impl member
> Having a class header file inside a .cc file, and then having the name
> of the .cc file be different from the classes that are inside it,
> makes it less readable. Tom and I are proposing, if we do go to a
> project-wide pimpl pattern, to have:
This might seem minor, but I like the first naming scheme you proposed
much better than the second (gr_foo_ff_impl > gr_foo_impl_ff).
I think of 'foo_ff' as the block name, which would be disrupted, and an
intuitive glob for impl-header-files is (in my head) "*impl.h".
Or, to put it in other terms, imagine you're searching for all the
foo_ff related files, then find . -name "*foo_ff*" will not work.
And that's really all the criticism I could possibly find. This is a
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)
Dipl.-Ing. Martin Braun
Phone: +49 721 608-43790
Fax: +49 721 608-46071
KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Description: PGP signature