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


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

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

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

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

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

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

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


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