Reads bits from a BitBufferBase.
Definition at line 829 of file bitbuffer.hpp.
#include <bitbuffer.hpp>
◆ TStorage
◆ word
The current word, which is partly read and shifted to start with current bit.
Definition at line 835 of file bitbuffer.hpp.
◆ BitReader() [1/2]
Constructs a bit reader using the given bit buffer and starting to read at the beginning.
- Parameters
-
| buffer | The buffer to read from. |
Definition at line 840 of file bitbuffer.hpp.
◆ BitReader() [2/2]
Constructs a bit reader using the given bit buffer, starting to read at the given Index.
- Parameters
-
| buffer | The buffer to read from. |
| index | An index providing the postion of the first bit to read in buffer. |
Definition at line 847 of file bitbuffer.hpp.
◆ ~BitReader()
| alib::bitbuffer::BitReader::~BitReader |
( |
| ) |
|
|
inline |
Destructs a bit reader. In debug compilations an ALib Assertion is raised if the read operation passed the end of the underlying buffer was performed.
Definition at line 856 of file bitbuffer.hpp.
◆ ReadBits() [1/2]
| TResult alib::bitbuffer::BitReader::ReadBits |
( |
| ) |
|
Reads the given number of bits from the stream into the given unsigned integral value.
- Note
- Two different template functions (selected by keyword
requires) for the different integral types exist. One to read a number of bits that are less or equal to the internal buffer width, and one if there is more to read than the internal buffer width.
- See also
- This method uses a template parameter for the number of bits to read. A slightly slower, non-templated version is available with ReadBits(lang::ShiftOpRHS), which is to be used when the number of bits to read is determined only at runtime.
- Template Parameters
-
| TWidth | The number of bits in value to write. |
| TResult | The type of the value to return. |
- Returns
- The value read.
◆ ReadBits() [2/2]
template<typename TResult = int>
Reads the given number of bits from the stream into the given unsigned integral value.
- Note
- Two different implementations for different integral types exist and are selected with keyword
requires.
- See also
- A method that uses a template parameter for the number of bits to read, is available with ReadBits<TWidth,TResult>. This might be slightly faster and should be used instead of this method, whenever the number of bits to read is known at compilation time.
- Template Parameters
-
| TResult | The type of the value to return. Defaults to type int. |
- Parameters
-
| width | The number of bits to read. |
- Returns
- The value read.
◆ ReadInt()
template<typename TUIntegral>
| TUIntegral alib::bitbuffer::BitReader::ReadInt |
( |
| ) |
|
|
inline |
Reads the given integral value from the stream. Information about the encoding of the values is given with the documentation of WriteBits<TIntegral>(TIntegral).
Note that the implementation of this method consists of various versions which are selected using C++20 keyword requires.
- Template Parameters
-
| TUIntegral | The unsigned integral type to read. |
- Returns
- The value read from the bit buffer.
Definition at line 1098 of file bitbuffer.hpp.
◆ readUIntegral16()
| uint16_t alib::bitbuffer::BitReader::readUIntegral16 |
( |
| ) |
|
|
protected |
Internal method that reads a unsigned 16-bit value.
- Returns
- The value read.
Definition at line 209 of file bitbuffer.cpp.
◆ readUIntegral32()
| uint32_t alib::bitbuffer::BitReader::readUIntegral32 |
( |
| ) |
|
|
protected |
Internal method that reads a unsigned 32-bit value.
- Returns
- The value read.
Definition at line 218 of file bitbuffer.cpp.
◆ readUIntegral64()
| uint64_t alib::bitbuffer::BitReader::readUIntegral64 |
( |
| ) |
|
|
protected |
Internal method that reads a unsigned 64-bit value.
- Returns
- The value read.
Definition at line 227 of file bitbuffer.cpp.
◆ readUIntegral8()
| uint8_t alib::bitbuffer::BitReader::readUIntegral8 |
( |
| ) |
|
|
protected |
Internal method that reads a unsigned 8-bit value.
- Returns
- The value read.
Definition at line 200 of file bitbuffer.cpp.
◆ Reset() [1/2]
| void alib::bitbuffer::BitReader::Reset |
( |
| ) |
|
|
inline |
Resets this reader to the start of the bit buffer.
Definition at line 863 of file bitbuffer.hpp.
◆ Reset() [2/2]
Resets this reader to the given index position and calls Sync.
- Parameters
-
| index | The next read position. |
Definition at line 871 of file bitbuffer.hpp.
◆ Sync()
| BitReader & alib::bitbuffer::BitReader::Sync |
( |
| ) |
|
|
inline |
Re-reads the currently fetched storage word from the memory.
- Note
- This method is not needed in common use cases and implemented solely for the purpose to support unit-tests which write and write in parallel to the same bit buffer.
- Returns
- A reference to this
BitReader to allow concatenated operations.
Definition at line 882 of file bitbuffer.hpp.
The documentation for this class was generated from the following files: