[Insight-developers] PrintSelf() broken?
Parag Chandra
chandra@cs.unc.edu
Thu, 17 May 2001 11:24:40 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_089B_01C0DEC3.F6A48520
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
After I did a fresh checkout this morning and rebuilt everything, =
including CMake, I notice that my classes no longer print themselves out =
correctly. If I step through the program execution, it goes like this:
params->Print(std::cout)
LightObject::Print() {... this->PrintSelf() ...}
Object::PrintSelf() {... Superclass::PrintSelf() ...}
LightObject::PrintSelf()
Object::PrintSelf() {...}
LightObject::Print() {...}
...
so the PrintSelf() method for my class never gets called, and all I get =
is:
Self (01001CE0)
Reference Count: 1
Modified Time: 1
m_Debug: Off
The class hierarchy is very simple: LightObject -> Object -> Parameters =
-> VFGParameters, where Parameters and VFGParameters are the classes =
I've created. This is happening under VC++ 6.0, and I think it has =
something to do with the fact that my classes are part of the /Examples =
subdir. I ran another example for the class hierarchy: ... -> Image -> =
VectorField, where VectorField again is a class in the /Examples dir, =
and this time I get the following trace:
field->Print(std::cout)
LightObject::Print() {... this->PrintSelf() ...}
// VectorField::PrintSelf() should have been called here
Image::PrintSelf() {... SuperClass::PrintSelf() ...}
ImageBase::PrintSelf() ... SuperClass::PrintSelf() =
...}
etc.
=20
So it seems like the virtual methods aren't being invoked correctly for =
classes in this directory. I didn't have this problem until this =
morning, but the last time I did an update was sometime last week. Does =
anyone have an idea what the problem might be?
Thanks,
-Parag
------=_NextPart_000_089B_01C0DEC3.F6A48520
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>After I did a fresh checkout this =
morning and=20
rebuilt everything, including CMake, I notice that my classes no longer =
print=20
themselves out correctly. If I step through the program execution, it =
goes like=20
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2>params->Print(std::cout)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
LightObject::Print() {...=20
this->PrintSelf() ...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
Object::PrintSelf() {... Superclass::PrintSelf() ...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
LightObject::PrintSelf()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
Object::PrintSelf() {...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> LightObject::Print() =
{...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>so the PrintSelf() method for my class =
never gets=20
called, and all I get is:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Self (01001CE0)<BR> Reference =
Count:=20
1<BR> Modified Time: 1<BR> m_Debug: Off</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The class hierarchy is very =
simple:=20
LightObject -> Object -> Parameters -> VFGParameters, where =
Parameters=20
and VFGParameters are the classes I've created. This is happening under =
VC++=20
6.0, and I think it has something to do with the fact that my classes =
are part=20
of the /Examples subdir. I ran another example for the class hierarchy: =
...=20
-> Image -> VectorField, where VectorField again is a class in the =
/Examples dir, and this time I get the following trace:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>field->Print(std::cout)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
LightObject::Print() {...=20
this->PrintSelf() ...}</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
// VectorField::PrintSelf() should have been called=20
here</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
Image::PrintSelf()=20
{... SuperClass::PrintSelf() ...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
=20
ImageBase::PrintSelf() ... SuperClass::PrintSelf() =
...}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
=
=20
etc.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>So it seems like the virtual methods =
aren't being=20
invoked correctly for classes in this directory. I didn't have this =
problem=20
until this morning, but the last time I did an update was sometime last =
week.=20
Does anyone have an idea what the problem might be?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Parag</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_089B_01C0DEC3.F6A48520--