Bitcoin Core  0.18.99
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
BitStreamReader< IStream > Class Template Reference

#include <streams.h>

Public Member Functions

 BitStreamReader (IStream &istream)
 
uint64_t Read (int nbits)
 Read the specified number of bits from the stream. More...
 

Private Attributes

IStream & m_istream
 
uint8_t m_buffer {0}
 Buffered byte read in from the input stream. More...
 
int m_offset {8}
 Number of high order bits in m_buffer already returned by previous Read() calls. More...
 

Detailed Description

template<typename IStream>
class BitStreamReader< IStream >

Definition at line 496 of file streams.h.

Constructor & Destructor Documentation

◆ BitStreamReader()

template<typename IStream>
BitStreamReader< IStream >::BitStreamReader ( IStream &  istream)
inlineexplicit

Definition at line 511 of file streams.h.

Member Function Documentation

◆ Read()

template<typename IStream>
uint64_t BitStreamReader< IStream >::Read ( int  nbits)
inline

Read the specified number of bits from the stream.

The data is returned in the nbits least significant bits of a 64-bit uint.

Definition at line 516 of file streams.h.

Here is the caller graph for this function:

Member Data Documentation

◆ m_buffer

template<typename IStream>
uint8_t BitStreamReader< IStream >::m_buffer {0}
private

Buffered byte read in from the input stream.

A new byte is read into the buffer when m_offset reaches 8.

Definition at line 503 of file streams.h.

◆ m_istream

template<typename IStream>
IStream& BitStreamReader< IStream >::m_istream
private

Definition at line 499 of file streams.h.

◆ m_offset

template<typename IStream>
int BitStreamReader< IStream >::m_offset {8}
private

Number of high order bits in m_buffer already returned by previous Read() calls.

The next bit to be returned is at this offset from the most significant bit position.

Definition at line 508 of file streams.h.


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