[vtk-developers] vtk constructor changes

Sebastien BARRE sebastien.barre at kitware.com
Thu Jan 10 09:22:48 EST 2002


At 1/10/2002 09:10 AM, Sebastien BARRE wrote:
>At 1/10/2002 08:59 AM, Lorensen, William E (CRD) wrote:
>>Berk,
>>The changes you are making to some constructors that replace explicit 
>>initializations with Set's will
>>calls purify umr/umc's. That's because the macros compare the current 
>>setting (which is not
>>initialized) with the new values.
>
>Sorry, these are mine, I'm fixing that right now.
>
>BTW, I found several classes using ->Set... in the constructor, might be 
>worth cleaning them too.

BTW, these small changes were just meant to unroll some initialization loops:

i.e. replace:

   int idx;
   for (idx = 0; idx < 3; ++idx)
    {
    this->CutOff[idx] = VTK_LARGE_FLOAT;
    }

with:

   this->CutOff[0] = this->CutOff[1] = this->CutOff[2] = VTK_LARGE_FLOAT;

to make the constructor code easier to parse from Perl code. It is then 
easier to extract the ivars "default" values. I'm using that feature in a 
project. I don't think it hurts.

My mistake was that I noticed some classes that were using ->Set method in 
the constructor. I should have followed my instinct and some common sense 
and refrain from doing these "dangerous" thing too:

   this->SetCutOff(VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, VTK_LARGE_FLOAT);

I'll backup my changes (still unrolling some loops).

--
Sebastien Barre




More information about the vtk-developers mailing list