[vtk-developers] Unique PIMPL class names

Andy Cedilnik andy.cedilnik at kitware.com
Thu Jan 9 16:18:53 EST 2003


Hi David,

PIMPL is the answer to your question. PIMPL or Private IMPLementation
means you put only necessary stuff in the header file and put the
actual internals in a class defined in cxx file. For example
vtkTIFFReader uses libtiff to do its work, so it needs to include
tiffio.h for libtiff data structures. By using direct approach and
putting internals of tiff in the header file, then everybody that uses
vtkTIFFReader needs to have access to tiffio.h. By using PIMPL
approach, you can completely hide implementation from users of the
class.

There are other classes in vtk that use PIMPL, such as vtkObject,
vtkLineWidget, ...

				Andy

On Thu, 2003-01-09 at 16:05, David Thompson wrote:
> Why not declare them as member classes of vtkFoo instead of
> making really long classnames?
> class vtkFoo
> {
>   private:
>     class Bar {
>     }
> };
> 
> Inside member functions of vtkFoo, you don't need to type
> vtkFooBar, just Bar. If declared as private members (as
> above) no one can use this class externally. If declared
> as public members, then others can reference the class
> name as vtkFoo::Bar.
> 
> 		David
> 




More information about the vtk-developers mailing list