[ITK-users] CStyleCommand callback function as object member

Matt McCormick matt.mccormick at kitware.com
Mon Mar 31 12:01:14 EDT 2014


Hi,

Since methods have an implicit "this *" argument [1], it will not work.

HTH,
Matt

[1] http://stackoverflow.com/questions/2420346/c-api-function-callbacks-into-c-member-function-code

On Mon, Mar 31, 2014 at 11:36 AM, wydesenej <wydesenej at gmail.com> wrote:
> Hello,
>
> it is possible to set CStyleCommand callback function to member function of
> some object?
>
> class A
> {
> public:
>
> A::A()
> {
>     typedef itk::CStyleCommand         commandType;
>     typedef commandType::Pointer       commandPointer;
>
>     itk::CStyleCommand::FunctionPointer p;
>     p = ITKEventCallback; // this gives me error...
>
>     commandPointer itkCallback= commandType::New();
>     itkCallback->SetCallback(p);
> }
>
> private:
>     void ITKEventCallback(itk::Object *caller,const itk::EventObject&
> event,void *clientData); // callback function
> };
>
> Thanks!
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list