本文整理汇总了C++中BBuffer::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ BBuffer::serialize方法的具体用法?C++ BBuffer::serialize怎么用?C++ BBuffer::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBuffer
的用法示例。
在下文中一共展示了BBuffer::serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
BINLINE void BMessageHeader::read(BBuffer& bbuf) {
bbuf.setByteOrder(BBIG_ENDIAN);
bool cmpr = bbuf.setCompressInteger(false);
bbuf.serialize(magic);
switch(magic) {
case BMAGIC_BINARY_STREAM:
break;
case BMAGIC_BINARY_STREAM_LE:
magic = BMAGIC_BINARY_STREAM;
bbuf.setByteOrder(BLITTLE_ENDIAN);
break;
default:
throw BException(BExceptionC::CORRUPT, L"Stream must start with BYPS or SPYB");
}
bbuf.serialize(error);
bbuf.serialize(flags);
if (flags & BHEADER_FLAG_BYPS_VERSION) {
bbuf.serialize(bversion);
}
bbuf.serialize(version);
targetId.serialize(bbuf, bversion);
bbuf.serialize(messageId);
bbuf.setCompressInteger(cmpr);
if (bversion >= BHEADER_BYPS_VERSION_WITH_SESSIONID) {
sessionId = BTargetId::readSessionId(bbuf);
}
}
示例2: write
BINLINE void BMessageHeader::write(BBuffer& bbuf) {
bool cmpr = bbuf.setCompressInteger(false);
bbuf.setByteOrder(byteOrder);
bbuf.serialize(magic);
bbuf.serialize(error);
bbuf.serialize(flags);
if (flags & BHEADER_FLAG_BYPS_VERSION) {
bbuf.serialize(bversion);
}
bbuf.serialize(version);
targetId.serialize(bbuf, bversion);
bbuf.serialize(messageId);
bbuf.setCompressInteger(cmpr);
if (bversion >= BHEADER_BYPS_VERSION_WITH_SESSIONID) {
BTargetId::writeSessionId(bbuf, sessionId);
}
}