本文整理汇总了C++中QNode::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ QNode::parent方法的具体用法?C++ QNode::parent怎么用?C++ QNode::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNode
的用法示例。
在下文中一共展示了QNode::parent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Prune
VNode* DESPOT::Prune(VNode* vnode, int& pruned_action, double& pruned_value) {
vector<State*> empty;
VNode* pruned_v = new VNode(empty, vnode->depth(), NULL,
vnode->edge());
vector<QNode*>& children = vnode->children();
int astar = -1;
double nustar = Globals::NEG_INFTY;
QNode* qstar = NULL;
for (int i = 0; i < children.size(); i++) {
QNode* qnode = children[i];
double nu;
QNode* pruned_q = Prune(qnode, nu);
if (nu > nustar) {
nustar = nu;
astar = qnode->edge();
if (qstar != NULL) {
delete qstar;
}
qstar = pruned_q;
} else {
delete pruned_q;
}
}
if (nustar < vnode->default_move().value) {
nustar = vnode->default_move().value;
astar = vnode->default_move().action;
delete qstar;
} else {
pruned_v->children().push_back(qstar);
qstar->parent(pruned_v);
}
pruned_v->lower_bound(vnode->lower_bound()); // for debugging
pruned_v->upper_bound(vnode->upper_bound());
pruned_action = astar;
pruned_value = nustar;
return pruned_v;
}
示例2: Backup
void AEMS::Backup(VNode* vnode) {
int iter = 0;
logd << "- Backup " << vnode << " at depth " << vnode->depth() << endl;
while (true) {
logd << " Iter " << (iter++) << " " << vnode << endl;
Update(vnode);
logd << " Updated vnode " << vnode << endl;
QNode* parentq = vnode->parent();
if (parentq == NULL)
break;
Update(parentq);
logd << " Updated Q-node to (" << parentq->lower_bound() << ", "
<< parentq->upper_bound() << ")" << endl;
vnode = parentq->parent();
}
logd << "* Backup complete!" << endl;
}
示例3: setValue
void QParameter::setValue(const QVariant &dv)
{
Q_D(QParameter);
if (d->m_value != dv) {
d->setValue(dv);
emit valueChanged();
// In case texture are declared inline
QNode *txt = dv.value<QNode *>();
if (txt != Q_NULLPTR && !txt->parent())
txt->setParent(this);
QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
change->setPropertyName(d->m_name.toUtf8().data());
if (txt != Q_NULLPTR)
change->setValue(QVariant::fromValue(QNode::clone(txt)));
else
change->setValue(d->m_value);
d->notifyObservers(change);
}
}