本文整理汇总了C++中Create::getSerialno方法的典型用法代码示例。如果您正苦于以下问题:C++ Create::getSerialno方法的具体用法?C++ Create::getSerialno怎么用?C++ Create::getSerialno使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Create
的用法示例。
在下文中一共展示了Create::getSerialno方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processAccountCreate
void ClientConnection::processAccountCreate(const Create& cr)
{
const std::vector<Root>& args = cr->getArgs();
if (args.empty()) {
sendError("missing account in create", cr);
return;
}
// check for duplicate username
AtlasAccount acc = smart_dynamic_cast<AtlasAccount>(args.front());
if (!acc.isValid()) {
sendError("malformed account in create", cr);
return;
}
AccountMap::const_iterator A = m_server->findAccountByUsername(acc->getUsername());
if (A != m_server->m_accounts.end()) {
sendError("duplicate account: " + acc->getUsername(), cr);
return;
}
m_account = std::string("_") + acc->getUsername() + "_123";
acc->setId(m_account);
m_server->m_accounts[m_account] = acc;
Info createInfo;
createInfo->setArgs1(acc);
createInfo->setTo(m_account);
createInfo->setRefno(cr->getSerialno());
send(createInfo);
m_server->joinRoom(m_account, "_lobby");
m_server->resetWorld();
}
示例2: createEntity
void EntityImporterBase::createEntity(const RootEntity & obj, OpVector & res)
{
++mStats.entitiesProcessedCount;
++mStats.entitiesCreateCount;
EventProgress.emit();
m_state = ENTITY_CREATING;
assert(mTreeStack.size() > 1);
std::deque<StackEntry>::reverse_iterator I = mTreeStack.rbegin();
++I;
assert(I != mTreeStack.rend());
const std::string & loc = I->restored_id;
RootEntity create_arg = obj.copy();
create_arg->removeAttrFlag(Atlas::Objects::Entity::CONTAINS_FLAG);
create_arg->removeAttrFlag(Atlas::Objects::Entity::VELOCITY_FLAG);
create_arg->removeAttrFlag(Atlas::Objects::ID_FLAG);
create_arg->setLoc(loc);
//Remove any attribute which references another entity from the Create op.
//This is because the attribute will at this time with certainty refer to the wrong or a non-existing entity.
//The attribute will later on be set through a Set op in sendResolvedEntityReferences().
auto referenceMapEntryI = mEntitiesWithReferenceAttributes.find(obj->getId());
if (referenceMapEntryI != mEntitiesWithReferenceAttributes.end()) {
for (const auto& attributeName : referenceMapEntryI->second) {
create_arg->removeAttr(attributeName);
}
}
Create create;
create->setArgs1(create_arg);
create->setFrom(mAvatarId);
create->setSerialno(newSerialNumber());
mCreateEntityMapping.insert(std::make_pair(create->getSerialno(), obj->getId()));
res.push_back(create);
}
示例3: createEntity
void EntityImporterBase::createEntity(const RootEntity & obj, OpVector & res)
{
++mStats.entitiesProcessedCount;
++mStats.entitiesCreateCount;
EventProgress.emit();
m_state = ENTITY_CREATING;
assert(mTreeStack.size() > 1);
auto I = mTreeStack.rbegin();
++I;
assert(I != mTreeStack.rend());
const std::string & loc = I->restored_id;
RootEntity create_arg = obj.copy();
create_arg->removeAttrFlag(Atlas::Objects::Entity::CONTAINS_FLAG);
create_arg->removeAttrFlag(Atlas::Objects::Entity::VELOCITY_FLAG);
create_arg->removeAttrFlag(Atlas::Objects::ID_FLAG);
create_arg->setLoc(loc);
//Remove any attribute which references another entity from the Create op.
//This is because the attribute will at this time with certainty refer to the wrong or a non-existing entity.
//The attribute will later on be set through a Set op in sendResolvedEntityReferences().
auto referenceMapEntryI = mEntitiesWithReferenceAttributes.find(obj->getId());
if (referenceMapEntryI != mEntitiesWithReferenceAttributes.end()) {
std::set<std::string> resolvedAttributes;
for (const auto& referenceEntry : referenceMapEntryI->second) {
size_t resolvedEntitiesCount = 0;
//Check if all the referenced entities perhaps already have been created.
for (const auto& entityId : referenceEntry.referencedEntities) {
auto resolvedI = mEntityIdMap.find(entityId);
if (resolvedI != mEntityIdMap.end()) {
resolvedEntitiesCount++;
}
}
//If all entities were resolved, we should resolve the property now.
if (resolvedEntitiesCount == referenceEntry.referencedEntities.size()) {
Element element = create_arg->getAttr(referenceEntry.propertyName);
resolveEntityReferences(element);
create_arg->setAttr(referenceEntry.propertyName, element);
resolvedAttributes.insert(referenceEntry.propertyName);
} else {
create_arg->removeAttr(referenceEntry.propertyName);
}
}
//Remove those attributes that were resolved
if (resolvedAttributes.size() == referenceMapEntryI->second.size()) {
//All attributes were resolved, remove the entry completely.
mEntitiesWithReferenceAttributes.erase(referenceMapEntryI);
} else {
//Only remove those entries that were destroyed.
std::vector<ReferencedEntry> copy;
for (auto& referenceEntry : referenceMapEntryI->second) {
if (resolvedAttributes.find(referenceEntry.propertyName) == resolvedAttributes.end()) {
copy.push_back(std::move(referenceEntry));
}
}
referenceMapEntryI->second = std::move(copy);
}
}
Create create;
create->setArgs1(create_arg);
create->setFrom(mAvatarId);
create->setSerialno(newSerialNumber());
mCreateEntityMapping.insert(std::make_pair(create->getSerialno(), obj->getId()));
res.push_back(create);
}