[vtk-developers] [Paraview-developers] Moving vtkMemberFunctionCommand to VTK

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Sep 27 09:14:44 EDT 2010


Not a bad idea at all. Internally, we can still do what we do
currently to avoid making any dramatic changes. But, API-wise will
make our lives much easier. Let's hope some of the VTK veterans
comment :).

Utkarsh

On Sun, Sep 26, 2010 at 7:04 PM, David Doria <daviddoria at gmail.com> wrote:
> On Fri, Sep 24, 2010 at 12:38 PM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
>>
>> Couple of suggestions:
>>
>> 1> I think we should change the API to be:
>>
>> SetCallback(ClassT* ...) rather than SetCallback(ClassT& ..)
>>
>> That makes the mode more VTK-like when reading:
>>
>> I'd prefer:
>>
>> obs->SetCallback(this, &vtkMySelf::CallbackHandler);
>>
>> to the current implementation i.e.:
>>
>> obs->SetCallback(*this, &vtkMySelf::CallbackHandler);
>>
>> 2> We should use vtkWeakPointer for the Object ptr, to avoid dangling
>> pointers.
>>
>> 3> The documentation needs to be fixed. Currently there are errors in
>> it, the usage described does not really match the real usage :).
>>
>> 4> Another possibility is simply moving the code to vtkCommand.h.
>>
>> Like David said, let's wait a week to see if people respond, otherwise
>> I will make those changes and move the header to VTK/Common.
>>
>> Utkarsh
>>
>
> Is there a way to skip the adapter all together? That is, rather than:
> adapter = vtkMemberFunctionCommand<CustomStyle>::New();
> adapter->SetCallback(*this, &CustomStyle::CatchWidgetEvent);
> tracer->AddObserver(vtkCommand::EndInteractionEvent, this->Adapter);
> could we just do something like:
> tracer->AddClassObserver(vtkCommand::EndInteractionEvent, CatchWidgetEvent);
> and have it automatically deal with the 'this' pointer and the name of the
> class?
> David



More information about the vtk-developers mailing list