e57::BitpackEncoder Class Referenceabstract

#include <Encoder.h>

Public Member Functions

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
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
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 Member Functions

 BitpackEncoder (unsigned bytestreamNumber, SourceDestBuffer &sbuf, unsigned outputMaxSize, unsigned alignmentSize)
 ================ More...
void outBufferShiftDown ()
- Protected Member Functions inherited from e57::Encoder
 Encoder (unsigned bytestreamNumber)

Protected Attributes

uint64_t currentRecordIndex_
std::vector< char > outBuffer_
size_t outBufferAlignmentSize_
size_t outBufferEnd_
size_t outBufferFirst_
std::shared_ptr< SourceDestBufferImplsourceBuffer_
- Protected Attributes inherited from e57::Encoder
unsigned bytestreamNumber_

Additional Inherited Members

- Static Public Member Functions inherited from e57::Encoder
static std::shared_ptr< EncoderEncoderFactory (unsigned bytestreamNumber, std::shared_ptr< CompressedVectorNodeImpl > cVector, std::vector< SourceDestBuffer > &sbuf, ustring &codecPath)

Constructor & Destructor Documentation

◆ BitpackEncoder()

BitpackEncoder::BitpackEncoder ( unsigned  bytestreamNumber,
SourceDestBuffer sbuf,
unsigned  outputMaxSize,
unsigned  alignmentSize 


Member Function Documentation

◆ bitsPerRecord()

float e57::BitpackEncoder::bitsPerRecord ( )
overridepure virtual

◆ currentRecordIndex()

uint64_t BitpackEncoder::currentRecordIndex ( )

Implements e57::Encoder.

References currentRecordIndex_.

◆ outBufferShiftDown()

void BitpackEncoder::outBufferShiftDown ( )

Move data down closer to beginning of outBuffer_. But keep outBufferEnd_ as a multiple of outBufferAlignmentSize_. This ensures that writes into buffer can occur on natural boundaries. Otherwise some CPUs will fault.

Buffer is empty, reset indices to 0

Round newEnd up to nearest multiple of outBufferAlignmentSize_.

Double check round up worked

Be paranoid before memory copy

Move available data down closer to beginning of outBuffer_. Overlapping regions ok with memmove().

Update indexes

References e57::E57_ERROR_INTERNAL, outBuffer_, outBufferAlignmentSize_, outBufferEnd_, outBufferFirst_, outputAvailable(), and e57::toString().

Referenced by e57::BitpackFloatEncoder::processRecords(), and e57::BitpackStringEncoder::processRecords().

◆ outputAvailable()

size_t BitpackEncoder::outputAvailable ( ) const

Implements e57::Encoder.

References outBufferEnd_, and outBufferFirst_.

Referenced by outBufferShiftDown(), and outputRead().

◆ outputClear()

void BitpackEncoder::outputClear ( )

get data from encoder

Implements e57::Encoder.

References outBufferEnd_, and outBufferFirst_.

◆ outputGetMaxSize()

size_t BitpackEncoder::outputGetMaxSize ( )

Its size that matters here, not capacity

Implements e57::Encoder.

References outBuffer_.

◆ outputRead()

void BitpackEncoder::outputRead ( char *  dest,
const size_t  byteCount 

number of bytes that can be read

Check we have enough bytes in queue

Copy output bytes to caller

Advance head pointer.

Don't slide remaining data down now, wait until do some more processing (that's when data needs to be aligned).

Implements e57::Encoder.

References e57::E57_ERROR_INTERNAL, outBuffer_, outBufferFirst_, outputAvailable(), and e57::toString().

◆ outputSetMaxSize()

void BitpackEncoder::outputSetMaxSize ( unsigned  byteCount)

Ignore if trying to shrink buffer (queue might get messed up).

Implements e57::Encoder.

References outBuffer_.

◆ processRecords()

uint64_t e57::BitpackEncoder::processRecords ( size_t  recordCount)
overridepure virtual

◆ registerFlushToOutput()

bool e57::BitpackEncoder::registerFlushToOutput ( )
overridepure virtual

◆ sourceBufferNextIndex()

unsigned BitpackEncoder::sourceBufferNextIndex ( )

Implements e57::Encoder.

References sourceBuffer_.

◆ sourceBufferSetNew()

void BitpackEncoder::sourceBufferSetNew ( std::vector< SourceDestBuffer > &  sbufs)

Verify that this encoder only has single input buffer

Implements e57::Encoder.

References e57::E57_ERROR_INTERNAL, sourceBuffer_, and e57::toString().

Member Data Documentation

◆ currentRecordIndex_

◆ outBuffer_

◆ outBufferAlignmentSize_

size_t e57::BitpackEncoder::outBufferAlignmentSize_

Referenced by outBufferShiftDown().

◆ outBufferEnd_

◆ outBufferFirst_

size_t e57::BitpackEncoder::outBufferFirst_

◆ sourceBuffer_

The documentation for this class was generated from the following files: