Bitcoin ABC  0.28.12
P2P Digital Currency
Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
CDataStream Class Reference

Double ended buffer combining vector and stream-like interfaces. More...

#include <streams.h>

Public Types

typedef vector_type::allocator_type allocator_type
 
typedef vector_type::size_type size_type
 
typedef vector_type::difference_type difference_type
 
typedef vector_type::reference reference
 
typedef vector_type::const_reference const_reference
 
typedef vector_type::value_type value_type
 
typedef vector_type::iterator iterator
 
typedef vector_type::const_iterator const_iterator
 
typedef vector_type::reverse_iterator reverse_iterator
 

Public Member Functions

 CDataStream (int nTypeIn, int nVersionIn)
 
 CDataStream (Span< const uint8_t > sp, int nTypeIn, int nVersionIn)
 
template<typename... Args>
 CDataStream (int nTypeIn, int nVersionIn, Args &&...args)
 
CDataStreamoperator+= (const CDataStream &b)
 
std::string str () const
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
size_type size () const
 
bool empty () const
 
void resize (size_type n, value_type c=0)
 
void reserve (size_type n)
 
const_reference operator[] (size_type pos) const
 
reference operator[] (size_type pos)
 
void clear ()
 
iterator insert (iterator it, const uint8_t x)
 
void insert (iterator it, size_type n, const uint8_t x)
 
value_typedata ()
 
const value_typedata () const
 
void insert (iterator it, std::vector< uint8_t >::const_iterator first, std::vector< uint8_t >::const_iterator last)
 
void insert (iterator it, const char *first, const char *last)
 
iterator erase (iterator it)
 
iterator erase (iterator first, iterator last)
 
void Compact ()
 
bool Rewind (std::optional< size_type > n=std::nullopt)
 
bool eof () const
 
CDataStreamrdbuf ()
 
int in_avail () const
 
void SetType (int n)
 
int GetType () const
 
void SetVersion (int n)
 
int GetVersion () const
 
void read (char *pch, size_t nSize)
 
void ignore (int nSize)
 
void write (const char *pch, size_t nSize)
 
template<typename Stream >
void Serialize (Stream &s) const
 
template<typename T >
CDataStreamoperator<< (const T &obj)
 
template<typename T >
CDataStreamoperator>> (T &&obj)
 
void Xor (const std::vector< uint8_t > &key)
 XOR the contents of this stream with a certain key. More...
 

Protected Types

using vector_type = SerializeData
 

Protected Attributes

vector_type vch
 
unsigned int nReadPos {0}
 
int nType
 
int nVersion
 

Detailed Description

Double ended buffer combining vector and stream-like interfaces.

and << read and write unformatted data using the above serialization

templates. Fills with data in linear time; some stringstream implementations take N^2 time.

Definition at line 199 of file streams.h.

Member Typedef Documentation

◆ allocator_type

typedef vector_type::allocator_type CDataStream::allocator_type

Definition at line 209 of file streams.h.

◆ const_iterator

typedef vector_type::const_iterator CDataStream::const_iterator

Definition at line 216 of file streams.h.

◆ const_reference

typedef vector_type::const_reference CDataStream::const_reference

Definition at line 213 of file streams.h.

◆ difference_type

typedef vector_type::difference_type CDataStream::difference_type

Definition at line 211 of file streams.h.

◆ iterator

typedef vector_type::iterator CDataStream::iterator

Definition at line 215 of file streams.h.

◆ reference

typedef vector_type::reference CDataStream::reference

Definition at line 212 of file streams.h.

◆ reverse_iterator

typedef vector_type::reverse_iterator CDataStream::reverse_iterator

Definition at line 217 of file streams.h.

◆ size_type

typedef vector_type::size_type CDataStream::size_type

Definition at line 210 of file streams.h.

◆ value_type

typedef vector_type::value_type CDataStream::value_type

Definition at line 214 of file streams.h.

◆ vector_type

Definition at line 201 of file streams.h.

Constructor & Destructor Documentation

◆ CDataStream() [1/3]

CDataStream::CDataStream ( int  nTypeIn,
int  nVersionIn 
)
inlineexplicit

Definition at line 219 of file streams.h.

◆ CDataStream() [2/3]

CDataStream::CDataStream ( Span< const uint8_t >  sp,
int  nTypeIn,
int  nVersionIn 
)
inlineexplicit

Definition at line 222 of file streams.h.

◆ CDataStream() [3/3]

template<typename... Args>
CDataStream::CDataStream ( int  nTypeIn,
int  nVersionIn,
Args &&...  args 
)
inline

Definition at line 227 of file streams.h.

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

iterator CDataStream::begin ( )
inline

Definition at line 243 of file streams.h.

◆ begin() [2/2]

const_iterator CDataStream::begin ( ) const
inline

Definition at line 242 of file streams.h.

Here is the caller graph for this function:

◆ clear()

void CDataStream::clear ( )
inline

Definition at line 254 of file streams.h.

Here is the caller graph for this function:

◆ Compact()

void CDataStream::Compact ( )
inline

Definition at line 327 of file streams.h.

◆ data() [1/2]

value_type* CDataStream::data ( )
inline

Definition at line 262 of file streams.h.

Here is the caller graph for this function:

