本文整理汇总了C++中BinaryWriter类的典型用法代码示例。如果您正苦于以下问题:C++ BinaryWriter类的具体用法?C++ BinaryWriter怎么用?C++ BinaryWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BinaryWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
void RTMFPWriter::flush(BinaryWriter& writer,UInt64 stage,UInt8 flags,bool header,const UInt8* data,UInt16 size) {
if(_stageAck==0 && header)
flags |= MESSAGE_HEADER;
if(size==0)
flags |= MESSAGE_ABANDONMENT;
if(state()==CLOSED && _messages.size()==1) // On LAST message
flags |= MESSAGE_END;
// TRACE("RTMFPWriter ",id," stage ",stage);
writer.write8(flags);
if(header) {
writer.write7BitLongValue(id);
writer.write7BitLongValue(stage);
writer.write7BitLongValue(stage-_stageAck);
// signature
if(_stageAck==0) {
writer.writeString8(signature);
// No write this in the case where it's a new flow!
if(flowId>0) {
writer.write8(1+Util::Get7BitValueSize(flowId)); // following size
writer.write8(0x0a); // Unknown!
writer.write7BitLongValue(flowId);
}
writer.write8(0); // marker of end for this part
}
}
if (size > 0)
writer.writeRaw(data, size);
}
示例2: serializeDbValue
void TxIOPair::serializeDbValue(BinaryWriter& bw) const
{
uint8_t sersize = 17; //bit pack + amount + txout key
if (hasTxIn())
sersize += 8;
bw.put_uint8_t(sersize);
BitPacker<uint8_t> bitpacker;
bitpacker.putBit(isTxOutFromSelf_);
bitpacker.putBit(isFromCoinbase_);
bitpacker.putBit(hasTxIn());
bitpacker.putBit(isMultisig_);
bitpacker.putBit(isUTXO_);
bitpacker.putBit(isFromSameBlock_);
bw.put_BitPacker(bitpacker);
bw.put_uint64_t(amount_);
bw.put_BinaryData(getDBKeyOfOutput());
if (hasTxIn())
{
bw.put_BinaryData(getDBKeyOfInput());
}
}
示例3: writeResponseHeader
void FlowWriter::writeResponseHeader(BinaryWriter& writer,const string& name,double callbackHandle) {
writer.write8(Message::AMF_WITH_HANDLER);writer.write32(0);
writer.write8(AMF_STRING);writer.writeString16(name);
writer.write8(AMF_NUMBER); // marker
writer << callbackHandle;
writer.write8(AMF_NULL);
}
示例4: Save
bool Model_IO::Save(BinaryWriter& writer, const achar* path)
{
// ヘッダー
uint8_t header[] = "MDL";
for (int32_t i = 0; i < 4; i++)
{
writer.Push(header[i]);
}
// バージョン
writer.Push(0);
// ボーン
SaveDeformer(Deformer_, writer, path);
// メッシュ
SaveMeshes(Meshes, writer, path);
// アニメーション
writer.Push((int32_t)AnimationSources.size());
for (int32_t i = 0; i < AnimationSources.size(); i++)
{
SaveAnimationSource(AnimationSources[i], writer, path);
}
writer.Push((int32_t) AnimationClips.size());
for (int32_t i = 0; i <AnimationClips.size(); i++)
{
SaveAnimationClip(AnimationClips[i], writer, path);
}
return true;
}
示例5: serializeAllOutpoints
BinaryData TransactionVerifier::serializeAllOutpoints() const
{
BinaryWriter bw;
for (unsigned i = 0; i < theTx_.txins_.size(); i++)
bw.put_BinaryDataRef(getOutpoint(i));
return bw.getData();
}
示例6: serialize
void ProgressData::serialize(BinaryWriter& bw) const
{
bw.put_uint8_t(PROGRESSDATA_CODE);
bw.put_uint8_t((uint8_t)phase_);
bw.put_double(progress_);
bw.put_uint32_t(time_);
bw.put_uint32_t(numericProgress_);
}
示例7: serialize
BinaryData StackItem_OpCode::serialize(void) const
{
BinaryWriter bw;
bw.put_uint32_t(id_);
bw.put_uint8_t(STACKITEM_OPCODE_PREFIX);
bw.put_uint8_t(opcode_);
return bw.getData();
}
示例8: SaveAnimationSource
void Model_IO::SaveAnimationSource(AnimationSource& as, BinaryWriter& writer, const achar* path)
{
writer.Push(as.Name);
writer.Push((int32_t) as.KeyframeAnimations.size());
for (int32_t i = 0; i < as.KeyframeAnimations.size(); i++)
{
SaveKeyframeAnimation(as.KeyframeAnimations[i], writer, path);
}
}
示例9: WriteString
unsigned char WriteString(TrieNode* node, BinaryWriter& writer) {
if(node->Parent == rootNode_) {
writer.WriteByte(node->Value);
return node->Value;
}
else {
unsigned char first = WriteString(node->Parent, writer);
writer.WriteByte(node->Value);
return first;
}
}
示例10: writeRawPacket
void PositionPacket::writeRawPacket(BinaryWriter& stream) const {
stream.write(reinterpret_cast<const char*>(&mNotUsed1), sizeof(mNotUsed1));
stream << mGyro1 << mTemp1 << mAccel1X << mAccel1Y << mGyro2 << mTemp2 <<
mAccel2X << mAccel2Y << mGyro3 << mTemp3 << mAccel3X << mAccel3Y;
stream.write(reinterpret_cast<const char*>(&mNotUsed2), sizeof(mNotUsed2));
stream << mGPSTimestamp;
stream.write(reinterpret_cast<const char*>(&mNotUsed3), sizeof(mNotUsed3));
stream.write(reinterpret_cast<const char*>(&mNMEASentence),
sizeof(mNMEASentence));
stream.write(reinterpret_cast<const char*>(&mNotUsed4), sizeof(mNotUsed4));
}
示例11: serializeAllSequences
BinaryData TransactionVerifier::serializeAllSequences() const
{
BinaryWriter bw;
for (auto& txinOnS : theTx_.txins_)
{
auto sequenceOffset = txinOnS.first + txinOnS.second - 4;
BinaryDataRef bdr(theTx_.data_ + sequenceOffset, 4);
bw.put_BinaryDataRef(bdr);
}
return bw.getData();
}
示例12: SaveDeformer
void Model_IO::SaveDeformer(Deformer& deformer, BinaryWriter& writer, const achar* path)
{
writer.Push((int32_t)deformer.Bones.size());
for (auto i = 0; i < deformer.Bones.size(); i++)
{
auto& bone = deformer.Bones[i];
writer.Push(deformer.Bones[i].Name);
writer.Push(deformer.Bones[i].ParentBoneIndex);
writer.Push((int32_t)deformer.Bones[i].RotationType);
writer.Push(deformer.Bones[i].LocalMat);
}
}
示例13:
const string& Arguments::serialize()
{
if (argStr_.size() != 0)
return argStr_;
BinaryWriter bw;
for (auto& arg : argData_)
arg->serialize(bw);
auto& bdser = bw.getData();
argStr_ = bdser.toHexStr();
return argStr_;
}
示例14: SaveMesh
void GeoSaver::SaveMesh(Scene3DMesh *mesh, BinaryWriter &bw)
{
bw.Write(mesh ->id);
bw.Write(mesh ->name);
for (int i = 0; i < 16; i++)
bw.Write(mesh->m_worldInverseMatrix.a[i]);
bw.Write((int)mesh ->meshParts.size());
for (int i = 0; i < (int)mesh ->meshParts.size(); i++)
SaveMeshPart(mesh ->meshParts[i], bw);
SaveProperties(mesh, bw);
}
示例15: sizeof
BinaryWriter& AFXAPI operator<<(BinaryWriter& wr, const IPAddress& ha) {
wr << (short)ha.get_AddressFamily();
switch ((int)ha.get_AddressFamily()) {
case AF_INET:
wr.Write(&ha.m_sin.sin_addr, sizeof(ha.m_sin.sin_addr));
break;
case AF_INET6:
wr.Write(&ha.m_sin6.sin6_addr, sizeof(ha.m_sin6.sin6_addr));
break;
default:
wr.Write(&ha.m_sockaddr, sizeof(ha.m_sockaddr)); //!!! unknown size
break;
}
return wr;
}