Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dev::RLPStream Class Reference

Class for writing to an RLP bytestream. More...

#include <RLP.h>

Public Member Functions

 RLPStream ()
 Initializes empty RLPStream. More...
 
 RLPStream (size_t _listItems)
 Initializes the RLPStream as a list of _listItems items. More...
 
 ~RLPStream ()
 
RLPStreamappend (unsigned _s)
 Append given datum to the byte stream. More...
 
RLPStreamappend (u160 _s)
 
RLPStreamappend (u256 _s)
 
RLPStreamappend (bigint _s)
 
RLPStreamappend (bytesConstRef _s, bool _compact=false)
 
RLPStreamappend (bytes const &_s)
 
RLPStreamappend (std::string const &_s)
 
RLPStreamappend (char const *_s)
 
template<unsigned N>
RLPStreamappend (FixedHash< N > _s, bool _compact=false, bool _allOrNothing=false)
 
RLPStreamappend (RLP const &_rlp, size_t _itemCount=1)
 Appends an arbitrary RLP fragment - this must be a single item unless _itemCount is given. More...
 
template<class _T >
RLPStreamappend (std::vector< _T > const &_s)
 Appends a sequence of data to the stream as a list. More...
 
template<class _T >
RLPStreamappendVector (std::vector< _T > const &_s)
 
template<class _T , size_t S>
RLPStreamappend (std::array< _T, S > const &_s)
 
template<class _T >
RLPStreamappend (std::set< _T > const &_s)
 
template<class _T >
RLPStreamappend (std::unordered_set< _T > const &_s)
 
template<class T , class U >
RLPStreamappend (std::pair< T, U > const &_s)
 
RLPStreamappendList (size_t _items)
 Appends a list. More...
 
RLPStreamappendList (bytesConstRef _rlp)
 
RLPStreamappendList (bytes const &_rlp)
 
RLPStreamappendList (RLPStream const &_s)
 
RLPStreamappendRaw (bytesConstRef _rlp, size_t _itemCount=1)
 Appends raw (pre-serialised) RLP data. Use with caution. More...
 
RLPStreamappendRaw (bytes const &_rlp, size_t _itemCount=1)
 
template<class T >
RLPStreamoperator<< (T _data)
 Shift operators for appending data items. More...
 
void clear ()
 Clear the output stream so far. More...
 
bytes const & out () const
 Read the byte stream. More...
 
bytes && invalidate ()
 Invalidate the object and steal the output byte stream. More...
 
void swapOut (bytes &_dest)
 Swap the contents of the output stream out for some other byte array. More...
 

Private Member Functions

void noteAppended (size_t _itemCount=1)
 
void pushCount (size_t _count, byte _offset)
 Push the node-type byte (using _base) along with the item count _count. More...
 
template<class _T >
void pushInt (_T _i, size_t _br)
 Push an integer as a raw big-endian byte-stream. More...
 

Private Attributes

bytes m_out
 Our output byte stream. More...
 
std::vector< std::pair< size_t, size_t > > m_listStack
 

Detailed Description

Class for writing to an RLP bytestream.

Definition at line 383 of file RLP.h.

Constructor & Destructor Documentation

dev::RLPStream::RLPStream ( )
inline

Initializes empty RLPStream.

Definition at line 387 of file RLP.h.

dev::RLPStream::RLPStream ( size_t  _listItems)
inlineexplicit

Initializes the RLPStream as a list of _listItems items.

Definition at line 390 of file RLP.h.

dev::RLPStream::~RLPStream ( )
inline

Definition at line 392 of file RLP.h.

Member Function Documentation

RLPStream& dev::RLPStream::append ( unsigned  _s)
inline

Append given datum to the byte stream.

Definition at line 395 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::append ( u160  _s)
inline

Definition at line 396 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::append ( u256  _s)
inline

Definition at line 397 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream & RLPStream::append ( bigint  _s)

Definition at line 317 of file RLP.cpp.

Here is the call graph for this function:

RLPStream & RLPStream::append ( bytesConstRef  _s,
bool  _compact = false 
)

Definition at line 296 of file RLP.cpp.

