本文整理汇总了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);
}
示例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");
}
示例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;
}
}