Zserio C++17 runtime library
0.5.0
Built for Zserio 2.17.0
|
#include <BitStreamReader.h>
Classes | |
struct | ReaderContext |
Public Types | |
using | BitPosType = size_t |
Public Member Functions | |
BitStreamReader (const uint8_t *buffer, size_t bufferByteSize) | |
BitStreamReader (Span< const uint8_t > buffer) | |
BitStreamReader (Span< const uint8_t > buffer, size_t bufferBitSize) | |
BitStreamReader (const uint8_t *buffer, size_t bufferBitSize, BitsTag) | |
template<typename ALLOC > | |
BitStreamReader (const BasicBitBuffer< ALLOC > &bitBuffer) | |
~BitStreamReader ()=default | |
uint32_t | readUnsignedBits32 (uint8_t numBits=32) |
uint64_t | readUnsignedBits64 (uint8_t numBits=64) |
int32_t | readSignedBits32 (uint8_t numBits=32) |
int64_t | readSignedBits64 (uint8_t numBits=64) |
Bool | readBool () |
VarInt16 | readVarInt16 () |
VarInt32 | readVarInt32 () |
VarInt64 | readVarInt64 () |
VarInt | readVarInt () |
VarUInt16 | readVarUInt16 () |
VarUInt32 | readVarUInt32 () |
VarUInt64 | readVarUInt64 () |
VarUInt | readVarUInt () |
VarSize | readVarSize () |
Float16 | readFloat16 () |
Float32 | readFloat32 () |
Float64 | readFloat64 () |
template<typename ALLOC = std::allocator<uint8_t>> | |
BasicBytes< ALLOC > | readBytes (const ALLOC &alloc=ALLOC()) |
template<typename ALLOC = std::allocator<char>> | |
BasicString< ALLOC > | readString (const ALLOC &alloc=ALLOC()) |
template<typename ALLOC = std::allocator<uint8_t>> | |
BasicBitBuffer< RebindAlloc< ALLOC, uint8_t > > | readBitBuffer (const ALLOC &allocator=ALLOC()) |
BitPosType | getBitPosition () const |
void | setBitPosition (BitPosType position) |
void | alignTo (size_t alignment) |
size_t | getBufferBitSize () const |
Reader class which allows to read various data from the bit stream.
Definition at line 20 of file BitStreamReader.h.
using zserio::BitStreamReader::BitPosType = size_t |
Type for bit position.
Definition at line 24 of file BitStreamReader.h.
|
explicit |
Constructor from raw buffer.
buffer | Pointer to the buffer to read. |
bufferByteSize | Size of the buffer in bytes. |
Definition at line 372 of file BitStreamReader.cpp.
|
explicit |
Constructor from buffer passed as a Span.
buffer | Buffer to read. |
Definition at line 376 of file BitStreamReader.cpp.
|
explicit |
Constructor from buffer passed as a Span with exact bit size.
buffer | Buffer to read. |
bufferBitSize | Size of the buffer in bits. |
Definition at line 380 of file BitStreamReader.cpp.
|
explicit |
Constructor from raw buffer with exact bit size.
buffer | Pointer to buffer to read. |
bufferBitSize | Size of the buffer in bits. |
Definition at line 390 of file BitStreamReader.cpp.
|
inlineexplicit |
Constructor from bit buffer.
bitBuffer | Bit buffer to read from. |
Definition at line 103 of file BitStreamReader.h.
|
default |
Destructor.
void zserio::BitStreamReader::alignTo | ( | size_t | alignment | ) |
Moves current bit position to perform the requested bit alignment.
alignment | Size of the alignment in bits. |
Definition at line 858 of file BitStreamReader.cpp.
|
inline |
Gets current bit position.
Definition at line 351 of file BitStreamReader.h.
|
inline |
Gets size of the underlying buffer in bits.
Definition at line 375 of file BitStreamReader.h.
|
inline |
Reads a bit buffer.
alloc | Allocator to use. |
Definition at line 313 of file BitStreamReader.h.
Bool zserio::BitStreamReader::readBool | ( | ) |
Reads bool as a single bit.
Definition at line 452 of file BitStreamReader.cpp.
|
inline |
Reads bytes.
alloc | Allocator to use. |
Definition at line 247 of file BitStreamReader.h.
Float16 zserio::BitStreamReader::readFloat16 | ( | ) |
Float32 zserio::BitStreamReader::readFloat32 | ( | ) |
Float64 zserio::BitStreamReader::readFloat64 | ( | ) |
int32_t zserio::BitStreamReader::readSignedBits32 | ( | uint8_t | numBits = 32 | ) |
Reads signed bits up to 32-bits.
numBits | Number of bits to read. |
Definition at line 445 of file BitStreamReader.cpp.
int64_t zserio::BitStreamReader::readSignedBits64 | ( | uint8_t | numBits = 64 | ) |
Reads signed bits up to 64-bits.
numBits | Number of bits to read. |
Definition at line 417 of file BitStreamReader.cpp.
|
inline |
Reads an UTF-8 string.
alloc | Allocator to use. |
Definition at line 279 of file BitStreamReader.h.
uint32_t zserio::BitStreamReader::readUnsignedBits32 | ( | uint8_t | numBits = 32 | ) |
Reads unsigned bits up to 32-bits.
numBits | Number of bits to read. |
Definition at line 394 of file BitStreamReader.cpp.
uint64_t zserio::BitStreamReader::readUnsignedBits64 | ( | uint8_t | numBits = 64 | ) |
Reads unsigned bits up to 64-bits.
numBits | Number of bits to read. |
Definition at line 401 of file BitStreamReader.cpp.
VarInt zserio::BitStreamReader::readVarInt | ( | ) |
Reads signed variable integer up to 72 bits.
Definition at line 556 of file BitStreamReader.cpp.
VarInt16 zserio::BitStreamReader::readVarInt16 | ( | ) |
Reads signed variable integer up to 16 bits.
Definition at line 457 of file BitStreamReader.cpp.
VarInt32 zserio::BitStreamReader::readVarInt32 | ( | ) |
Reads signed variable integer up to 32 bits.
Definition at line 472 of file BitStreamReader.cpp.
VarInt64 zserio::BitStreamReader::readVarInt64 | ( | ) |
Reads signed variable integer up to 32 bits.
Definition at line 500 of file BitStreamReader.cpp.
VarSize zserio::BitStreamReader::readVarSize | ( | ) |
Read variable size integer up to 40 bits.
Definition at line 777 of file BitStreamReader.cpp.
VarUInt zserio::BitStreamReader::readVarUInt | ( | ) |
Read unsigned variable integer up to 72 bits.
Definition at line 715 of file BitStreamReader.cpp.
VarUInt16 zserio::BitStreamReader::readVarUInt16 | ( | ) |
Read unsigned variable integer up to 16 bits.
Definition at line 619 of file BitStreamReader.cpp.
VarUInt32 zserio::BitStreamReader::readVarUInt32 | ( | ) |
Read unsigned variable integer up to 32 bits.
Definition at line 633 of file BitStreamReader.cpp.
VarUInt64 zserio::BitStreamReader::readVarUInt64 | ( | ) |
Read unsigned variable integer up to 64 bits.
Definition at line 660 of file BitStreamReader.cpp.
void zserio::BitStreamReader::setBitPosition | ( | BitPosType | position | ) |
Sets current bit position. Use with caution!
position | New bit position. |
Definition at line 842 of file BitStreamReader.cpp.