[vtk-developers] protected private storage class pointers?

Marcus D. Hanwell marcus.hanwell at kitware.com
Wed May 16 17:30:30 EDT 2012


Hi Eric,

On Wed, May 16, 2012 at 5:18 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Marcus,
>
> I'm revisiting my subclasses of some of the Charts stuff to see whether I can make it easier to maintain as you guys improve VTK. (I add some members to keep track of another set of selections and I need to customize the Paint() routines to display different annotations and decorations.)

Sounds great, and I value your input as a user of the chart API.
>
> In some cases (especially with parallel coordinates plot and chart) I have trouble just subclassing and overriding the Paint() routine because I can't figure out how to access the Storage classes from the superclass and I can't seem to access all the data required to paint just through the public API.
>
> So, my question, stemming from my C++ ignorance: Is there a reason you make your opaque pointers
>
> protected:
>  ...
>  class Private;
>  Private* Storage;
>
> "protected" rather than "private"? Is there some way I'm not seeing to access this->Storage from within my subclass (say, of vtkPlotParallelCoordinates) since Storage is protected? And, if not, why not just make it "private"?

It is the VTK coding style, although I agree with an opaque pointer it
would make more sense for them to be private. I could enhance the API
to expose more of what you need though, and I had been considering
whether an internal header might make sense so that derived classes
can access elements that are not in the public API.

If you could let me know what parts of the API you need access to I
should have a little time to look over this and revisit some of those
choices. It is great to hear you are still working on some of this,
and I think having an idea of what is missing from the public API
would be helpful.

Thanks,

Marcus



More information about the vtk-developers mailing list