Stream‐like object that only records how many bytes a serialization would write.

Synopsis

Declared in <serialize.h>

class SizeComputer;

Member Functions

Name

Description

SizeComputer [constructor]

Construct a size computer with a zero byte count.

seek

Pretend this many bytes are written, without specifying them.

size

Return the total number of bytes recorded so far.

write

Add the size of a byte span to the running count.

operator<<

Add the serialized size of an object to the running count.

Protected Data Members

Name

Description

m_size

Running count of bytes that would be written.

Non-Member Functions

Name

Description

WriteCompactSize

Account for a CompactSize encoding when computing a serialized size.

WriteVarInt

Account for a VarInt encoding when computing a serialized size.

Created with MrDocs