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.
|
|
| BitReader (const char *buffer, const char *end) |
| Constructs a new BitReader.
|
|
template<typename intType > |
intType | readBits (std::uint8_t bitCount) |
| Reads the specified number of bits from the buffer advancing the current position by bitCount bits.
|
|
std::uint8_t | readBit () |
| Reads the one bit from the buffer advancing the current position by one bit.
|
|
template<typename intType > |
intType | readUnsignedExpGolombCodedBits () |
| Reads "Exp-Golomb coded" bits (unsigned).
|
|
template<typename intType > |
intType | readSignedExpGolombCodedBits () |
| Reads "Exp-Golomb coded" bits (signed).
|
|
template<typename intType > |
intType | showBits (std::uint8_t bitCount) |
| Reads the specified number of bits from the buffer without advancing the current position.
|
|
void | skipBits (std::size_t bitCount) |
| Skips the specified number of bits without reading it.
|
|
void | align () |
| Re-establishes alignment.
|
|
std::size_t | bitsAvailable () |
| Returns the number of bits which are still available to read.
|
|
void | reset (const char *buffer, std::size_t bufferSize) |
| Resets the reader.
|
|
void | reset (const char *buffer, const char *end) |
| Resets the reader.
|
|
The BitReader class provides bitwise reading of buffered data.
Definition at line 13 of file bitreader.h.
◆ BitReader() [1/2]
CppUtilities::BitReader::BitReader |
( |
const char * |
buffer, |
|
|
std::size_t |
bufferSize |
|
) |
| |
|
inline |
◆ BitReader() [2/2]
CppUtilities::BitReader::BitReader |
( |
const char * |
buffer, |
|
|
const char * |
end |
|
) |
| |
|
inline |
◆ align()
void CppUtilities::BitReader::align |
( |
| ) |
|
|
inline |
◆ bitsAvailable()
std::size_t CppUtilities::BitReader::bitsAvailable |
( |
| ) |
|
|
inline |
Returns the number of bits which are still available to read.
Definition at line 137 of file bitreader.h.
◆ readBit()
std::uint8_t CppUtilities::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 CppUtilities::BitReader::readBits |
( |
std::uint8_t |
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 67 of file bitreader.h.
◆ readSignedExpGolombCodedBits()
template<typename intType >
intType CppUtilities::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 CppUtilities::BitReader::readUnsignedExpGolombCodedBits |
◆ reset() [1/2]
void CppUtilities::BitReader::reset |
( |
const char * |
buffer, |
|
|
const char * |
end |
|
) |
| |
|
inline |
◆ reset() [2/2]
void CppUtilities::BitReader::reset |
( |
const char * |
buffer, |
|
|
std::size_t |
bufferSize |
|
) |
| |
|
inline |
◆ showBits()
template<typename intType >
intType CppUtilities::BitReader::showBits |
( |
std::uint8_t |
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 CppUtilities::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 18 of file bitreader.cpp.
The documentation for this class was generated from the following files: