本文整理汇总了C++中VisualNode::getNumberOfChildNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ VisualNode::getNumberOfChildNodes方法的具体用法?C++ VisualNode::getNumberOfChildNodes怎么用?C++ VisualNode::getNumberOfChildNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualNode
的用法示例。
在下文中一共展示了VisualNode::getNumberOfChildNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: statusChanged
void
SearcherThread::run() {
{
if (!node->isOpen())
return;
t->mutex.lock();
emit statusChanged(false);
unsigned int kids =
node->getNumberOfChildNodes(*t->na, t->curBest, t->stats,
t->c_d, t->a_d);
if (kids == 0 || node->getStatus() == STOP) {
t->mutex.unlock();
updateCanvas();
emit statusChanged(true);
return;
}
std::stack<SearchItem> stck;
stck.push(SearchItem(node,kids));
t->stats.maxDepth =
std::max(static_cast<long unsigned int>(t->stats.maxDepth),
static_cast<long unsigned int>(depth+stck.size()));
VisualNode* sol = NULL;
int nodeCount = 0;
t->stopSearchFlag = false;
while (!stck.empty() && !t->stopSearchFlag) {
if (t->refresh > 0 && nodeCount >= t->refresh) {
node->dirtyUp(*t->na);
updateCanvas();
emit statusChanged(false);
nodeCount = 0;
if (t->refreshPause > 0)
msleep(t->refreshPause);
}
SearchItem& si = stck.top();
si.i++;
if (si.i == si.noOfChildren) {
stck.pop();
} else {
VisualNode* n = si.n->getChild(*t->na,si.i);
if (n->isOpen()) {
if (n->getStatus() == UNDETERMINED)
nodeCount++;
kids = n->getNumberOfChildNodes(*t->na, t->curBest, t->stats,
t->c_d, t->a_d);
if (kids == 0) {
if (n->getStatus() == SOLVED) {
assert(n->hasCopy());
emit solution(n->getWorkingSpace());
n->purge(*t->na);
sol = n;
if (!a)
break;
}
} else {
if ( n->getStatus() != STOP )
stck.push(SearchItem(n,kids));
else if (!a)
break;
t->stats.maxDepth =
std::max(static_cast<long unsigned int>(t->stats.maxDepth),
static_cast<long unsigned int>(depth+stck.size()));
}
}
}
}
node->dirtyUp(*t->na);
t->stopSearchFlag = false;
t->mutex.unlock();
if (sol != NULL) {
t->setCurrentNode(sol,false);
} else {
t->setCurrentNode(node,false);
}
}
updateCanvas();
emit statusChanged(true);
if (t->finishedFlag)
emit searchFinished();
}