本文整理汇总了C++中queue::more方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::more方法的具体用法?C++ queue::more怎么用?C++ queue::more使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类queue
的用法示例。
在下文中一共展示了queue::more方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prime
// Fill the staging area with a minimal chunk of input ranges.
int mergestream::prime()
{
if (dbg & 4)
printf("#entering mergestream::prime()\n");
if (!empty())
return 1;
int brkok = 1; // is it OK to break after the last
// VBOX that was added to the stage?
int needheight = -1; // minimum acceptable height of the
// chunk being constructed on stage
// If the range at the head of any queue is breaking,
// deal with it first.
if (squeue.more() && squeue.current()->breaking())
enqueue(squeue.dequeue());
else if (bfqueue.more() && (bfqueue.current()->breaking() ||
(bfqueue.serialno() < squeue.serialno())))
enqueue(bfqueue.dequeue());
else if (ufqueue.more() && (ufqueue.current()->breaking() ||
(ufqueue.serialno() < squeue.serialno())))
enqueue(ufqueue.dequeue());
else while (squeue.more()) {
// Fill the stage with enough ranges to be a valid chunk.
range *r = squeue.dequeue();
if (r->isvbox()) { // VBOX
if (dbg & 16)
printf("#VBOX: !empty: %d; brkok: %d; vsince: %d\n",
!empty(), brkok, currpage->vsince);
if (!empty() // there's something there
&& brkok
// it's OK to break here
&& currpage->vsince >= 2
// enough stream has gone onto this page
&& rawht() >= needheight
// current need has been satisfied
) {
// the stage already contains enough
// ranges, so this one can wait
r->enqueue();
break;
} else {
if (r->rawht() > 0) {
++currpage->vsince;
brkok = r->brkafter();
}
enqueue(r);
}
} else if (r->isnested() || r->issp()) { // US, SP
if (!empty() && rawht() >= needheight) {
// enough already, wait
r->enqueue();
break;
}
currpage->vsince = 0;
enqueue(r);
if (height() >= needheight)
break;
} else if (r->isneed()) { // NE
if (!empty() && rawht() >= needheight) {
// not currently working on an unsatisfied NEed
r->enqueue();
break;
}
// deal with overlapping NEeds
needheight = rawht() + max(needheight - rawht(), r->needht());
enqueue(r);
} else if (r->forceflush() == NO) {
enqueue(r);
} else if (r->forceflush() == YES) {
currpage->vsince = 0;
if (!empty()) {
// ready or not, r must wait
r->enqueue();
break;
}
enqueue(r);
break;
} else
ERROR "unexpected %s[%s] in prime(), line %d\n",
r->type_name(), r->headstr(), r->lineno() FATAL;
}
return more(); // 0 if nothing was staged
}