[vtkusers] CALLBACK / function pointers ?
Antonin Perrot-Audet
antonin07130 at gmail.com
Thu May 6 16:47:01 EDT 2010
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
More information about the vtkusers
mailing list