|
-
September 8th, 2020, 04:18 AM
#1
template deduction
Hello,
I have following piece of template code,
Code:
void PredictionRaster::AutoSetSetIllegalValueIfRequired(PRED_DATA_TYPE pdt, AIBaseRaster *pRaster)
{
ASSERT(pRaster);
if (!pRaster)
{
return;
}
switch (pdt)
{
case PR_DATA_UCHAR_OVERRIDEFILL:
{
const unsigned char MAX_LOSS = 200;
SetIllegalValue(pRaster, MAX_LOSS);
}
break;
case PR_DATA_USHORT_OVERRIDEFILL:
{
const unsigned short NO_BEAM_INDEX = USHRT_MAX;
SetIllegalValue(pRaster, NO_BEAM_INDEX);
}
case PR_DATA_UCHAR_METRICS_OVERRIDEFILL:
SetIllegalValue<unsigned char>(pRaster, 0);
break;
}
}
template<typename RastType> void PredictionRaster::SetIllegalValue(AIBaseRaster *pRaster, RastType illegalValue)
{
auto pTypedRaster = dynamic_cast<RasterT<RastType>*>(pRaster);
if (pTypedRaster)
{
pTypedRaster->OverrideIllegalValue(illegalValue);
}
}
I dont know how the template param in the red coloured line is being used ?
Could you please explain me ? This is some legacy code
I also have another doubt in same area, may be post later once this is resolved
thanks a lot
thanks
Priya
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|