本文整理汇总了C++中TypeInfo::isA方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeInfo::isA方法的具体用法?C++ TypeInfo::isA怎么用?C++ TypeInfo::isA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeInfo
的用法示例。
在下文中一共展示了TypeInfo::isA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleOperation
Router::RouterResult EntityRouter::handleOperation(const RootOperation& op)
{
assert(op->getFrom() == m_entity->getId());
const std::vector<Root>& args = op->getArgs();
// note it's important we match exactly on sight here, and not deried ops
// like appearance and disappearance
if (op->getClassNo() == SIGHT_NO) {
assert(!args.empty());
RootOperation sop = smart_dynamic_cast<RootOperation>(args.front());
if (sop.isValid()) return handleSightOp(sop);
}
if (op->getClassNo() == SOUND_NO) {
assert(!args.empty());
if (args.front()->getClassNo() == TALK_NO)
{
RootOperation talk = smart_dynamic_cast<RootOperation>(args.front());
m_entity->onTalk(talk);
return HANDLED;
}
TypeInfo* ty = typeService()->getTypeForAtlas(args.front());
if (!ty->isBound()) {
new TypeBoundRedispatch(m_entity->getView()->getAvatar()->getConnection(), op, ty);
return WILL_REDISPATCH;
}
if (ty->isA(typeService()->getTypeByName("action")))
{
// sound of action
RootOperation act = smart_dynamic_cast<RootOperation>(args.front());
m_entity->onSoundAction(act);
return HANDLED;
}
warning() << "entity " << m_entity->getId() << " emitted sound with strange argument: " << op;
// other sounds !
}
return IGNORED;
}