Offers capabilities to read data bit per bit.
More...
Offers capabilities to read data bit per bit.
◆ BitStream()
nkMemory::BitStream::BitStream |
( |
BufferView<> |
data | ) |
|
|
noexcept |
Constructor.
- Parameters
-
data | The data buffer to work on. |
◆ getData()
- Returns
- The data used by the stream.
◆ getCurrentByte()
unsigned char nkMemory::BitStream::getCurrentByte |
( |
| ) |
const |
- Returns
- The current byte within the buffer. Shorthand for indexing the data using the current byte counter.
◆ getByteCounter()
unsigned int nkMemory::BitStream::getByteCounter |
( |
| ) |
const |
- Returns
- The current byte counter, which corresponds to the byte index the stream is currently on.
◆ getBitCounter()
unsigned int nkMemory::BitStream::getBitCounter |
( |
| ) |
const |
- Returns
- The current bit counter, which corresponds to the bit index, within the current byte, the stream is currently on.
◆ isAtEos()
bool nkMemory::BitStream::isAtEos |
( |
| ) |
const |
Checks whether the stream is at the end of the available data.
- Returns
- Whether the stream is fully read (true) or not (false).
◆ peekMsb()
unsigned int nkMemory::BitStream::peekMsb |
( |
unsigned int |
count | ) |
|
Peeks bits from the position the stream is currently on, for a Most-Significant-Byte first layout. The stream does not moves forward during this operation.
- Parameters
-
count | The number of bits to read. |
- Returns
- The result of the reading.
◆ peekLsb()
unsigned int nkMemory::BitStream::peekLsb |
( |
unsigned int |
count | ) |
|
Peeks bits from the position the stream is currently on, for a Least-Significant-Byte first layout. The stream does not moves forward during this operation.
- Parameters
-
count | The number of bits to read. |
- Returns
- The result of the reading.
◆ readMsb()
unsigned int nkMemory::BitStream::readMsb |
( |
unsigned int |
count | ) |
|
Read bits, moving the stream forward, for a Most-Significant-Byte first layout.
- Parameters
-
count | The number of bits to read. |
- Returns
- The result of the reading.
◆ readLsb()
unsigned int nkMemory::BitStream::readLsb |
( |
unsigned int |
count | ) |
|
Read bits, moving the stream forward, for a Least-Significant-Byte first layout.
- Parameters
-
count | The number of bits to read. |
- Returns
- The result of the reading.
◆ moveForward()
void nkMemory::BitStream::moveForward |
( |
unsigned int |
count | ) |
|
Move the stream forward.
- Parameters
-
count | The number of bits to move forward. |
◆ moveToNextByte()
void nkMemory::BitStream::moveToNextByte |
( |
| ) |
|
Moves the stream at the next byte's boundary. Useful to skip bits used for padding within a byte, for instance.
◆ moveTo()
void nkMemory::BitStream::moveTo |
( |
unsigned int |
byteCount, |
|
|
unsigned int |
bitCount |
|
) |
| |
Moves the stream to a given position.
- Parameters
-
byteCount | The byte index to move to, within [0, streamByteSize]. |
bitCount | The bit index within the byte to move to, within [0, 7]. |
◆ rewind()
void nkMemory::BitStream::rewind |
( |
| ) |
|
Rewinds the stream fully, restarting its reading from the beginning.
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsMemory/Streams/BitStream.h