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


C++ ParameterList::AddValue方法代码示例

本文整理汇总了C++中ParameterList::AddValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::AddValue方法的具体用法?C++ ParameterList::AddValue怎么用?C++ ParameterList::AddValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParameterList的用法示例。


在下文中一共展示了ParameterList::AddValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddSense

void VisionPerceptor::AddSense(oxygen::Predicate& predicate, ObjectData& od) const
{
    ParameterList& element = predicate.parameter.AddList();
    element.AddValue(od.mObj->GetPerceptName());

//    if(od.mObj->GetPerceptName() == "Player")
    if(od.mObj->GetPerceptName() == "P")
        {
            ParameterList player;
            player.AddValue(std::string("team"));
            player.AddValue
                (std::string
                 (od.mObj->GetPerceptName(ObjectState::PT_Player)
                  )
                 );
            element.AddValue(player);
        }

    if (!od.mObj->GetID().empty())
        {
            ParameterList id;
            id.AddValue(std::string("id"));
            id.AddValue(od.mObj->GetID());
            element.AddValue(id);
        }

    ParameterList& position = element.AddList();
    position.AddValue(std::string("pol"));
    position.AddValue(od.mDist);
    position.AddValue(od.mTheta);
    position.AddValue(od.mPhi);
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:32,代码来源:visionperceptor.cpp

示例2: SetParams

void Capsule::SetParams(float radius, float length)
{
    ParameterList parameter;
    parameter.AddValue(radius);
    parameter.AddValue(length);

    Load("StdCapsule",parameter);

    mRadius = radius;
    mLength = length;
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:11,代码来源:capsule.cpp

示例3: switch

void
getParameterList(VALUE args, ParameterList& params)
{
    int argc = RARRAY_LEN(args);

    for (int i = 0; i<argc; ++i)
    {
        VALUE argument = rb_ary_entry(args, i);
        boost::any var;

        // do type conversion
        switch (TYPE(argument))
        {
        case T_STRING:
        {
            char *c = STR2CSTR(argument);
            var = c;
            //printf("string: '%s'\n",boost::any_cast<char*>(var));
        }
        break;
        case T_FIXNUM:
        {
            int i = FIX2INT(argument);
            var = i;
            //printf("int: '%d'\n", boost::any_cast<int>(var));
        }
        break;
        case T_FLOAT:
        {
            float f = (float)NUM2DBL(argument);
            var = f;
            //printf("float: '%f'\n", boost::any_cast<float>(var));
        }
        break;
        case T_TRUE:
        {
            var = true;
            //printf("bool: 'true'\n");
        }
        break;
        case T_FALSE:
        {
            var = false;
            //printf("bool: 'false'\n");
        }
        break;
        }

        params.AddValue(var);
    }
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:51,代码来源:scriptserver.cpp

示例4: while

void
SexpParser::SexpToList(ParameterList& arguments, const sexp_t* const sexp)
{
    sexp_t* s = const_cast<sexp_t*>(sexp);
    while (s != 0)
    {
        if (s->ty == SEXP_VALUE)
        {
            arguments.AddValue(string(s->val));
        } else {
            ParameterList& elem = arguments.AddList();
            SexpToList(elem,s->list);
        }
        s = s->next;
    }
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:16,代码来源:sexpparser.cpp

示例5:

void
RestrictedVisionPerceptor::AddSense(Predicate& predicate,
                                    boost::shared_ptr<BaseNode> node,
                                    TObjectList& objectList) const
{
    if (objectList.empty())
    {
        return;
    }

    boost::shared_ptr<AgentAspect> agent_aspect =
        dynamic_pointer_cast<AgentAspect>(node);
    if (agent_aspect != 0)
    {
        boost::shared_ptr<AgentAspect> aspect =
            agent_aspect->FindParentSupportingClass<AgentAspect>().lock();
        if (aspect != 0)
        {
            agent_aspect = aspect;
        }

        boost::shared_ptr<AgentState> agent_state = static_pointer_cast<AgentState>
            (agent_aspect->GetChildOfClass("AgentState",true));
        if (agent_state.get() == 0 ||
            (agent_state->GetPerceptName(ObjectState::PT_Player).empty())
           )
        {
            return;
        }

        ParameterList& element = predicate.parameter.AddList();
        element.AddValue(std::string("P"));

        ParameterList player;
        player.AddValue(std::string("team"));
        player.AddValue
            (std::string
                (agent_state->GetPerceptName(ObjectState::PT_Player)
                )
            );
        element.AddValue(player);

        if (! agent_state->GetID().empty())
        {
            ParameterList id;
            id.AddValue(std::string("id"));
            id.AddValue(agent_state->GetID());
            element.AddValue(id);
        }

        for (TObjectList::iterator j = objectList.begin();
            j != objectList.end(); ++j)
        {
            ObjectData& od = (*j);

            if (!od.mObj->GetID().empty())
            {
                ParameterList id;
                id.AddValue(od.mObj->GetID());

                ParameterList position;
                position.AddValue(std::string("pol"));
                position.AddValue(od.mDist);
                position.AddValue(od.mTheta);
                position.AddValue(od.mPhi);
                id.AddValue(position);

                element.AddValue(id);
            }
        }
    }
    else
    {
        for (TObjectList::iterator j = objectList.begin();
            j != objectList.end(); ++j)
        {
            ObjectData& od = (*j);
            ParameterList& element = predicate.parameter.AddList();
            element.AddValue(od.mObj->GetPerceptName());

            ParameterList& position = element.AddList();
            position.AddValue(std::string("pol"));
            position.AddValue(od.mDist);
            position.AddValue(od.mTheta);
            position.AddValue(od.mPhi);
        }
    }
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:88,代码来源:restrictedvisionperceptor.cpp


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