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

David Doria daviddoria at gmail.com
Sun Sep 26 19:04:19 EDT 2010


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->Add*Class*
Observer(vtkCommand::EndInteractionEvent, CatchWidgetEvent);

and have it automatically deal with the 'this' pointer and the name of the
class?

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100926/46c43d9b/attachment.html>


More information about the vtk-developers mailing list