◆ data() [2/2]

const value_type* CDataStream::data ( ) const
inline

Definition at line 263 of file streams.h.

◆ empty()

bool CDataStream::empty ( ) const
inline

Definition at line 247 of file streams.h.

Here is the caller graph for this function:

◆ end() [1/2]

iterator CDataStream::end ( )
inline

Definition at line 245 of file streams.h.

◆ end() [2/2]

const_iterator CDataStream::end ( ) const
inline

Definition at line 244 of file streams.h.

Here is the caller graph for this function:

◆ eof()

bool CDataStream::eof ( ) const
inline

Definition at line 349 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase() [1/2]

iterator CDataStream::erase ( iterator  first,
iterator  last 
)
inline

Definition at line 313 of file streams.h.

◆ erase() [2/2]

iterator CDataStream::erase ( iterator  it)
inline

Definition at line 298 of file streams.h.

Here is the caller graph for this function:

◆ GetType()

int CDataStream::GetType ( ) const
inline

Definition at line 354 of file streams.h.

Here is the caller graph for this function:

◆ GetVersion()

int CDataStream::GetVersion ( ) const
inline

Definition at line 356 of file streams.h.

Here is the caller graph for this function:

◆ ignore()

void CDataStream::ignore ( int  nSize)
inline

Definition at line 377 of file streams.h.

Here is the caller graph for this function:

◆ in_avail()

int CDataStream::in_avail ( ) const
inline

Definition at line 351 of file streams.h.

Here is the call graph for this function:

◆ insert() [1/4]

void CDataStream::insert ( iterator  it,
const char *  first,
const char *  last 
)
inline

Definition at line 282 of file streams.h.

Here is the call graph for this function:

◆ insert() [2/4]

iterator CDataStream::insert ( iterator  it,
const uint8_t  x 
)
inline

Definition at line 258 of file streams.h.

Here is the caller graph for this function:

◆ insert() [3/4]

void CDataStream::insert ( iterator  it,
size_type  n,
const uint8_t  x 
)
inline

Definition at line 259 of file streams.h.

◆ insert() [4/4]

void CDataStream::insert ( iterator  it,
std::vector< uint8_t >::const_iterator  first,
std::vector< uint8_t >::const_iterator  last 
)
inline

Definition at line 265 of file streams.h.

Here is the call graph for this function:

◆ operator+=()

CDataStream& CDataStream::operator+= ( const CDataStream b)
inline

Definition at line 232 of file streams.h.

Here is the call graph for this function:

◆ operator<<()

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

Definition at line 408 of file streams.h.

Here is the call graph for this function:

◆ operator>>()

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

Definition at line 414 of file streams.h.

Here is the call graph for this function:

◆ operator[]() [1/2]

reference CDataStream::operator[] ( size_type  pos)
inline

Definition at line 253 of file streams.h.

◆ operator[]() [2/2]

const_reference CDataStream::operator[] ( size_type  pos) const
inline

Definition at line 250 of file streams.h.

◆ rdbuf()

CDataStream* CDataStream::rdbuf ( )
inline

Definition at line 350 of file streams.h.

◆ read()

void CDataStream::read ( char *  pch,
size_t  nSize 
)
inline

Definition at line 358 of file streams.h.

◆ reserve()

void CDataStream::reserve ( size_type  n)
inline

Definition at line 249 of file streams.h.

Here is the caller graph for this function:

◆ resize()

void CDataStream::resize ( size_type  n,
value_type  c = 0 
)
inline

Definition at line 248 of file streams.h.

Here is the caller graph for this function:

◆ Rewind()

bool CDataStream::Rewind ( std::optional< size_type n = std::nullopt)
inline

Definition at line 332 of file streams.h.

Here is the caller graph for this function:

◆ Serialize()

template<typename Stream >
void CDataStream::Serialize ( Stream &  s) const
inline

Definition at line 401 of file streams.h.

Here is the caller graph for this function:

◆ SetType()

void CDataStream::SetType ( int  n)
inline

Definition at line 353 of file streams.h.

Here is the caller graph for this function:

◆ SetVersion()

void CDataStream::SetVersion ( int  n)
inline

Definition at line 355 of file streams.h.

Here is the caller graph for this function:

◆ size()

size_type CDataStream::size ( ) const
inline

Definition at line 246 of file streams.h.

Here is the caller graph for this function:

◆ str()

std::string CDataStream::str ( ) const
inline

Definition at line 237 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

void CDataStream::write ( const char *  pch,
size_t  nSize 
)
inline

Definition at line 396 of file streams.h.

Here is the caller graph for this function:

◆ Xor()

void CDataStream::Xor ( const std::vector< uint8_t > &  key)
inline

XOR the contents of this stream with a certain key.

Parameters
[in]keyThe key used to XOR the data in this stream.

Definition at line 425 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ nReadPos

unsigned int CDataStream::nReadPos {0}
protected

Definition at line 203 of file streams.h.

◆ nType

int CDataStream::nType
protected

Definition at line 205 of file streams.h.

◆ nVersion

int CDataStream::nVersion
protected

Definition at line 206 of file streams.h.

◆ vch

vector_type CDataStream::vch
protected

Definition at line 202 of file streams.h.


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