#include <Decoder.h>
Public Member Functions | |
BitpackStringDecoder (unsigned bytestreamNumber, SourceDestBuffer &dbuf, uint64_t maxRecordCount) | |
size_t | inputProcessAligned (const char *inbuf, const size_t firstBit, const size_t endBit) override |
Public Member Functions inherited from e57::BitpackDecoder | |
void | destBufferSetNew (std::vector< SourceDestBuffer > &dbufs) override |
size_t | inputProcess (const char *source, const size_t availableByteCount) override |
virtual size_t | inputProcessAligned (const char *inbuf, const size_t firstBit, const size_t endBit)=0 |
void | stateReset () override |
uint64_t | totalRecordsCompleted () override |
Public Member Functions inherited from e57::Decoder | |
unsigned | bytestreamNumber () const |
Decoder ()=delete | |
virtual void | destBufferSetNew (std::vector< SourceDestBuffer > &dbufs)=0 |
virtual size_t | inputProcess (const char *source, const size_t count)=0 |
virtual void | stateReset ()=0 |
virtual uint64_t | totalRecordsCompleted ()=0 |
virtual | ~Decoder ()=default |
Protected Attributes | |
ustring | currentString_ |
int | nBytesPrefixRead_ = 0 |
uint64_t | nBytesStringRead_ = 0 |
uint8_t | prefixBytes_ [8] = {} |
int | prefixLength_ = 1 |
bool | readingPrefix_ = true |
uint64_t | stringLength_ = 0 |
Protected Attributes inherited from e57::BitpackDecoder | |
unsigned int | bitsPerWord_ |
unsigned int | bytesPerWord_ |
uint64_t | currentRecordIndex_ = 0 |
std::shared_ptr< SourceDestBufferImpl > | destBuffer_ |
std::vector< char > | inBuffer_ |
unsigned int | inBufferAlignmentSize_ |
size_t | inBufferEndByte_ = 0 |
size_t | inBufferFirstBit_ = 0 |
uint64_t | maxRecordCount_ = 0 |
Protected Attributes inherited from e57::Decoder | |
unsigned int | bytestreamNumber_ |
Additional Inherited Members | |
Static Public Member Functions inherited from e57::Decoder | |
static std::shared_ptr< Decoder > | DecoderFactory (unsigned bytestreamNumber, const CompressedVectorNodeImpl *cVector, std::vector< SourceDestBuffer > &dbufs, const ustring &codecPath) |
Protected Member Functions inherited from e57::BitpackDecoder | |
BitpackDecoder (unsigned bytestreamNumber, SourceDestBuffer &dbuf, unsigned alignmentSize, uint64_t maxRecordCount) | |
void | inBufferShiftDown () |
Protected Member Functions inherited from e57::Decoder | |
Decoder (unsigned bytestreamNumber) | |
BitpackStringDecoder::BitpackStringDecoder | ( | unsigned | bytestreamNumber, |
SourceDestBuffer & | dbuf, | ||
uint64_t | maxRecordCount | ||
) |
|
overridevirtual |
Read from inbuf, decode, store in destBuffer Repeat until have filled destBuffer, or completed all records
Converts start/end bits to whole bytes
Loop until we've finished all the records, or ran out of input currently available
Try to read more prefix bytes
If first byte of prefix, test the least significant bit to see how long prefix is
Accumulate prefix bytes
If got all of prefix, convert to length and get ready to read string
Single byte prefix, extract length from b7-b1. Removing the least significant bit (which says this is a short prefix).
Eight byte prefix, extract length from b63-b1. Little endian ordering. Removing the least significant bit (which says this is a long prefix).
Get ready to read string contents
If currently reading string contents, keep doing it until have complete string
Calc how many bytes we need to complete current string
Can process the smaller of unread or needed bytes
Append to current string and update counts
Check if completed reading the string contents
Save accumulated string to dest buffer
Get ready to read next prefix
Returned number of bits processed (always a multiple of alignment size).
Implements e57::BitpackDecoder.
References e57::BitpackDecoder::currentRecordIndex_, currentString_, e57::BitpackDecoder::destBuffer_, e57::E57_ERROR_INTERNAL, e57::BitpackDecoder::maxRecordCount_, nBytesPrefixRead_, nBytesStringRead_, prefixBytes_, prefixLength_, readingPrefix_, stringLength_, and e57::toString().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().
|
protected |
Referenced by inputProcessAligned().