本文整理汇总了C++中Predicate::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::GetValue方法的具体用法?C++ Predicate::GetValue怎么用?C++ Predicate::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::GetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParameterList
boost::shared_ptr<ActionObject>
SceneEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "(SceneEffector) ERROR: invalid predicate"
<< predicate.name << "\n";
return boost::shared_ptr<ActionObject>();
}
string scene;
if (! predicate.GetValue(predicate.begin(), scene))
{
GetLog()->Error()
<< "ERROR: (SceneEffector) scene filename expected\n";
return boost::shared_ptr<ActionObject>();
};
boost::shared_ptr<ParameterList> parameters(
new ParameterList(predicate.parameter));
parameters->Pop_Front();
return boost::shared_ptr<ActionObject>(
new SceneAction(GetPredicate(), scene, parameters));
}
示例2: GetLog
boost::shared_ptr<ActionObject>
InitEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (InitEffector) invalid predicate"
<< predicate.name << "\n";
return boost::shared_ptr<ActionObject>();
}
std::string name;
predicate.GetValue(predicate.begin(),"teamname",name);
int unum = 0;
predicate.GetValue(predicate.begin(),"unum",unum);
return boost::shared_ptr<ActionObject>(new InitAction(GetPredicate(),name,unum));
}
示例3: 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);
}
示例4: GetLog
boost::shared_ptr<ActionObject>
DriveEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (DriveEffector) invalid predicate"
<< predicate.name << "\n";
return boost::shared_ptr<ActionObject>();
}
Vector3f force;
if (! predicate.GetValue(predicate.begin(), force))
{
GetLog()->Error()
<< "ERROR: (DriveEffector) Vector3f parameter expected\n";
return boost::shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
return boost::shared_ptr<ActionObject>(new DriveAction(GetPredicate(),force));
}
示例5: GetLog
shared_ptr<ActionObject> HMDPEffector::GetActionObject(const Predicate& predicate)
{
//std::cout << " GetActionObject called " << std::endl;
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (HMDPEffector) invalid predicate"
<< predicate.name << "\n";
return shared_ptr<ActionObject>();
}
std::string message;
if (!predicate.GetValue(predicate.begin(), message))
{
GetLog()->Error()
<< "ERROR: (HMDPEffector) Some Problem while receiving the HMDP Message\n";
return shared_ptr<ActionObject>();
};
inMessage = inMessage + message + "\r\n";
//std::cout << inMessage << std::endl;
return shared_ptr<ActionObject>(new HMDPAction(GetPredicate(), inMessage));
}
示例6: 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;
}
}