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


C++ Element::Ptr方法代码示例

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


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

示例1: test_EntityProperty

void ProvidersTest::test_EntityProperty()
{

    Atlas::Message::Element value;

    auto provider = CreateProvider( { "entity" });

    provider->value(value, QueryContext { *m_b1 });
    assert(value.Ptr() == m_b1);

    //entity.type
    provider = CreateProvider( { "entity", "type" });
    provider->value(value, QueryContext { *m_b1 });
    assert(value.Ptr() == m_barrelType);

    //entity.id
    provider = CreateProvider( { "entity", "id" });
    provider->value(value, QueryContext { *m_b1 });
    assert(value.Int() == 1);

    //entity.mass
    provider = CreateProvider( { "entity", "mass" });
    provider->value(value, QueryContext { *m_b1 });
    assert(value.Int() == 30);

    //entity.burn_speed
    provider = CreateProvider( { "entity", "burn_speed" });
    provider->value(value, QueryContext { *m_b1 });
    assert(value.Float() == 0.3);
}
开发者ID:danniellecandys,项目名称:cyphesis,代码行数:30,代码来源:EntityFilterProviderstest.cpp

示例2: test_OutfitProviders

void ProvidersTest::test_OutfitProviders()
{
    Atlas::Message::Element value;
    //Check if we get the right entity in outfit query
    auto provider = CreateProvider( { "entity", "outfit", "hands" });
    provider->value(value, QueryContext { *m_ch1 });
    assert(value.Ptr() == m_glovesEntity);

    //Check for outfit's property query
    provider = CreateProvider( { "entity", "outfit", "hands", "color" });
    provider->value(value, QueryContext { *m_ch1 });
    assert(value.String() == "brown");

    //Check if we get the right entity in nested outfit query
    provider = CreateProvider(
            { "entity", "outfit", "hands", "outfit", "thumb" });
    provider->value(value, QueryContext { *m_ch1 });
    assert(value.Ptr() == m_cloth);

    //Check for nested outfit's property
    provider = CreateProvider( { "entity", "outfit", "hands", "outfit", "thumb",
            "color" });
    provider->value(value, QueryContext { *m_ch1 });
    assert(value.String() == "green");
}
开发者ID:danniellecandys,项目名称:cyphesis,代码行数:25,代码来源:EntityFilterProviderstest.cpp

示例3: value

void ContainsRecursiveFunctionProvider::value(Atlas::Message::Element& value,
                                              const QueryContext& context) const
{
    Atlas::Message::Element container;
    m_consumer->value(container, context);
    if (container.isPtr()) {
        value = checkContainer((LocatedEntitySet*)container.Ptr());
    }
    else{
        value = false;
    }
}
开发者ID:LawrenceWeng,项目名称:cyphesis,代码行数:12,代码来源:Providers.cpp


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