Commit 43308d09 authored by Victor Poughon's avatar Victor Poughon

ENH: avoid dynamic_cast if possible (code review !150)

parent d2e711c5
...@@ -2436,19 +2436,18 @@ Application::GetImageBasePixelType(const std::string & key, unsigned int idx) ...@@ -2436,19 +2436,18 @@ Application::GetImageBasePixelType(const std::string & key, unsigned int idx)
#define otbGetParameterImageMacro( Image ) \ #define otbGetParameterImageMacro( Image ) \
Image##Type * Application::GetParameter##Image(std::string parameter) \ Image##Type * Application::GetParameter##Image(std::string parameter) \
{ \ { \
Image##Type::Pointer ret; \
Parameter* param = GetParameterByKey(parameter); \ Parameter* param = GetParameterByKey(parameter); \
InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \ InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \
ComplexInputImageParameter* paramDownC = dynamic_cast<ComplexInputImageParameter*>(param); \
if ( paramDown ) \ if ( paramDown ) \
{ \ { \
ret = paramDown->Get##Image(); \ return paramDown->Get##Image(); \
} \ } \
else if ( paramDownC ) /* Support of ComplexInputImageParameter */ \ ComplexInputImageParameter* paramDownC = dynamic_cast<ComplexInputImageParameter*>(param); \
if ( paramDownC ) \
{ \ { \
ret = paramDownC->Get##Image(); \ return paramDownC->Get##Image(); \
} \ } \
return ret; \ return Image##Type::Pointer(); \
} }
otbGetParameterImageMacro(UInt8Image); otbGetParameterImageMacro(UInt8Image);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment