CoreComponents 4.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
BitSource Class Referencefinal

Read from a ByteSource bit-vise. More...

#include <cc/BitSource>

Public Types

using Item = bool
 Item type.
 

Public Member Functions

 BitSource (const ByteSource &source)
 Create a new bit source.
 
 BitSource (const Bytes &bytes)
 Create a new bit source.
 
bool readBit ()
 Read a single bit.
 
template<int n, class T >
readBits ()
 Read n bits and return as word of type T.
 
bool read (Out< bool > bit)
 Read a single bit.
 
template<int n, class T >
bool read (Out< T > bits)
 Read n bits and return as word of type T.
 
SourceIterator< BitSourcebegin ()
 Iteration start.
 
SourceIterator< BitSourceend ()
 Iteration end.
 

Detailed Description

Read from a ByteSource bit-vise.

Member Typedef Documentation

◆ Item

using Item = bool

Item type.

Constructor & Destructor Documentation

◆ BitSource() [1/2]

BitSource ( const ByteSource source)

Create a new bit source.

◆ BitSource() [2/2]

BitSource ( const Bytes bytes)

Create a new bit source.

Member Function Documentation

◆ readBit()

bool readBit ( )

Read a single bit.

Exceptions
InputExhaustion

◆ readBits()

template<int n, class T >
T readBits ( )

Read n bits and return as word of type T.

Exceptions
InputExhaustion

◆ read() [1/2]

bool read ( Out< bool >  bit)

Read a single bit.

Parameters
bitReturns the bit
Returns
True if successful, false otherwise

◆ read() [2/2]

template<int n, class T >
bool read ( Out< T >  bits)

Read n bits and return as word of type T.

Exceptions
InputExhaustion

◆ begin()

SourceIterator< BitSource > begin ( )

Iteration start.

◆ end()

Iteration end.