[vtk-developers] vtkLiteObject?

Roland Schwarz roland.schwarz at chello.at
Wed Apr 10 15:58:57 EDT 2002


Respectfully I would like to contribute my considerations:

>
> I think we need to take reference counting out of vtkObject and
> put it in a common superclass.
> This is the case because vtkCommand and vtkContainer are not
> subclasses vtkObject, so they do have to implement their own
> reference counting scheme. Please let me know what you think
> the name of the common superclass should be?

>
> vtkLiteObject?
> vtkSuperObject?
> vtkAbstractObject?
>

I looked into 'Design Patterns'.
Isn't the Adapter pattern also a viable answer to this question?

"Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompatible interfaces."

Another possibly naive suggestion:

Why not make vtkContainer and vtkCommand simply subclasses of vtkObject?

Or let vtkObject be the root of all classes, that describes what is common
to all,
as creation, getclassname, reference counting and the like, and have a new
subclass
of vtkObject that holds the rest?

Put it another way:
vtkObject will be broken into the following hierarchy:
class vtkObject
class vtkNewObject: public vtkObject

every class that derived from class vtkObject will now derive from
vtkNewObject. The latter will have the full interface of the old vtkObject
class.

vtkCommand now can derive from vtkObject and inherit reference counting, and
noting more.

Of course vtkNewObject should be replaced by something more meaningful than
New. But this could depend on which functions made it into this new object.

Roland








More information about the vtk-developers mailing list