Here is the call graph for this function:

RLPStream& dev::RLPStream::append ( bytes const &  _s)
inline

Definition at line 400 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::append ( std::string const &  _s)
inline

Definition at line 401 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::append ( char const *  _s)
inline

Definition at line 402 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<unsigned N>
RLPStream& dev::RLPStream::append ( FixedHash< N >  _s,
bool  _compact = false,
bool  _allOrNothing = false 
)
inline

Definition at line 403 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::append ( RLP const &  _rlp,
size_t  _itemCount = 1 
)
inline

Appends an arbitrary RLP fragment - this must be a single item unless _itemCount is given.

Definition at line 406 of file RLP.h.

Here is the call graph for this function:

template<class _T >
RLPStream& dev::RLPStream::append ( std::vector< _T > const &  _s)
inline

Appends a sequence of data to the stream as a list.

Definition at line 409 of file RLP.h.

template<class _T , size_t S>
RLPStream& dev::RLPStream::append ( std::array< _T, S > const &  _s)
inline

Definition at line 411 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class _T >
RLPStream& dev::RLPStream::append ( std::set< _T > const &  _s)
inline

Definition at line 412 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class _T >
RLPStream& dev::RLPStream::append ( std::unordered_set< _T > const &  _s)
inline

Definition at line 413 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T , class U >
RLPStream& dev::RLPStream::append ( std::pair< T, U > const &  _s)
inline

Definition at line 414 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream & RLPStream::appendList ( size_t  _items)

Appends a list.

Definition at line 276 of file RLP.cpp.

Here is the caller graph for this function:

RLPStream & RLPStream::appendList ( bytesConstRef  _rlp)

Definition at line 286 of file RLP.cpp.

Here is the call graph for this function:

RLPStream& dev::RLPStream::appendList ( bytes const &  _rlp)
inline

Definition at line 419 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::appendList ( RLPStream const &  _s)
inline

Definition at line 420 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream & RLPStream::appendRaw ( bytesConstRef  _rlp,
size_t  _itemCount = 1 
)

Appends raw (pre-serialised) RLP data. Use with caution.

Definition at line 230 of file RLP.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

RLPStream& dev::RLPStream::appendRaw ( bytes const &  _rlp,
size_t  _itemCount = 1 
)
inline

Definition at line 424 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class _T >
RLPStream& dev::RLPStream::appendVector ( std::vector< _T > const &  _s)
inline

Definition at line 410 of file RLP.h.

void dev::RLPStream::clear ( )
inline

Clear the output stream so far.

Definition at line 430 of file RLP.h.

bytes&& dev::RLPStream::invalidate ( )
inline

Invalidate the object and steal the output byte stream.

Definition at line 436 of file RLP.h.

void RLPStream::noteAppended ( size_t  _itemCount = 1)
private

Definition at line 237 of file RLP.cpp.

Here is the call graph for this function:

template<class T >
RLPStream& dev::RLPStream::operator<< ( T  _data)
inline

Shift operators for appending data items.

Definition at line 427 of file RLP.h.

bytes const& dev::RLPStream::out ( ) const
inline

Read the byte stream.

Definition at line 433 of file RLP.h.

Here is the caller graph for this function:

void RLPStream::pushCount ( size_t  _count,
byte  _offset 
)
private

Push the node-type byte (using _base) along with the item count _count.

  • _count is number of characters for strings, data-bytes for ints, or items for lists.

Definition at line 342 of file RLP.cpp.

Here is the call graph for this function:

template<class _T >
void dev::RLPStream::pushInt ( _T  _i,
size_t  _br 
)
inlineprivate

Push an integer as a raw big-endian byte-stream.

Definition at line 449 of file RLP.h.

Here is the call graph for this function:

void dev::RLPStream::swapOut ( bytes _dest)
inline

Swap the contents of the output stream out for some other byte array.

Definition at line 439 of file RLP.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::vector<std::pair<size_t, size_t> > dev::RLPStream::m_listStack
private

Definition at line 460 of file RLP.h.

bytes dev::RLPStream::m_out
private

Our output byte stream.

Definition at line 458 of file RLP.h.


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