Bitcoin ABC 0.30.5
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 type, int version)
 
 CDataStream (Span< const value_type > sp, int nTypeIn, int nVersionIn)
 
template<typename... Args>
 CDataStream (int nTypeIn, int nVersionIn, Args &&...args)
 
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=value_type{})
 
void reserve (size_type n)
 
const_reference operator[] (size_type pos) const
 
reference operator[] (size_type pos)
 
void clear ()
 
iterator insert (iterator it, const value_type x)
 
void insert (iterator it, size_type n, const value_type x)
 
value_typedata ()
 
const value_typedata () const
 
void insert (iterator it, std::vector< value_type >::const_iterator first, std::vector< value_type >::const_iterator last)
 
void insert (iterator it, const value_type *first, const value_type *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 (Span< value_type > dst)
 
void ignore (int nSize)
 
void write (Span< const value_type > src)
 
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 177 of file streams.h.

Member Typedef Documentation

◆ allocator_type

typedef vector_type::allocator_type CDataStream::allocator_type

Definition at line 187 of file streams.h.

◆ const_iterator

typedef vector_type::const_iterator CDataStream::const_iterator

Definition at line 194 of file streams.h.

◆ const_reference

typedef vector_type::const_reference CDataStream::const_reference

Definition at line 191 of file streams.h.

◆ difference_type

typedef vector_type::difference_type CDataStream::difference_type

Definition at line 189 of file streams.h.

◆ iterator

typedef vector_type::iterator CDataStream::iterator

Definition at line 193 of file streams.h.

◆ reference

typedef vector_type::reference CDataStream::reference

Definition at line 190 of file streams.h.

◆ reverse_iterator

typedef vector_type::reverse_iterator CDataStream::reverse_iterator

Definition at line 195 of file streams.h.

◆ size_type

typedef vector_type::size_type CDataStream::size_type

Definition at line 188 of file streams.h.

◆ value_type

typedef vector_type::value_type CDataStream::value_type

Definition at line 192 of file streams.h.

◆ vector_type

Definition at line 179 of file streams.h.

Constructor & Destructor Documentation

◆ CDataStream() [1/4]

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

Definition at line 197 of file streams.h.

◆ CDataStream() [2/4]

CDataStream::CDataStream ( Span< const uint8_t >  sp,
int  type,
int  version 
)
inlineexplicit

Definition at line 200 of file streams.h.

◆ CDataStream() [3/4]

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

Definition at line 202 of file streams.h.

◆ CDataStream() [4/4]

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

Definition at line 207 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 220 of file streams.h.

◆ begin() [2/2]

const_iterator CDataStream::begin ( ) const
inline

Definition at line 219 of file streams.h.

Here is the caller graph for this function:

◆ clear()

void CDataStream::clear ( )
inline

Definition at line 233 of file streams.h.

Here is the caller graph for this function:

◆ Compact()

void CDataStream::Compact ( )
inline

Definition at line 310 of file streams.h.

◆ data() [1/2]

value_type * CDataStream::data ( )
inline

Definition at line 243 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 244 of file streams.h.

◆ empty()

bool CDataStream::empty ( ) const
inline

Definition at line 224 of file streams.h.

Here is the caller graph for this function:

◆ end() [1/2]

iterator CDataStream::end ( )
inline

Definition at line 222 of file streams.h.

◆ end() [2/2]

const_iterator CDataStream::end ( ) const
inline

Definition at line 221 of file streams.h.

Here is the caller graph for this function:

◆ eof()

bool CDataStream::eof ( ) const
inline

Definition at line 332 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 296 of file streams.h.

◆ erase() [2/2]

iterator CDataStream::erase ( iterator  it)
inline

Definition at line 281 of file streams.h.

Here is the caller graph for this function:

◆ GetType()

int CDataStream::GetType ( ) const
inline

Definition at line 337 of file streams.h.

Here is the caller graph for this function:

◆ GetVersion()

int CDataStream::GetVersion ( ) const
inline

Definition at line 339 of file streams.h.

Here is the caller graph for this function:

◆ ignore()

void CDataStream::ignore ( int  nSize)
inline

Definition at line 360 of file streams.h.

Here is the caller graph for this function:

◆ in_avail()

int CDataStream::in_avail ( ) const
inline

Definition at line 334 of file streams.h.

Here is the call graph for this function:

◆ insert() [1/4]

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

Definition at line 265 of file streams.h.

Here is the call graph for this function:

◆ insert() [2/4]

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

Definition at line 237 of file streams.h.

Here is the caller graph for this function:

◆ insert() [3/4]

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

Definition at line 240 of file streams.h.

◆ insert() [4/4]

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

Definition at line 246 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 391 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 397 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 232 of file streams.h.

◆ operator[]() [2/2]

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

Definition at line 229 of file streams.h.

◆ rdbuf()

CDataStream * CDataStream::rdbuf ( )
inline

Definition at line 333 of file streams.h.

◆ read()

void CDataStream::read ( Span< value_type dst)
inline

Definition at line 341 of file streams.h.

Here is the call graph for this function:

◆ reserve()

void CDataStream::reserve ( size_type  n)
inline

Definition at line 228 of file streams.h.

Here is the caller graph for this function:

◆ resize()

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

Definition at line 225 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 315 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 384 of file streams.h.

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

◆ SetType()

void CDataStream::SetType ( int  n)
inline

Definition at line 336 of file streams.h.

Here is the caller graph for this function:

◆ SetVersion()

void CDataStream::SetVersion ( int  n)
inline

Definition at line 338 of file streams.h.

Here is the caller graph for this function:

◆ size()

size_type CDataStream::size ( ) const
inline

Definition at line 223 of file streams.h.

Here is the caller graph for this function:

◆ str()

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

Definition at line 212 of file streams.h.

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

◆ write()

void CDataStream::write ( Span< const value_type src)
inline

Definition at line 379 of file streams.h.

Here is the call graph for this function:
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 408 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 181 of file streams.h.

◆ nType

int CDataStream::nType
protected

Definition at line 183 of file streams.h.

◆ nVersion

int CDataStream::nVersion
protected

Definition at line 184 of file streams.h.

◆ vch

vector_type CDataStream::vch
protected

Definition at line 180 of file streams.h.


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