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

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

#include <streams.h>

Public Member Functions

 VectorWriter (std::vector< uint8_t > &vchDataIn, size_t nPosIn)
 
template<typename... Args>
 VectorWriter (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 >
VectorWriteroperator<< (const T &obj)
 

Private Attributes

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 31 of file streams.h.

Constructor & Destructor Documentation

◆ VectorWriter() [1/2]

VectorWriter::VectorWriter ( std::vector< uint8_t > &  vchDataIn,
size_t  nPosIn 
)
inline
Parameters
[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 39 of file streams.h.

◆ VectorWriter() [2/2]

template<typename... Args>
VectorWriter::VectorWriter ( 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 50 of file streams.h.

Here is the call graph for this function:

Member Function Documentation

◆ operator<<()

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

Definition at line 66 of file streams.h.

Here is the call graph for this function:

◆ write()

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

Definition at line 54 of file streams.h.

Here is the call graph for this function:

Member Data Documentation

◆ nPos

size_t VectorWriter::nPos
private

Definition at line 73 of file streams.h.

◆ vchData

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

Definition at line 72 of file streams.h.


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