[vtk-developers] SafeDownCast and wrapping

Andy Cedilnik andy.cedilnik at kitware.com
Mon Jan 20 13:39:21 EST 2003


Hi Bill,

I fixed the SafeDownCast for Tcl and Python. Java one unfortunately will
not work because of the flaw in the language. Java does not support
non-virtual methods. It also does not support covariant return types, so
there is no way to write method that looks like this:

vtkCurrentClass SafeDownCast(vtkObject foo);

because return type of this method will be different in the hierarchy,
which will cause the compiler to complain. We could write something
like:

vtkObject SafeDownCast(vtkObject foo);

Which does the check, but you would have to use it like this:

vtkFoo = (vtkFoo)(vtkfoo::SafeDownCast(foo));

Let me know.

				Andy

On Sun, 2003-01-19 at 20:09, Bill Lorensen wrote:
> The SafeDownCast method is not being wrapped. I discovered this while
> tacking down the reason for lack of coverage of PrintSelf methods that
> started recently. This led me through a twisty maze of passages.
> 
> Eventually, I discovered that the vtkParse.y code generates code for
> most of the methods (IsA, GetClassName, NewInstance) in the
> vtkTypeRevisionMacro, but not for the SafeDownCast method which is
> also defined in that macro.
> 
> Perhaps, someone skilled in the magic of vtkParse.y (Brad?) could add
> the SafeDownCast code.





More information about the vtk-developers mailing list