Bitcoin ABC  0.23.1
P2P Digital Currency
Public Member Functions | Protected Attributes | List of all members
CSizeComputer Class Reference

GetSerializeSize implementations More...

#include <serialize.h>

Public Member Functions

 CSizeComputer (int nVersionIn)
 
void write (const char *psz, size_t _nSize)
 
void seek (size_t _nSize)
 Pretend _nSize bytes are written, without specifying them. More...
 
template<typename T >
CSizeComputeroperator<< (const T &obj)
 
size_t size () const
 
int GetVersion () const
 

Protected Attributes

size_t nSize
 
const int nVersion
 

Detailed Description

GetSerializeSize implementations

Computing the serialized size of objects is done through a special stream object of type CSizeComputer, which only records the number of bytes written to it.

If your Serialize or SerializationOp method has non-trivial overhead for serialization, it may be worthwhile to implement a specialized version for CSizeComputer, which uses the s.seek() method to record bytes that would be written instead.

Definition at line 1102 of file serialize.h.

Constructor & Destructor Documentation

◆ CSizeComputer()

CSizeComputer::CSizeComputer ( int  nVersionIn)
inlineexplicit

Definition at line 1109 of file serialize.h.

Member Function Documentation

◆ GetVersion()

int CSizeComputer::GetVersion ( ) const
inline

Definition at line 1123 of file serialize.h.

◆ operator<<()

template<typename T >
CSizeComputer& CSizeComputer::operator<< ( const T &  obj)
inline

Definition at line 1116 of file serialize.h.

Here is the call graph for this function:

◆ seek()

void CSizeComputer::seek ( size_t  _nSize)
inline

Pretend _nSize bytes are written, without specifying them.

Definition at line 1114 of file serialize.h.

Here is the caller graph for this function:

◆ size()

size_t CSizeComputer::size ( ) const
inline

Definition at line 1121 of file serialize.h.

Here is the caller graph for this function:

◆ write()

void CSizeComputer::write ( const char *  psz,
size_t  _nSize 
)
inline

Definition at line 1111 of file serialize.h.

Member Data Documentation

◆ nSize

size_t CSizeComputer::nSize
protected

Definition at line 1104 of file serialize.h.

◆ nVersion

const int CSizeComputer::nVersion
protected

Definition at line 1106 of file serialize.h.


The documentation for this class was generated from the following file: