discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Using the private implementation ("pimpl") patter


From: Martin Braun
Subject: Re: [Discuss-gnuradio] Using the private implementation ("pimpl") pattern for GNU Radio API classes
Date: Tue, 13 Mar 2012 09:10:25 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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
> implementations.
> 
> 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:
> 
> include/gr_foo_ff.h
> lib/gr_foo_impl_ff.h
> lib/gr_foo_impl_ff.cc

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
great idea.

MB


-- 
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Attachment: pgpgRMHLA88Kj.pgp
Description: PGP signature


reply via email to

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