Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 (const_iterator pbegin, const_iterator pend, int nTypeIn, int nVersionIn)
 
 CDataStream (const char *pbegin, const char *pend, int nTypeIn, int nVersionIn)
 
 CDataStream (const vector_type &vchIn, int nTypeIn, int nVersionIn)
 
 CDataStream (const std::vector< char > &vchIn, int nTypeIn, int nVersionIn)
 
 CDataStream (const std::vector< unsigned char > &vchIn, int nTypeIn, int nVersionIn)
 
template<typename... Args>
 CDataStream (int nTypeIn, int nVersionIn, Args &&... args)
 
void Init (int nTypeIn, int nVersionIn)
 
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 char x=char())
 
void insert (iterator it, size_type n, const char x)
 
value_typedata ()
 
const value_typedata () const
 
void insert (iterator it, std::vector< char >::const_iterator first, std::vector< char >::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 (size_type n)
 
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 GetAndClear (CSerializeData &d)
 
void Xor (const std::vector< unsigned char > &key)
 XOR the contents of this stream with a certain key. More...
 

Protected Types

typedef CSerializeData vector_type
 

Protected Attributes

vector_type vch
 
unsigned int nReadPos
 
int nType
 
int nVersion
 

Friends

CDataStream operator+ (const CDataStream &a, const CDataStream &b)
 

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

Member Typedef Documentation

◆ allocator_type

typedef vector_type::allocator_type CDataStream::allocator_type

Definition at line 114 of file streams.h.

◆ const_iterator

typedef vector_type::const_iterator CDataStream::const_iterator

Definition at line 121 of file streams.h.

◆ const_reference

typedef vector_type::const_reference CDataStream::const_reference

Definition at line 118 of file streams.h.

◆ difference_type

typedef vector_type::difference_type CDataStream::difference_type

Definition at line 116 of file streams.h.

◆ iterator

typedef vector_type::iterator CDataStream::iterator

Definition at line 120 of file streams.h.

◆ reference

typedef vector_type::reference CDataStream::reference

Definition at line 117 of file streams.h.

◆ reverse_iterator

typedef vector_type::reverse_iterator CDataStream::reverse_iterator

Definition at line 122 of file streams.h.

◆ size_type

typedef vector_type::size_type CDataStream::size_type

Definition at line 115 of file streams.h.

◆ value_type

typedef vector_type::value_type CDataStream::value_type

Definition at line 119 of file streams.h.

◆ vector_type

Definition at line 106 of file streams.h.

Constructor & Destructor Documentation

◆ CDataStream() [1/7]

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

Definition at line 124 of file streams.h.

References Init().

◆ CDataStream() [2/7]

CDataStream::CDataStream ( const_iterator  pbegin,
const_iterator  pend,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 129 of file streams.h.

References Init().

◆ CDataStream() [3/7]

CDataStream::CDataStream ( const char *  pbegin,
const char *  pend,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 134 of file streams.h.

References Init().

◆ CDataStream() [4/7]

CDataStream::CDataStream ( const vector_type vchIn,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 139 of file streams.h.

References Init().

◆ CDataStream() [5/7]

CDataStream::CDataStream ( const std::vector< char > &  vchIn,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 144 of file streams.h.

References Init().

◆ CDataStream() [6/7]

CDataStream::CDataStream ( const std::vector< unsigned char > &  vchIn,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 149 of file streams.h.

References Init().

◆ CDataStream() [7/7]

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

Definition at line 155 of file streams.h.

References Init(), and SerializeMany().

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

iterator CDataStream::begin ( )
inline

Definition at line 191 of file streams.h.

References nReadPos, and vch.

◆ clear()

void CDataStream::clear ( )
inline

◆ Compact()

void CDataStream::Compact ( )
inline

Definition at line 271 of file streams.h.

References nReadPos, and vch.

◆ data() [1/2]

◆ data() [2/2]

const value_type* CDataStream::data ( ) const
inline

Definition at line 204 of file streams.h.

References nReadPos, and vch.

◆ empty()

bool CDataStream::empty ( ) const
inline

Definition at line 195 of file streams.h.

References nReadPos, and vch.

Referenced by DecodeHexTx(), GetTxPayload(), ProcessMessage(), and ReadKeyValue().

◆ end() [1/2]

◆ end() [2/2]

iterator CDataStream::end ( )
inline

Definition at line 193 of file streams.h.

References vch.

◆ eof()

bool CDataStream::eof ( ) const
inline

Definition at line 290 of file streams.h.

References size().

◆ erase() [1/2]

iterator CDataStream::erase ( iterator  it)
inline

Definition at line 234 of file streams.h.

References nReadPos, and vch.

◆ erase() [2/2]

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

Definition at line 251 of file streams.h.

References nReadPos, and vch.

◆ GetAndClear()

void CDataStream::GetAndClear ( CSerializeData d)
inline

Definition at line 366 of file streams.h.

References begin(), clear(), and end().

◆ GetType()

int CDataStream::GetType ( ) const
inline

Definition at line 295 of file streams.h.

References nType.

◆ GetVersion()

int CDataStream::GetVersion ( ) const
inline

Definition at line 297 of file streams.h.

References nVersion.

◆ ignore()

void CDataStream::ignore ( int  nSize)
inline

Definition at line 318 of file streams.h.

References nReadPos, and vch.

◆ in_avail()

int CDataStream::in_avail ( ) const
inline

Definition at line 292 of file streams.h.

References size().

Referenced by ProcessMessage().

◆ Init()

void CDataStream::Init ( int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 161 of file streams.h.

References nReadPos, nType, and nVersion.

Referenced by CDataStream().

◆ insert() [1/4]

iterator CDataStream::insert ( iterator  it,
const char  x = char() 
)
inline

Definition at line 201 of file streams.h.

References vch.

Referenced by CAccountingEntry::SerializationOp().

◆ insert() [2/4]

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

Definition at line 202 of file streams.h.

References vch.

◆ insert() [3/4]

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

Definition at line 206 of file streams.h.

References memcpy(), nReadPos, and vch.

◆ insert() [4/4]

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

Definition at line 220 of file streams.h.

References memcpy(), nReadPos, and vch.

◆ operator+=()

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

Definition at line 168 of file streams.h.

References begin(), end(), and vch.

◆ operator<<()

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

Definition at line 351 of file streams.h.

References Serialize().

◆ operator>>()

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

Definition at line 359 of file streams.h.

References Unserialize().

◆ operator[]() [1/2]

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

Definition at line 198 of file streams.h.

References nReadPos, and vch.

◆ operator[]() [2/2]

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

Definition at line 199 of file streams.h.

References nReadPos, and vch.

◆ rdbuf()

CDataStream* CDataStream::rdbuf ( )
inline

Definition at line 291 of file streams.h.

◆ read()

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

Definition at line 299 of file streams.h.

References memcpy(), nReadPos, and vch.

◆ reserve()

◆ resize()

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

Definition at line 196 of file streams.h.

References nReadPos, and vch.

Referenced by CNetMessage::CNetMessage(), and CNetMessage::readData().

◆ Rewind()

bool CDataStream::Rewind ( size_type  n)
inline

Definition at line 277 of file streams.h.

References nReadPos.

Referenced by DeserializeAndCheckBlockTest(), and DeserializeBlockTest().

◆ Serialize()

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

Definition at line 343 of file streams.h.

References vch.

Referenced by operator<<().

◆ SetType()

void CDataStream::SetType ( int  n)
inline

Definition at line 294 of file streams.h.

References nType.

Referenced by BerkeleyBatch::ReadAtCursor().

◆ SetVersion()

void CDataStream::SetVersion ( int  n)
inline

Definition at line 296 of file streams.h.

References nVersion.

Referenced by CNetMessage::SetVersion().

◆ size()

◆ str()

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

Definition at line 181 of file streams.h.

References begin(), and end().

Referenced by RecentRequestsTableModel::addNewRequest(), rest_block(), rest_getutxos(), rest_headers(), and rest_tx().

◆ write()

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

Definition at line 336 of file streams.h.

References vch.

Referenced by DeserializeAndCheckBlockTest(), DeserializeBlockTest(), and BerkeleyBatch::ReadAtCursor().

◆ Xor()

void CDataStream::Xor ( const std::vector< unsigned char > &  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 376 of file streams.h.

References size(), and vch.

Referenced by CDBIterator::GetValue(), CDBWrapper::ReadDataStream(), and CDBBatch::Write().

Friends And Related Function Documentation

◆ operator+

CDataStream operator+ ( const CDataStream a,
const CDataStream b 
)
friend

Definition at line 174 of file streams.h.

Member Data Documentation

◆ nReadPos

unsigned int CDataStream::nReadPos
protected

◆ nType

int CDataStream::nType
protected

Definition at line 110 of file streams.h.

Referenced by GetType(), Init(), and SetType().

◆ nVersion

int CDataStream::nVersion
protected

Definition at line 111 of file streams.h.

Referenced by GetVersion(), Init(), and SetVersion().

◆ vch

vector_type CDataStream::vch
protected

The documentation for this class was generated from the following file:
Released under the MIT license