[vtkusers] CALLBACK / function pointers ?

John Platt jcplatt at dsl.pipex.com
Thu May 6 17:27:25 EDT 2010


Hi,

Have you tried

    static void Reaction (... )
    {
    }

HTH

John


----- Original Message ----- 
From: "Antonin Perrot-Audet" <antonin07130 at gmail.com>
To: <vtkusers at vtk.org>
Sent: Thursday, May 06, 2010 9:47 PM
Subject: [vtkusers] CALLBACK / function pointers ?


> Hello all,
>
> I have a hopefully simple problem, but I have been struggling for days and 
> I hope someone has an answer :
>
> I am trying to use *VTK callbacks* in a custom class :
> The problem is that I can't get it to execute the function I created.
>
> I get a :
> *no matching function for call to 
> 'vtkCallbackCommand::SetCallback(<unresolved overloaded function type>)'*
> when I try to compile.
>
> It seems that it can't find my function based on its signature ?
>
>
> I wrote a simple example :
> --------------------------------------------------------
> // all necessary includes
>
> class A
> {
>
> //[...]
> public:
> //[...]
>
>
> void SetObserversA ()
>     {
>         // I create a callback object
>         vtkSmartPointer<vtkCallbackCommand> vtkCBSynchroCam = 
> vtkSmartPointer<vtkCallbackCommand>::New();
>
>         // HERE IS THE PROBLEM : I TRY TO SET THE CALLBACK FUNCTION
>         vtkCBSynchroCam->SetCallback( A::Reaction );
>
>           RenderWin->AddObserver( vtkCommand::AnyEvent, vtkCBSynchroCam );
>     }
>
>
> void Reaction ( vtkObject* caller, long unsigned int eventId, void* 
> clientData, void* callData )
>     {
>     // do some stuff with the class' private
>     }
>
>
> private:
>     vtkRenderWindow*    RenderWin;
>
> };
>
> --------------------------------------------------------
>
>
> I also tried to use :
> vtkCBSynchroCam->SetCallback( Reaction );
> (without the A::)
> but I still have the same error.
>
>
> I would greatly appreciate if someone could take two minutes to help me 
> with that.
>
> Thanks !
>
> -- 
> Antonin
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 





More information about the vtkusers mailing list