The workaround was to replace this:

      mitk::SliceNavigationController::ViewDirection viewDirection =
sliceNavigationController->GetViewDirection();

with

      mitk::SliceNavigationController::ViewDirection viewDirection =
const_cast<constmitk::SliceNavigationController*>(sliceNavigationController)->GetViewDirection();


That is, the getter generated by the macro is a const function that returns
an enum, and the other one is a non-const function that returns const
char*. Although C++ allows function overloading with different return types
if only the "const-ness" differs (e.g. for returning const and non-const
iterators), I think the current case is a misuse. ;-)


Miklos


On 30 September 2013 17:02, Miklos Espak <[email protected]> wrote:

> Also, there is a typo in line 157:
>
>     case 3:
>         viewDirectionString = "Orginal";
>
>
> On 30 September 2013 16:53, Clarkson, Matt <[email protected]> wrote:
>
>>  Hi there,
>>
>>  mitk::SliceNavigationController now has
>>
>>  itkGetEnumMacro(ViewDirection, ViewDirection);
>> and
>> const char* GetViewDirection();
>>
>>  which in our code, such as:
>> mitk::SliceNavigationController::ViewDirection viewDirection =
>> sliceNavigationController->GetViewDirection();
>>
>>  results in:
>> error: cannot convert ‘const char*’ to
>> ‘mitk::SliceNavigationController::ViewDirection’ in initialization
>>
>>  I notice that GetViewDirection is not used that often.
>>
>>  *pwd*
>> /Users/mattclarkson/build/MITK
>> Legolas:MITK mattclarkson$ *grep -rl GetViewDirection **
>> Core/Code/Controllers/mitkSliceNavigationController.cpp
>> Core/Code/Controllers/mitkSliceNavigationController.h
>> Modules/InputDevices/WiiMote/mitkWiiMoteVtkCameraController.cpp
>> Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.cpp
>>
>>  and in all cases, its used as an enum? However, I can't see why code in
>> QmitkSlicesInterpolator.cpp works, calling GetViewDirection and assigning
>> it to an Enum, but in our code it does not work.
>>
>>  But it also strikes me that mitk::SliceNavigationController should not
>> have the same method name with two different return types.
>>
>>  Any suggestions on how to fix this? I would rename the one that returns
>> a const char* to GetViewDirectionAsString or similar.
>>
>>  Thanks
>>
>>  Matt
>>
>>
>>
>> ------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
>> from
>> the latest Intel processors and coprocessors. See abstracts and register >
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> mitk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to