本文整理汇总了C++中RootEntity::hasAttrFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ RootEntity::hasAttrFlag方法的具体用法?C++ RootEntity::hasAttrFlag怎么用?C++ RootEntity::hasAttrFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RootEntity
的用法示例。
在下文中一共展示了RootEntity::hasAttrFlag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disappearanceArrived
void Interactive::disappearanceArrived(const Operation & op)
{
if (m_accountId.empty()) {
return;
}
if (m_accountId != op->getTo()) {
// This is an IG op we are monitoring
return;
}
if (op->getArgs().empty()) {
return;
}
RootEntity ent = smart_dynamic_cast<RootEntity>(op->getArgs().front());
if (!ent.isValid()) {
std::cerr << "Got Disappearance of non-entity" << std::endl << std::flush;
return;
}
if (!ent->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
std::cerr << "Got Disappearance of non-string ID" << std::endl << std::flush;
return;
}
const std::string & id = ent->getId();
std::cout << "Disappearance(id: " << id << ")";
if (!ent->hasAttrFlag(Atlas::Objects::Entity::LOC_FLAG)) {
std::cout << std::endl << std::flush;
return;
}
const std::string & loc = ent->getLoc();
std::cout << " in " << loc << std::endl;
if (loc == "lobby") {
std::cout << id << " has logged out." << std::endl;
}
std::cout << std::flush;
}
示例2:
LocatedEntity * CreatorClient::handleMakeResponse(const RootOperation & op,
double create_time)
{
if (op->getArgs().empty()) {
std::cerr << "Arg of reply to make has no args"
<< std::endl << std::flush;
return NULL;
}
RootEntity created = smart_dynamic_cast<RootEntity>(op->getArgs().front());
if (!created.isValid()) {
std::cerr << "Created argument is not an entity"
<< std::endl << std::flush;
return NULL;
}
if (!created->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
std::cerr << "Created entity has no id"
<< std::endl << std::flush;
return NULL;
}
const std::string & created_id = created->getId();
if (created->getParents().empty()) {
std::cerr << "Created entity " << created_id << " has no type"
<< std::endl << std::flush;
return NULL;
}
const std::string & created_type = created->getParents().front();
std::cout << "Created: " << created_type << "(" << created_id << ")"
<< std::endl << std::flush;
LocatedEntity * obj = m_map.updateAdd(created, create_time);
return obj;
}
示例3: assert
LocatedEntity * CharacterClient::sendLook(const Operation & op)
{
OpVector result;
if (sendAndWaitReply(op, result) != 0) {
std::cerr << "No reply to look" << std::endl << std::flush;
return NULL;
}
assert(!result.empty());
const Operation & res = result.front();
if (!res.isValid()) {
std::cerr << "NULL reply to look" << std::endl << std::flush;
return NULL;
}
const std::string & resparent = res->getParent();
if (resparent == "unseen") {
return NULL;
}
if (resparent != "sight") {
std::cerr << "Reply to look is " << resparent << " not sight" << std::endl << std::flush;
return NULL;
}
if (res->getArgs().empty()) {
std::cerr << "Reply to look has no args" << std::endl << std::flush;
return NULL;
}
RootEntity seen = smart_dynamic_cast<RootEntity>(res->getArgs().front());
if (!seen.isValid()) {
std::cerr << "Sight arg is not an entity" << std::endl << std::flush;
return NULL;
}
if (!seen->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
std::cerr << "Looked at entity has no id" << std::endl << std::flush;
return NULL;
}
const std::string & sight_id = seen->getId();
if (seen->hasAttrFlag(Atlas::Objects::PARENT_FLAG)) {
std::cout << "Seen: " << seen->getParent()
<< "(" << sight_id << ")" << std::endl << std::flush;
} else {
std::cout << "Seen: " << sight_id << std::endl << std::flush;
}
LocatedEntity * obj = m_map.updateAdd(seen, res->getSeconds());
return obj;
}
示例4: assert
LocatedEntity * CreatorClient::make(const RootEntity & entity)
{
Create op;
op->setArgs1(entity);
op->setFrom(getId());
op->setTo(getId());
OpVector result;
if (sendAndWaitReply(op, result) != 0) {
std::cerr << "No reply to make" << std::endl << std::flush;
return NULL;
}
assert(!result.empty());
const Operation & res = result.front();
if (!res.isValid()) {
std::cerr << "NULL reply to make" << std::endl << std::flush;
return NULL;
}
if (res->getClassNo() != Atlas::Objects::Operation::SIGHT_NO) {
std::cerr << "Reply to make isn't sight" << std::endl << std::flush;
return NULL;
}
if (res->getArgs().empty()) {
std::cerr << "Reply to make has no args" << std::endl << std::flush;
return NULL;
}
RootOperation arg = smart_dynamic_cast<RootOperation>(res->getArgs().front());
if (!arg.isValid()) {
std::cerr << "Arg of reply to make is not an operation"
<< std::endl << std::flush;
return NULL;
}
if (arg->getClassNo() != Atlas::Objects::Operation::CREATE_NO) {
std::cerr << "Reply to make isn't sight of create"
<< std::endl << std::flush;
return NULL;
}
if (arg->getArgs().empty()) {
std::cerr << "Arg of reply to make has no args"
<< std::endl << std::flush;
return NULL;
}
RootEntity created = smart_dynamic_cast<RootEntity>(arg->getArgs().front());
if (!created.isValid()) {
std::cerr << "Created argument is not an entity"
<< std::endl << std::flush;
return NULL;
}
if (!created->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
std::cerr << "Created entity has no id"
<< std::endl << std::flush;
return NULL;
}
const std::string & created_id = created->getId();
if (created->getParents().empty()) {
std::cerr << "Created entity " << created_id << " has no type"
<< std::endl << std::flush;
return NULL;
}
const std::string & created_type = created->getParents().front();
std::cout << "Created: " << created_type << "(" << created_id << ")"
<< std::endl << std::flush;
LocatedEntity * obj = m_map.updateAdd(created, res->getSeconds());
return obj;
}