本文整理汇总了C++中ActorPtr::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ActorPtr::isValid方法的具体用法?C++ ActorPtr::isValid怎么用?C++ ActorPtr::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActorPtr
的用法示例。
在下文中一共展示了ActorPtr::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeserializeActor
void ActorSerializer::DeserializeActor(std::istream& stream, std::vector<ActorPtr>& actors)
{
if (!stream)
throw Commons::IOException("Stream is not opened");
ActorPtr curActor;
int32_t curLevel = 0;
BigEndianStreamReader reader(stream);
FileHeaderChunk fileHeader;
ChunkHeader header;
while (!reader.isEOF())
{
header.read(reader);
uint32_t lastOffset = reader.tell();
if (header.getMagic() == FileHeaderChunk::MAGIC)
{
fileHeader.read(reader);
}
else if (header.getMagic() == ActorNameChunk::MAGIC)
{
curActor = ActorPtr(new Actor());
assert(curActor.get());
curActor->m_header.read(reader);
++curLevel;
printf("%d: %s\n", curLevel, curActor->m_header.m_name.data());
}
else if (header.getMagic() == ActorMatrixChunk::MAGIC)
{
assert(curActor.get());
curActor->m_matrix.read(reader);
}
else if (header.getMagic() == ActorPushChunk::MAGIC)
{
assert(curActor.get());
// TODO: push
}
else if (header.getMagic() == ActorPopChunk::MAGIC)
{
assert(curActor.get());
// TODO: pop
--curLevel;
}
else if (header.getMagic() == ActorMaterialChunk::MAGIC)
{
assert(curActor.get());
curActor->m_materials.read(reader);
}
else if (header.getMagic() == ActorModelChunk::MAGIC)
{
assert(curActor.get());
curActor->m_models.read(reader);
}
else if (header.getMagic() == ActorEmptyChunk::MAGIC)
{
assert(curActor.get());
curActor->m_empty.read(reader);
}
else if (header.getMagic() == ActorBBoxChunk::MAGIC)
{
assert(curActor.get());
curActor->m_bbox.read(reader);
}
else if (header.isNULL())
{
if (!curActor.get() || !curActor->isValid())
throw Commons::SerializationException("Actor object is incorrect");
actors.push_back(curActor);
curActor.reset();
}
else
{
std::stringstream ss;
ss << "Unknown chunk: " << header.getMagic() << " at " << reader.tell();
throw Commons::SerializationException(ss.str());
}
uint32_t redSize = reader.tell() - lastOffset;
if (redSize != header.getSize())
{
std::stringstream ss;
ss << "Incorrect chunk size red: required: " << header.getSize() << " current " << redSize;
//throw SerializationException(ss.str()); // TODO: warning
//printf("%s\n", ss.str().data());
}
}
}