Bitcoin ABC  0.29.2
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CVectorWriter Class Reference

Minimal stream for overwriting and/or appending to an existing byte vector. More...

#include <streams.h>

Public Member Functions

 CVectorWriter (int nTypeIn, int nVersionIn, std::vector< uint8_t > &vchDataIn, size_t nPosIn)
 
template<typename... Args>
 CVectorWriter (int nTypeIn, int nVersionIn, std::vector< uint8_t > &vchDataIn, size_t nPosIn, Args &&...args)
 (other params same as above) More...
 
void write (Span< const std::byte > src)
 
template<typename T >
CVectorWriteroperator<< (const T &obj)
 
int GetVersion () const
 
int GetType () const
 
void seek (size_t nSize)
 

Private Attributes

const int nType
 
const int nVersion
 
std::vector< uint8_t > & vchData
 
size_t nPos
 

Detailed Description

Minimal stream for overwriting and/or appending to an existing byte vector.

The referenced vector will grow as necessary.

Definition at line 65 of file streams.h.

Constructor & Destructor Documentation

◆ CVectorWriter() [1/2]

CVectorWriter::CVectorWriter ( int  nTypeIn,
int  nVersionIn,
std::vector< uint8_t > &  vchDataIn,
size_t  nPosIn 
)
inline
Parameters
[in]nTypeInSerialization Type
[in]nVersionInSerialization Version (including any flags)
[in]vchDataInReferenced byte vector to overwrite/append
[in]nPosInStarting position. Vector index where writes should start. The vector will initially grow as necessary to max(nPosIn, vec.size()). So to append, use vec.size().

Definition at line 75 of file streams.h.

◆ CVectorWriter() [2/2]

template<typename... Args>
CVectorWriter::CVectorWriter ( int  nTypeIn,
int  nVersionIn,
std::vector< uint8_t > &  vchDataIn,
size_t  nPosIn,
Args &&...  args 
)
inline

(other params same as above)

Parameters
[in]argsA list of items to serialize starting at nPosIn.

Definition at line 88 of file streams.h.

Here is the call graph for this function:

Member Function Documentation

◆ GetType()

int CVectorWriter::GetType ( ) const
inline

Definition at line 111 of file streams.h.

◆ GetVersion()

int CVectorWriter::GetVersion ( ) const
inline

Definition at line 110 of file streams.h.

◆ operator<<()

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

Definition at line 105 of file streams.h.

Here is the call graph for this function:

◆ seek()

void CVectorWriter::seek ( size_t  nSize)
inline

Definition at line 112 of file streams.h.

◆ write()

void CVectorWriter::write ( Span< const std::byte >  src)
inline

Definition at line 93 of file streams.h.

Here is the call graph for this function:

Member Data Documentation

◆ nPos

size_t CVectorWriter::nPos
private

Definition at line 123 of file streams.h.

◆ nType

const int CVectorWriter::nType
private

Definition at line 120 of file streams.h.

◆ nVersion

const int CVectorWriter::nVersion
private

Definition at line 121 of file streams.h.

◆ vchData

std::vector<uint8_t>& CVectorWriter::vchData
private

Definition at line 122 of file streams.h.


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