#include <Encoder.h>
Public Member Functions | |
BitpackStringEncoder (unsigned bytestreamNumber, SourceDestBuffer &sbuf, unsigned outputMaxSize) | |
float | bitsPerRecord () override |
uint64_t | processRecords (size_t recordCount) override |
bool | registerFlushToOutput () override |
Public Member Functions inherited from e57::BitpackEncoder | |
float | bitsPerRecord () override=0 |
uint64_t | currentRecordIndex () override |
size_t | outputAvailable () const override |
void | outputClear () override |
get data from encoder More... | |
size_t | outputGetMaxSize () override |
void | outputRead (char *dest, const size_t byteCount) override |
number of bytes that can be read More... | |
void | outputSetMaxSize (unsigned byteCount) override |
uint64_t | processRecords (size_t recordCount) override=0 |
bool | registerFlushToOutput () override=0 |
unsigned | sourceBufferNextIndex () override |
void | sourceBufferSetNew (std::vector< SourceDestBuffer > &sbufs) override |
Public Member Functions inherited from e57::Encoder | |
virtual float | bitsPerRecord ()=0 |
unsigned | bytestreamNumber () const |
virtual uint64_t | currentRecordIndex ()=0 |
virtual size_t | outputAvailable () const =0 |
virtual void | outputClear ()=0 |
get data from encoder More... | |
virtual size_t | outputGetMaxSize ()=0 |
virtual void | outputRead (char *dest, const size_t byteCount)=0 |
number of bytes that can be read More... | |
virtual void | outputSetMaxSize (unsigned byteCount)=0 |
virtual uint64_t | processRecords (size_t recordCount)=0 |
virtual bool | registerFlushToOutput ()=0 |
virtual unsigned | sourceBufferNextIndex ()=0 |
virtual void | sourceBufferSetNew (std::vector< SourceDestBuffer > &sbufs)=0 |
virtual | ~Encoder ()=default |
Protected Attributes | |
size_t | currentCharPosition_ |
ustring | currentString_ |
bool | isStringActive_ |
bool | prefixComplete_ |
uint64_t | totalBytesProcessed_ |
Protected Attributes inherited from e57::BitpackEncoder | |
uint64_t | currentRecordIndex_ |
std::vector< char > | outBuffer_ |
size_t | outBufferAlignmentSize_ |
size_t | outBufferEnd_ |
size_t | outBufferFirst_ |
std::shared_ptr< SourceDestBufferImpl > | sourceBuffer_ |
Protected Attributes inherited from e57::Encoder | |
unsigned | bytestreamNumber_ |
Additional Inherited Members | |
Static Public Member Functions inherited from e57::Encoder | |
static std::shared_ptr< Encoder > | EncoderFactory (unsigned bytestreamNumber, std::shared_ptr< CompressedVectorNodeImpl > cVector, std::vector< SourceDestBuffer > &sbuf, ustring &codecPath) |
Protected Member Functions inherited from e57::BitpackEncoder | |
BitpackEncoder (unsigned bytestreamNumber, SourceDestBuffer &sbuf, unsigned outputMaxSize, unsigned alignmentSize) | |
================ More... | |
void | outBufferShiftDown () |
Protected Member Functions inherited from e57::Encoder | |
Encoder (unsigned bytestreamNumber) | |
BitpackStringEncoder::BitpackStringEncoder | ( | unsigned | bytestreamNumber, |
SourceDestBuffer & | sbuf, | ||
unsigned | outputMaxSize | ||
) |
|
overridevirtual |
Return average number of bits in strings + 8 bits for prefix
We haven't completed a record yet, so guess 100 bytes per record
Implements e57::BitpackEncoder.
References e57::BitpackEncoder::currentRecordIndex_, and totalBytesProcessed_.
|
overridevirtual |
Before we add any more, try to shift current contents of outBuffer_ down to beginning of buffer.
Figure out how many bytes outBuffer can accept.
Form the starting address for next available location in outBuffer
Don't start loop unless have at least 8 bytes for worst case string length prefix
Calc the length prefix, either 1 byte or 8 bytes
We can use the short length prefix: b0=0, b7-b1=len
We use the long length prefix: b0=1, b63-b1=len, and store in little endian order Shift the length and set the least significant bit, b0=1.
Copy as much string as will fit in outBuffer
Check if finished string
Get next string from sourceBuffer
Update end of outBuffer
Update counts of records processed
Implements e57::BitpackEncoder.
References currentCharPosition_, e57::BitpackEncoder::currentRecordIndex_, currentString_, e57::E57_ERROR_INTERNAL, isStringActive_, e57::BitpackEncoder::outBuffer_, e57::BitpackEncoder::outBufferEnd_, e57::BitpackEncoder::outBufferShiftDown(), prefixComplete_, e57::BitpackEncoder::sourceBuffer_, e57::toString(), and totalBytesProcessed_.
|
overridevirtual |
Since have no registers in encoder, return success
Implements e57::BitpackEncoder.
|
protected |
Referenced by processRecords().
|
protected |
Referenced by processRecords().
|
protected |
Referenced by processRecords().
|
protected |
Referenced by processRecords().
|
protected |
Referenced by bitsPerRecord(), and processRecords().