本文整理汇总了C++中Predicate::FindParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::FindParameter方法的具体用法?C++ Predicate::FindParameter怎么用?C++ Predicate::FindParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::FindParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseVision
void SoccerBehavior::ParseVision(const Predicate& predicate)
{
ParseObjectVision(predicate);
// find the PerfectVision data about the object
Predicate::Iterator iter(predicate);
// advance to the section about object 'name'
if (! predicate.FindParameter(iter,"mypos"))
{
return;
}
// read my position
VisionSense sense;
predicate.GetValue(iter,mMyPos);
}
示例2: ParseObjectVision
void SoccerBehavior::ParseObjectVision(const Predicate& predicate)
{
for (
Predicate::Iterator iter(predicate);
iter != iter.end();
++iter
)
{
// extract the element as a parameter list
Predicate::Iterator paramIter = iter;
if (! predicate.DescentList(paramIter))
{
continue;
}
// read the object name
string name;
if (! predicate.GetValue(paramIter,name))
{
continue;
}
// try read the 'id' section
string strId;
if (predicate.GetValue(paramIter,"id", strId))
{
name += strId;
}
// try to lookup the VisionObject
TVisionObjectMap::iterator visiter = mVisionObjectMap.find(name);
if (visiter == mVisionObjectMap.end())
{
continue;
}
VisionObject vo = (*visiter).second;
// find the 'pol' entry in the object's section
Predicate::Iterator polIter = paramIter;
if (! predicate.FindParameter(polIter,"pol"))
{
continue;
}
// read the position vector
VisionSense sense;
if (
(! predicate.AdvanceValue(polIter,sense.distance)) ||
(! predicate.AdvanceValue(polIter,sense.theta)) ||
(! predicate.AdvanceValue(polIter,sense.phi))
)
{
continue;
}
// update the vision map
// cerr << "+++" << endl;
// cerr << "VO " << vo << endl;
// cerr << "D " << sense.distance << endl;
// cerr << "T " << sense.theta << endl;
// cerr << "P " << sense.phi << endl;
// cerr << "---" << endl;
mVisionMap[vo] = sense;
}
}