Zserio C++ runtime library
1.0.0
Built for Zserio 2.13.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 | readBits (uint8_t numBits=32) |
uint64_t | readBits64 (uint8_t numBits=64) |
int32_t | readSignedBits (uint8_t numBits=32) |
int64_t | readSignedBits64 (uint8_t numBits=64) |
int64_t | readVarInt64 () |
int32_t | readVarInt32 () |
int16_t | readVarInt16 () |
uint64_t | readVarUInt64 () |
uint32_t | readVarUInt32 () |
uint16_t | readVarUInt16 () |
int64_t | readVarInt () |
uint64_t | readVarUInt () |
uint32_t | readVarSize () |
float | readFloat16 () |
float | readFloat32 () |
double | readFloat64 () |
template<typename ALLOC = std::allocator<uint8_t>> | |
vector< uint8_t, ALLOC > | readBytes (const ALLOC &alloc=ALLOC()) |
template<typename ALLOC = std::allocator<char>> | |
string< ALLOC > | readString (const ALLOC &alloc=ALLOC()) |
bool | readBool () |
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 21 of file BitStreamReader.h.
using zserio::BitStreamReader::BitPosType = size_t |
Type for bit position.
Definition at line 25 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 316 of file BitStreamReader.cpp.
|
explicit |
Constructor from buffer passed as a Span.
buffer | Buffer to read. |
Definition at line 320 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 324 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 334 of file BitStreamReader.cpp.
|
inlineexplicit |
Constructor from bit buffer.
bitBuffer | Bit buffer to read from. |
Definition at line 104 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 704 of file BitStreamReader.cpp.
|
inline |
Gets current bit position.
Definition at line 342 of file BitStreamReader.h.
|
inline |
Gets size of the underlying buffer in bits.
Definition at line 363 of file BitStreamReader.h.
|
inline |
Reads a bit buffer.
alloc | Allocator to use. |
Definition at line 308 of file BitStreamReader.h.
uint32_t zserio::BitStreamReader::readBits | ( | uint8_t | numBits = 32 | ) |
Reads unsigned bits up to 32-bits.
numBits | Number of bits to read. |
Definition at line 338 of file BitStreamReader.cpp.
uint64_t zserio::BitStreamReader::readBits64 | ( | uint8_t | numBits = 64 | ) |
Reads unsigned bits up to 64-bits.
numBits | Number of bits to read. |
Definition at line 345 of file BitStreamReader.cpp.
bool zserio::BitStreamReader::readBool | ( | ) |
Reads bool as a single bit.
Definition at line 687 of file BitStreamReader.cpp.
|
inline |
Reads bytes.
alloc | Allocator to use. |
Definition at line 241 of file BitStreamReader.h.
float zserio::BitStreamReader::readFloat16 | ( | ) |
float zserio::BitStreamReader::readFloat32 | ( | ) |
double zserio::BitStreamReader::readFloat64 | ( | ) |
int32_t zserio::BitStreamReader::readSignedBits | ( | uint8_t | numBits = 32 | ) |
Reads signed bits up to 32-bits.
numBits | Number of bits to read. |
Definition at line 383 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 359 of file BitStreamReader.cpp.
|
inline |
Reads an UTF-8 string.
alloc | Allocator to use. |
Definition at line 271 of file BitStreamReader.h.
int64_t zserio::BitStreamReader::readVarInt | ( | ) |
Reads signed variable integer up to 72 bits.
Definition at line 539 of file BitStreamReader.cpp.
int16_t zserio::BitStreamReader::readVarInt16 | ( | ) |
Reads signed variable integer up to 16 bits.
Definition at line 454 of file BitStreamReader.cpp.
int32_t zserio::BitStreamReader::readVarInt32 | ( | ) |
Reads signed variable integer up to 32 bits.
Definition at line 432 of file BitStreamReader.cpp.
int64_t zserio::BitStreamReader::readVarInt64 | ( | ) |
Reads signed variable integer up to 64 bits.
Definition at line 390 of file BitStreamReader.cpp.
uint32_t zserio::BitStreamReader::readVarSize | ( | ) |
Read variable size integer up to 40 bits.
Definition at line 632 of file BitStreamReader.cpp.
uint64_t zserio::BitStreamReader::readVarUInt | ( | ) |
Read unsigned variable integer up to 72 bits.
Definition at line 586 of file BitStreamReader.cpp.
uint16_t zserio::BitStreamReader::readVarUInt16 | ( | ) |
Read unsigned variable integer up to 16 bits.
Definition at line 528 of file BitStreamReader.cpp.
uint32_t zserio::BitStreamReader::readVarUInt32 | ( | ) |
Read unsigned variable integer up to 32 bits.
Definition at line 507 of file BitStreamReader.cpp.
uint64_t zserio::BitStreamReader::readVarUInt64 | ( | ) |
Read unsigned variable integer up to 64 bits.
Definition at line 466 of file BitStreamReader.cpp.
void zserio::BitStreamReader::setBitPosition | ( | BitPosType | position | ) |
Sets current bit position. Use with caution!
position | New bit position. |
Definition at line 692 of file BitStreamReader.cpp.