Bitcoin Core 28.99.0
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 286 of file streams.h.

Constructor & Destructor Documentation

◆ BitStreamReader()

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

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

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

◆ m_istream

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

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


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