当前位置: 首页>>代码示例>>C++>>正文


C++ Predicate::begin方法代码示例

本文整理汇总了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>();
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:32,代码来源:hingeeffector.cpp

示例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));

}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:28,代码来源:sayeffector.cpp

示例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));
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:25,代码来源:sceneeffector.cpp

示例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));
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:26,代码来源:pantilteffector.cpp

示例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));
}
开发者ID:unfabio,项目名称:furosimspark,代码行数:18,代码来源:initeffector.cpp

示例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));
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:20,代码来源:driveeffector.cpp

示例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>();
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:38,代码来源:kickeffector.cpp

示例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));
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:38,代码来源:beameffector.cpp

示例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));
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:24,代码来源:hmdpeffector.cpp


注:本文中的Predicate::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。