[vtk-developers] vtkMathTextUtilities and otherPrint test

David Cole david.cole at kitware.com
Tue Jul 10 15:47:05 EDT 2012


On Tue, Jul 10, 2012 at 3:39 PM, David Lonie <david.lonie at kitware.com>wrote:

> On Tue, Jul 10, 2012 at 3:25 PM, David Cole <david.cole at kitware.com>
> wrote:
> > Why are the static New methods of singleton objects in VTK public?
> >   static vtkMathTextUtilities *New();
>
> That New method just returns the singleton instance after increasing
> its reference count. Not sure exactly why it was included (the
> original author of the vtkFreeTypeUtilities pattern may), but I like
> having it around for use with vtkNew/vtkSmartPointer. I think the VTK
> user guide also says that all vtkObject subclasses _must_ define it.
>

Right, but I phrased it strangely. My real question was "does static New
have to be in the public section of the class"?

(For a singleton that is created via a call to GetInstance, isn't it a good
idea to make "New" protected or even private?)

Maybe it does need to be public for the wrappers or something, but seems
like a bad idea to have a public New for a singleton.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120710/40fee669/attachment.html>


More information about the vtk-developers mailing list