本文整理汇总了C++中atlas::message::Element::isInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::isInt方法的具体用法?C++ Element::isInt怎么用?C++ Element::isInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atlas::message::Element
的用法示例。
在下文中一共展示了Element::isInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processServer
void ServerInfo::processServer(const RootEntity &svr)
{
Atlas::Message::Element element;
if (!svr->copyAttr("ruleset", element) && element.isString()) {
_ruleset = element.String();
} else {
return;
}
_name = svr->getName();
if (!svr->copyAttr("clients", element) && element.isInt()) {
_clients = (int)element.Int();
} else {
return;
}
if (!svr->copyAttr("server", element) && element.isString()) {
_server = element.String();
} else {
return;
}
if (!svr->copyAttr("uptime", element) && element.isFloat()) {
_uptime = element.Float();
} else {
return;
}
m_status = VALID;
if (!svr->copyAttr("entities", element) && element.isInt()) {
_entities = element.Int();
}
if (!svr->copyAttr("version", element) && element.isString()) {
m_version = element.String();
}
if (!svr->copyAttr("builddate", element) && element.isString()) {
m_buildDate = element.String();
}
if (!svr->copyAttr("assets", element) && element.isList()) {
for (auto& url : element.List()) {
if (url.isString()) {
m_assets.emplace_back(url.String());
}
}
}
}
示例2: test_sequence
void Tasktest::test_sequence()
{
m_task->nextTick(1.5);
Atlas::Message::Element val;
m_task->getAttr("foo", val);
assert(val.isNone());
m_task->setAttr("foo", 1);
m_task->getAttr("foo", val);
assert(val.isInt());
assert(!m_task->obsolete());
OpVector res;
assert(res.empty());
Atlas::Objects::Operation::Generic c;
c->setParents(std::list<std::string>(1, "generic"));
m_task->initTask(c, res);
Operation op;
m_task->operation(op, res);
m_task->irrelevant();
assert(m_task->obsolete());
}
示例3: DeleteOperation
void World::DeleteOperation(const Operation & op, OpVector & res)
{
//A delete operation with an argument sent to the world indicates that an
//entity should be deleted forcefully (whereas a Delete operation sent to
//an entity directly, which is the norm, always can be overridden by the entity).
auto& args = op->getArgs();
if (!args.empty()) {
auto arg = args.front();
if (!arg->isDefaultId()) {
auto entity = BaseWorld::instance().getEntity(arg->getId());
if (entity) {
if (entity == this) {
Atlas::Message::Element force;
if (arg->copyAttr("force", force) == 0 && force.isInt() && force.asInt() == 1) {
clearWorld(res);
} else {
log(ERROR, "World::DeleteOperation cannot delete world unless 'force' flag is set.");
}
} else {
BaseWorld::instance().delEntity(entity.get());
}
} else {
log(NOTICE, String::compose("Tried to delete non existent entity with id %1", arg->getId()));
}
} else {
log(ERROR, "World::DeleteOperation got delete op with arg but no id.");
}
} else {
assert(m_location.m_parent == nullptr);
// Deleting has no effect.
}
}
示例4: processServer
void ServerInfo::processServer(const RootEntity &svr)
{
Atlas::Message::Element element;
if (!svr->copyAttr("ruleset", element) && element.isString()) {
_ruleset = element.asString();
} else {
return;
}
_name = svr->getName();
if (!svr->copyAttr("clients", element) && element.isInt()) {
_clients = element.asInt();
} else {
return;
}
if (!svr->copyAttr("server", element) && element.isString()) {
_server = element.asString();
} else {
return;
}
if (!svr->copyAttr("uptime", element) && element.isFloat()) {
_uptime = element.asFloat();
} else {
return;
}
m_status = VALID;
if (!svr->copyAttr("entities", element) && element.isInt()) {
_entities = element.asInt();
}
if (!svr->copyAttr("version", element) && element.isString()) {
m_version = element.asString();
}
if (!svr->copyAttr("builddate", element) && element.isString()) {
m_buildDate = element.asString();
}
}
示例5: main
int main()
{
int ret = 0;
Operation op;
{
Task * task;
OpVector res;
if (0) {
task->TickOperation(op, res);
}
}
Entity ent1("1", 1), ent2("2", 2);
Character chr("3", 3);
{
Fell fell(chr, ent1, ent2);
fell.nextTick(1.5);
Atlas::Message::Element val;
fell.getAttr("foo", val);
assert(val.isNone());
fell.setAttr("foo", 1);
fell.getAttr("foo", val);
assert(val.isInt());
assert(!fell.obsolete());
OpVector res;
assert(res.empty());
Atlas::Objects::Operation::Generic c;
fell.initTask(c, res);
assert(!res.empty());
fell.TickOperation(op, res);
fell.irrelevant();
assert(fell.obsolete());
}
return ret;
}
示例6: wrap
Py::Object CyPy_Element::wrap(Atlas::Message::Element value)
{
if (value.isNone()) {
return Py::None();
} else if (value.isString()) {
return Py::String(value.String());
} else if (value.isInt()) {
return Py::Long(value.Int());
} else if (value.isFloat()) {
return Py::Float(value.Float());
} else if (value.isList()) {
return CyPy_ElementList::wrap(value.List());
} else {
return CyPy_ElementMap::wrap(value.Map());
}
}
示例7:
void Property<int>::set(const Atlas::Message::Element & e)
{
if (e.isInt()) {
this->m_data = e.asInt();
}
}