[Insight-users] Trying to derive single OutputWindow class from itkOutputWindow, vtkOutputWindow

Parag Chandra pchandra at radonc . unc . edu
Tue, 18 Nov 2003 17:27:11 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C3ADF9.34BA6A80
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I want to create a single class derived from itk::OutputWindow and
vtkOutputWindow to use as a receptacle for all the messages my =
application
(and ITK/VTK) might generate. Right now I have two classes, =
ITKDevNullWindow
and VTKDevNullWindow, and at the beginning of my program I use

=20

=20
itk::OutputWindow::SetInstance(aks::ITKDevNullWindow::New().GetPointer())=
;

    vtkOutputWindow::SetInstance(aks::VTKDevNullWindow::New());

=20

to redirect messages. This works fine in the case of redirecting to
/dev/null, but now I want to redirect the messages to a single FLTK =
output
window, so now I need to derive my OutputWindow from Fl_TextOutput,
vtkOutputWindow, and itk::OutputWindow. As a first step, I have tried to
create a DevNullOutput derived from both itk::OutputWindow and
vtkOutputWindow, like this:

=20

class DevNullOutput : public itk::OutputWindow, public vtkOutputWindow

{

public:

    typedef DevNullOutput Self;

    typedef itk::SmartPointer<Self> Pointer;

    itkNewMacro(Self);

    itkTypeMacro(DevNullOutput, OutputWindow);

    vtkTypeRevisionMacro(DevNullOutput, vtkOutputWindow);

    virtual void DisplayText(const char*) {}

=20

protected:

    DevNullOutput() {}

    virtual ~DevNullOutput() {}

};

=20

But VC++6 gives me 2 errors saying that DevNullOutput::new is ambiguous =
and
DevNullOutput::delete is ambiguous. I resolved the first one by =
expanding
out itkNewMacro to be:

=20

static Pointer New(void)

{

        Pointer smartPtr;

        Self *rawPtr =3D ::itk::new Self;

        smartPtr =3D rawPtr;

        static_cast<itk::OutputWindow*>(rawPtr)->UnRegister();

        return smartPtr;

}

=20

but the second one remains. How can I disambiguate this symbol, and why =
is
it even getting confused about these two operators that, as far as I can
tell, aren't even overridden by ITK or VTK? Also, is this whole idea an
exercise in futility? I haven't ever tried to use multiple inheritance
before. Thanks for any advice you can offer.

=20

Best regards,

Parag Chandra


------=_NextPart_000_0020_01C3ADF9.34BA6A80
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I want to create a single class derived from
itk::OutputWindow and vtkOutputWindow to use as a receptacle for all the
messages my application (and ITK/VTK) might generate. Right now I have =
two
classes, ITKDevNullWindow and VTKDevNullWindow, and at the beginning of =
my
program I use</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; =
itk::OutputWindow::SetInstance(aks::ITKDevNullWindow::New().GetPointer())=
;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; =
vtkOutputWindow::SetInstance(aks::VTKDevNullWindow::New());</span></font>=
</p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>to redirect messages. This works fine in the case of
redirecting to /dev/null, but now I want to redirect the messages to a =
single FLTK
output window, so now I need to derive my OutputWindow from =
Fl_TextOutput,
vtkOutputWindow, and itk::OutputWindow. As a first step, I have tried to =
create
a DevNullOutput derived from both itk::OutputWindow and vtkOutputWindow, =
like
this:</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>class DevNullOutput : public itk::OutputWindow, =
public
vtkOutputWindow</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>{</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>public:</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; typedef DevNullOutput =
Self;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; typedef =
itk::SmartPointer&lt;Self&gt;
Pointer;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; =
itkNewMacro(Self);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; itkTypeMacro(DevNullOutput,
OutputWindow);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; =
vtkTypeRevisionMacro(DevNullOutput,
vtkOutputWindow);</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; &nbsp;&nbsp;virtual void DisplayText(const =
char*) {}</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>protected:</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; DevNullOutput() =
{}</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; virtual ~DevNullOutput() =
{}</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>};</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>But VC++6 gives me 2 errors saying that =
DevNullOutput::new
is ambiguous and DevNullOutput::delete is ambiguous. I resolved the =
first one
by expanding out itkNewMacro to be:</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>static Pointer New(void)</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>{</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pointer =
smartPtr;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Self =
*rawPtr =3D ::itk::new
Self;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; smartPtr =
=3D
rawPtr;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
static_cast&lt;itk::OutputWindow*&gt;(rawPtr)-&gt;UnRegister();</span></f=
ont></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
smartPtr;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>}</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>but the second one remains. How can I disambiguate =
this
symbol, and why is it even getting confused about these two operators =
that, as
far as I can tell, aren&#8217;t even overridden by ITK or VTK? Also, is =
this
whole idea an exercise in futility? I haven&#8217;t ever tried to use =
multiple inheritance
before. Thanks for any advice you can offer.</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Best regards,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
 font-family:Arial'>Parag Chandra</span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0020_01C3ADF9.34BA6A80--