Bitcoin Core  0.15.99
P2P Digital Currency
Public Types | Public Member Functions | Protected Types | Protected Attributes | Friends | 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 (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 146 of file streams.h.

Member Typedef Documentation

typedef vector_type::allocator_type CDataStream::allocator_type

Definition at line 157 of file streams.h.

typedef vector_type::const_iterator CDataStream::const_iterator

Definition at line 164 of file streams.h.

typedef vector_type::const_reference CDataStream::const_reference

Definition at line 161 of file streams.h.

typedef vector_type::difference_type CDataStream::difference_type

Definition at line 159 of file streams.h.

typedef vector_type::iterator CDataStream::iterator

Definition at line 163 of file streams.h.

typedef vector_type::reference CDataStream::reference

Definition at line 160 of file streams.h.

typedef vector_type::reverse_iterator CDataStream::reverse_iterator

Definition at line 165 of file streams.h.

typedef vector_type::size_type CDataStream::size_type

Definition at line 158 of file streams.h.

typedef vector_type::value_type CDataStream::value_type

Definition at line 162 of file streams.h.

Definition at line 149 of file streams.h.

Constructor & Destructor Documentation

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

Definition at line 167 of file streams.h.

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

Definition at line 172 of file streams.h.

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

Definition at line 177 of file streams.h.

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

Definition at line 182 of file streams.h.

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

Definition at line 187 of file streams.h.

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

Definition at line 192 of file streams.h.

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

Definition at line 198 of file streams.h.

Here is the call graph for this function:

Member Function Documentation

const_iterator CDataStream::begin ( ) const
inline

Definition at line 233 of file streams.h.

Here is the caller graph for this function:

iterator CDataStream::begin ( )
inline

Definition at line 234 of file streams.h.

void CDataStream::clear ( )
inline

Definition at line 243 of file streams.h.

Here is the caller graph for this function:

void CDataStream::Compact ( )
inline

Definition at line 314 of file streams.h.

value_type* CDataStream::data ( )
inline

Definition at line 246 of file streams.h.

Here is the caller graph for this function:

const value_type* CDataStream::data ( ) const
inline

Definition at line 247 of file streams.h.

bool CDataStream::empty ( ) const
inline

Definition at line 238 of file streams.h.

Here is the caller graph for this function:

const_iterator CDataStream::end ( ) const
inline

Definition at line 235 of file streams.h.

Here is the caller graph for this function:

iterator CDataStream::end ( )
inline

Definition at line 236 of file streams.h.

bool CDataStream::eof ( ) const
inline

Definition at line 333 of file streams.h.

Here is the caller graph for this function:

iterator CDataStream::erase ( iterator  it)
inline

Definition at line 277 of file streams.h.

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

Definition at line 294 of file streams.h.

void CDataStream::GetAndClear ( CSerializeData d)
inline

Definition at line 411 of file streams.h.

int CDataStream::GetType ( ) const
inline

Definition at line 338 of file streams.h.

int CDataStream::GetVersion ( ) const
inline

Definition at line 340 of file streams.h.

void CDataStream::ignore ( int  nSize)
inline

Definition at line 363 of file streams.h.

int CDataStream::in_avail ( ) const
inline

Definition at line 335 of file streams.h.

Here is the caller graph for this function:

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

Definition at line 204 of file streams.h.

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

Definition at line 244 of file streams.h.

Here is the caller graph for this function:

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

Definition at line 245 of file streams.h.

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

Definition at line 249 of file streams.h.

Here is the call graph for this function:

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

Definition at line 263 of file streams.h.

Here is the call graph for this function:

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

Definition at line 211 of file streams.h.

Here is the call graph for this function:

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

Definition at line 396 of file streams.h.

Here is the call graph for this function:

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

Definition at line 404 of file streams.h.

Here is the call graph for this function:

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

Definition at line 241 of file streams.h.

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

Definition at line 242 of file streams.h.

CDataStream* CDataStream::rdbuf ( )
inline

Definition at line 334 of file streams.h.

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

Definition at line 342 of file streams.h.

Here is the call graph for this function:

void CDataStream::reserve ( size_type  n)
inline

Definition at line 240 of file streams.h.

Here is the caller graph for this function:

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

Definition at line 239 of file streams.h.

Here is the caller graph for this function:

bool CDataStream::Rewind ( size_type  n)
inline

Definition at line 320 of file streams.h.

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

Definition at line 388 of file streams.h.

void CDataStream::SetType ( int  n)
inline

Definition at line 337 of file streams.h.

Here is the caller graph for this function:

void CDataStream::SetVersion ( int  n)
inline

Definition at line 339 of file streams.h.

Here is the caller graph for this function:

size_type CDataStream::size ( ) const
inline

Definition at line 237 of file streams.h.

Here is the caller graph for this function:

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

Definition at line 224 of file streams.h.

Here is the caller graph for this function:

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

Definition at line 381 of file streams.h.

Here is the caller graph for this function:

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

Here is the caller graph for this function:

Friends And Related Function Documentation

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

Definition at line 217 of file streams.h.

Member Data Documentation

unsigned int CDataStream::nReadPos
protected

Definition at line 151 of file streams.h.

int CDataStream::nType
protected

Definition at line 153 of file streams.h.

int CDataStream::nVersion
protected

Definition at line 154 of file streams.h.

vector_type CDataStream::vch
protected

Definition at line 150 of file streams.h.


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