Commit 2d33628e authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline

Refactor CtControl::_increment_image_cnt for easier code readability

parent 0e5b8377
......@@ -1089,25 +1089,21 @@ long CtControl::_increment_image_cnt(Data& aData,
long image_cnt,SortedDataType& cnt)
{
long expectedImageCnt = image_cnt + 1;
if(aData.frameNumber == expectedImageCnt)
if(aData.frameNumber != expectedImageCnt)
{
while(!cnt.empty())
{
SortedDataType::iterator i = cnt.begin();
long nextExpectedImageCnt = expectedImageCnt + 1;
if(nextExpectedImageCnt == i->frameNumber)
{
expectedImageCnt = nextExpectedImageCnt;
cnt.erase(i);
}
else
break;
}
return expectedImageCnt;
cnt.insert(aData);
return image_cnt;
}
else
cnt.insert(aData);
return image_cnt;
while(!cnt.empty())
{
SortedDataType::iterator i = cnt.begin();
if(i->frameNumber != expectedImageCnt + 1)
break;
expectedImageCnt = i->frameNumber;
cnt.erase(i);
}
return expectedImageCnt;
}
/** @brief inc the save counter.
......
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