本文整理汇总了C++中datastructures::Queue::PopTail方法的典型用法代码示例。如果您正苦于以下问题:C++ Queue::PopTail方法的具体用法?C++ Queue::PopTail怎么用?C++ Queue::PopTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datastructures::Queue
的用法示例。
在下文中一共展示了Queue::PopTail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
currentSum.val=0;
currentSum.time=values[0].time + interval / 2;
timeBoundary = values[0].time + interval;
while (timeBoundary <= endTime)
{
while (dataIndex < values.Size() && values[dataIndex].time <= timeBoundary)
{
currentSum.val += values[dataIndex].val;
dataIndex++;
numSamples++;
}
if (dataCategory==DC_CONTINUOUS)
{
if (dataIndex > 0 &&
dataIndex < values.Size() &&
values[dataIndex-1].time < timeBoundary &&
values[dataIndex].time > timeBoundary)
{
SHValueType interpolatedValue = Interpolate(values[dataIndex-1], values[dataIndex], timeBoundary);
currentSum.val+=interpolatedValue;
numSamples++;
}
if (numSamples > 1)
{
currentSum.val /= numSamples;
}
}
histogram.Push(currentSum, _FILE_AND_LINE_);
currentSum.time=timeBoundary + interval / 2;
timeBoundary += interval;
currentSum.val=0;
numSamples=0;
}
if ( timeClipStart!=0 && histogram.Size()>=1)
{
timeClipStart = histogram.Peek().time+timeClipStart;
if (histogram.PeekTail().time < timeClipStart)
{
histogram.Clear(_FILE_AND_LINE_);
}
else if (histogram.Size()>=2 && histogram.Peek().time < timeClipStart)
{
StatisticsHistory::TimeAndValue tav;
do
{
tav = histogram.Pop();
if (histogram.Peek().time == timeClipStart)
{
break;
}
else if (histogram.Peek().time > timeClipStart)
{
StatisticsHistory::TimeAndValue tav2;
tav2.val = StatisticsHistory::TimeAndValueQueue::Interpolate(tav, histogram.Peek(), timeClipStart);
tav2.time=timeClipStart;
histogram.PushAtHead(tav2, 0, _FILE_AND_LINE_);
break;
}
} while (histogram.Size()>=2);
}
}
if ( timeClipEnd!=0 && histogram.Size()>=1)
{
timeClipEnd = histogram.PeekTail().time-timeClipEnd;
if (histogram.Peek().time > timeClipEnd)
{
histogram.Clear(_FILE_AND_LINE_);
}
else if (histogram.Size()>=2 && histogram.PeekTail().time > timeClipEnd)
{
StatisticsHistory::TimeAndValue tav;
do
{
tav = histogram.PopTail();
if (histogram.PeekTail().time == timeClipEnd)
{
break;
}
else if (histogram.PeekTail().time < timeClipEnd)
{
StatisticsHistory::TimeAndValue tav2;
tav2.val = StatisticsHistory::TimeAndValueQueue::Interpolate(tav, histogram.PeekTail(), timeClipEnd);
tav2.time=timeClipEnd;
histogram.Push(tav2, _FILE_AND_LINE_);
break;
}
} while (histogram.Size()>=2);
}
}
}