The BitReader class provides bitwise reading of buffered data.
More...
#include <bitreader.h>
|
| BitReader (const char *buffer, std::size_t bufferSize) |
| Constructs a new BitReader. More...
|
|
| BitReader (const char *buffer, const char *end) |
| Constructs a new BitReader. More...
|
|
template<typename intType > |
intType | readBits (byte bitCount) |
| Reads the specified number of bits from the buffer advancing the current position by bitCount bits. More...
|
|
byte | readBit () |
| Reads the one bit from the buffer advancing the current position by one bit. More...
|
|
template<typename intType > |
intType | readUnsignedExpGolombCodedBits () |
| Reads "Exp-Golomb coded" bits (unsigned). More...
|
|
template<typename intType > |
intType | readSignedExpGolombCodedBits () |
| Reads "Exp-Golomb coded" bits (signed). More...
|
|
template<typename intType > |
intType | showBits (byte bitCount) |
| Reads the specified number of bits from the buffer without advancing the current position. More...
|
|
void | skipBits (std::size_t bitCount) |
| Skips the specified number of bits without reading it. More...
|
|
void | align () |
| Re-establishes alignment. More...
|
|
std::size_t | bitsAvailable () |
| Returns the number of bits which are still available to read. More...
|
|
void | reset (const char *buffer, std::size_t bufferSize) |
| Resets the reader. More...
|
|
void | reset (const char *buffer, const char *end) |
| Resets the reader. More...
|
|
The BitReader class provides bitwise reading of buffered data.
Definition at line 14 of file bitreader.h.
◆ BitReader() [1/2]
IoUtilities::BitReader::BitReader |
( |
const char * |
buffer, |
|
|
std::size_t |
bufferSize |
|
) |
| |
|
inline |
◆ BitReader() [2/2]
IoUtilities::BitReader::BitReader |
( |
const char * |
buffer, |
|
|
const char * |
end |
|
) |
| |
|
inline |
◆ align()
void IoUtilities::BitReader::align |
( |
| ) |
|
|
inline |
◆ bitsAvailable()
std::size_t IoUtilities::BitReader::bitsAvailable |
( |
| ) |
|
|
inline |
Returns the number of bits which are still available to read.
Definition at line 137 of file bitreader.h.
◆ readBit()
byte IoUtilities::BitReader::readBit |
( |
| ) |
|
|
inline |
Reads the one bit from the buffer advancing the current position by one bit.
- Exceptions
-
Throws | ios_base::failure if the end of the buffer is exceeded. The reader becomes invalid in that case. |
Definition at line 89 of file bitreader.h.
◆ readBits()
template<typename intType >
intType IoUtilities::BitReader::readBits |
( |
byte |
bitCount | ) |
|
Reads the specified number of bits from the buffer advancing the current position by bitCount bits.
- Parameters
-
bitCount | Specifies the number of bits read. |
- Template Parameters
-
intType | Specifies the type of the returned value. |
- Exceptions
-
Throws | ios_base::failure if the end of the buffer is exceeded. The reader becomes invalid in that case. |
Definition at line 68 of file bitreader.h.
◆ readSignedExpGolombCodedBits()
template<typename intType >
intType IoUtilities::BitReader::readSignedExpGolombCodedBits |
( |
| ) |
|
Reads "Exp-Golomb coded" bits (signed).
- Template Parameters
-
intType | Specifies the type of the returned value which should be signed (obviously). |
- Exceptions
-
Throws | ios_base::failure if the end of the buffer is exceeded. The reader becomes invalid in that case. |
- See also
- https://en.wikipedia.org/wiki/Exponential-Golomb_coding
Definition at line 119 of file bitreader.h.
◆ readUnsignedExpGolombCodedBits()
template<typename intType >
intType IoUtilities::BitReader::readUnsignedExpGolombCodedBits |
( |
| ) |
|
◆ reset() [1/2]
void IoUtilities::BitReader::reset |
( |
const char * |
buffer, |
|
|
std::size_t |
bufferSize |
|
) |
| |
|
inline |
◆ reset() [2/2]
void IoUtilities::BitReader::reset |
( |
const char * |
buffer, |
|
|
const char * |
end |
|
) |
| |
|
inline |
◆ showBits()
template<typename intType >
intType IoUtilities::BitReader::showBits |
( |
byte |
bitCount | ) |
|
Reads the specified number of bits from the buffer without advancing the current position.
Definition at line 128 of file bitreader.h.
◆ skipBits()
void IoUtilities::BitReader::skipBits |
( |
std::size_t |
bitCount | ) |
|
Skips the specified number of bits without reading it.
- Parameters
-
bitCount | Specifies the number of bits to skip. |
- Exceptions
-
Throws | std::ios_base::failure if the end of the buffer is exceeded. The reader becomes invalid in that case. |
Definition at line 19 of file bitreader.cpp.
The documentation for this class was generated from the following files: