Wrapper for input streams that provides bitwise reading functionality.
More...
#include <BitIStream.hpp>
Wrapper for input streams that provides bitwise reading functionality.
The current byte in the underlying input stream is buffered and processed bitwise using another cursor.
Definition at line 16 of file BitIStream.hpp.
◆ BitIStream() [1/2]
tdc::io::BitIStream::BitIStream |
( |
InputStream && |
input | ) |
|
|
inline |
Constructs a bitwise input stream.
- Parameters
-
input | The underlying input stream. |
Definition at line 69 of file BitIStream.hpp.
◆ BitIStream() [2/2]
tdc::io::BitIStream::BitIStream |
( |
Input & |
input | ) |
|
|
inline |
Constructs a bitwise input stream.
- Parameters
-
input | The underlying input. |
Definition at line 86 of file BitIStream.hpp.
◆ eof()
bool tdc::io::BitIStream::eof |
( |
| ) |
const |
|
inline |
◆ read_bit()
uint8_t tdc::io::BitIStream::read_bit |
( |
| ) |
|
|
inline |
Reads the next single bit from the input.
- Returns
- 1 if the next bit is set, 0 otherwise.
Definition at line 91 of file BitIStream.hpp.
◆ read_compressed_int()
template<typename T = size_t>
T tdc::io::BitIStream::read_compressed_int |
( |
size_t |
b = 7 | ) |
|
|
inline |
Reads a compressed integer from the input.
The compressed form of an integer n
is achieved by splitting up the bit representation of n
in blocks of width b
. For each non-zero block (in little endian order), a 1-bit and the block itself is written. The compressed integer is finally terminated by a 0-bit.
- Template Parameters
-
- Parameters
-
b | The block width in bits. The default is 7 bits. |
- Returns
- The read integer value.
Definition at line 175 of file BitIStream.hpp.
◆ read_elias_delta()
template<typename value_t >
value_t tdc::io::BitIStream::read_elias_delta |
( |
| ) |
|
|
inline |
◆ read_elias_gamma()
template<typename value_t >
value_t tdc::io::BitIStream::read_elias_gamma |
( |
| ) |
|
|
inline |
◆ read_int()
template<class T >
T tdc::io::BitIStream::read_int |
( |
size_t |
amount = sizeof(T) * CHAR_BIT | ) |
|
|
inline |
Reads the integer value of the next amount
bits in MSB first order.
- Template Parameters
-
- Parameters
-
amount | The bit width of the integer to read. By default, this equals the bit width of type T . |
- Returns
- The integer value of the next
amount
bits in MSB first order.
Definition at line 119 of file BitIStream.hpp.
◆ read_ternary()
template<typename value_t >
value_t tdc::io::BitIStream::read_ternary |
( |
| ) |
|
|
inline |
◆ read_unary()
template<typename value_t >
value_t tdc::io::BitIStream::read_unary |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file: