本文整理汇总了C++中Predicate::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::begin方法的具体用法?C++ Predicate::begin怎么用?C++ Predicate::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::begin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLog
shared_ptr<ActionObject> HingeEffector::GetActionObject(const Predicate& predicate)
{
for(;;)
{
if (mJoint.get() == 0)
{
break;
}
if (predicate.name != GetPredicate())
{
GetLog()->Error()
<< "ERROR: (HingeEffector) invalid predicate"
<< predicate.name << "\n";
break;
}
Predicate::Iterator iter = predicate.begin();
float velocity;
if (! predicate.AdvanceValue(iter, velocity))
{
GetLog()->Error()
<< "ERROR: (HingeEffector) motor velocity expected\n";
break;
}
return shared_ptr<HingeAction>(new HingeAction(GetPredicate(),velocity));
}
return shared_ptr<ActionObject>();
}
示例2: GetLog
boost::shared_ptr<ActionObject>
SayEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (SayEffector) invalid predicate"
<< predicate.name << "\n";
// some error happened
return boost::shared_ptr<ActionObject>();
}
Predicate::Iterator iter = predicate.begin();
std::string message;
if (! predicate.AdvanceValue(iter, message))
{
GetLog()->Error()
<< "ERROR: (SayEffector) said message expected\n";
// some error happened
return boost::shared_ptr<ActionObject>();
}
// construct the SayAction object
return boost::shared_ptr<SayAction>(new SayAction(GetPredicate(), message));
}
示例3: 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));
}
示例4: GetLog
shared_ptr<ActionObject>
PanTiltEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (PanTiltEffector) invalid predicate"
<< predicate.name << "\n";
return shared_ptr<ActionObject>();
}
Predicate::Iterator iter = predicate.begin();
float pan;
if (! predicate.AdvanceValue(iter, pan))
{
GetLog()->Error() << "ERROR: (PanTiltEffector) 2 float parameters expected\n";
return shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
float tilt;
if (! predicate.AdvanceValue(iter, tilt))
{
GetLog()->Error() << "ERROR: (PanTiltEffector) float parameter expected\n";
return shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
return shared_ptr<ActionObject>(new PanTiltAction(GetPredicate(),pan,tilt));
}
示例5: 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));
}
示例6: 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));
}
示例7: GetLog
shared_ptr<ActionObject>
KickEffector::GetActionObject(const Predicate& predicate)
{
do
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (KickEffector) invalid predicate"
<< predicate.name << "\n";
break;
}
Predicate::Iterator iter = predicate.begin();
float angle;
if (! predicate.AdvanceValue(iter, angle))
{
GetLog()->Error()
<< "ERROR: (KickEffector) kick angle parameter expected\n";
break;
}
float power;
if (! predicate.AdvanceValue(iter, power))
{
GetLog()->Error()
<< "ERROR: (KickEffector) kick power expected\n";
break;
}
// construct the KickAction object
return shared_ptr<KickAction>(new KickAction(GetPredicate(),angle,power));
} while (0);
// some error happened
return shared_ptr<ActionObject>();
}
示例8: GetLog
boost::shared_ptr<ActionObject>
BeamEffector::GetActionObject(const Predicate& predicate)
{
if (predicate.name != GetPredicate())
{
GetLog()->Error() << "ERROR: (BeamEffector) invalid predicate"
<< predicate.name << "\n";
return boost::shared_ptr<ActionObject>();
}
Predicate::Iterator iter = predicate.begin();
float posX;
if (! predicate.AdvanceValue(iter, posX))
{
GetLog()->Error()
<< "ERROR: (BeamEffector) float expected for parameter1\n";
return boost::shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
float posY;
if (! predicate.AdvanceValue(iter, posY))
{
GetLog()->Error()
<< "ERROR: (BeamEffector) float expected for parameter2\n";
return boost::shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
float angle;
if (! predicate.AdvanceValue(iter, angle))
{
GetLog()->Error()
<< "ERROR: (BeamEffector) float expected for parameter3\n";
return boost::shared_ptr<ActionObject>(new ActionObject(GetPredicate()));
}
return boost::shared_ptr<ActionObject>(new BeamAction(GetPredicate(), posX, posY, angle));
}
示例9: 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));
}