e57::BitpackIntegerEncoder< RegisterT > Class Template Reference

#include <Encoder.h>

Public Member Functions

 BitpackIntegerEncoder (bool isScaledInteger, unsigned bytestreamNumber, SourceDestBuffer &sbuf, unsigned outputMaxSize, int64_t minimum, int64_t maximum, double scale, double offset)
 
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

unsigned bitsPerRecord_
 
bool isScaledInteger_
 
int64_t maximum_
 
int64_t minimum_
 
double offset_
 
RegisterT register_
 
unsigned registerBitsUsed_
 
double scale_
 
uint64_t sourceBitMask_
 
- 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< 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)
 
- 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)
 

Constructor & Destructor Documentation

◆ BitpackIntegerEncoder()

Member Function Documentation

◆ bitsPerRecord()

template<typename RegisterT >
float BitpackIntegerEncoder::bitsPerRecord
overridevirtual

Implements e57::BitpackEncoder.

◆ processRecords()

template<typename RegisterT >
uint64_t BitpackIntegerEncoder::processRecords ( size_t  recordCount)
overridevirtual

Before we add any more, try to shift current contents of outBuffer_ down to beginning of buffer. This leaves outBufferEnd_ at a natural boundary.

Precalculate exact maximum number of records that will fit in output before overflow.

Number of transfers is the smaller of what was requested and what will fit.

Form the starting address for next available location in outBuffer

Copy bits from sourceBuffer_ to outBuffer_

The parameter isScaledInteger_ determines which version of getNextInt64 gets called

Enforce min/max specification on value

Mask off upper bits (just in case)

See if uValue bits will fit in register

Have more than one registers worth, fill register, transfer, then fill some more

Input will exactly fill register, insert value, then transfer

There is extra room in register, insert value, but don't do transfer yet

Update tail of output buffer

Update counts of records processed

Implements e57::BitpackEncoder.

References e57::binaryString(), e57::E57_ERROR_INTERNAL, e57::E57_ERROR_VALUE_OUT_OF_BOUNDS, e57::hexString(), and e57::toString().

◆ registerFlushToOutput()

template<typename RegisterT >
bool BitpackIntegerEncoder::registerFlushToOutput
overridevirtual

If have any used bits in register, transfer to output, padded in MSBits with zeros to RegisterT boundary

Implements e57::BitpackEncoder.

Member Data Documentation

◆ bitsPerRecord_

template<typename RegisterT >
unsigned e57::BitpackIntegerEncoder< RegisterT >::bitsPerRecord_
protected

◆ isScaledInteger_

template<typename RegisterT >
bool e57::BitpackIntegerEncoder< RegisterT >::isScaledInteger_
protected

◆ maximum_

template<typename RegisterT >
int64_t e57::BitpackIntegerEncoder< RegisterT >::maximum_
protected

◆ minimum_

template<typename RegisterT >
int64_t e57::BitpackIntegerEncoder< RegisterT >::minimum_
protected

◆ offset_

template<typename RegisterT >
double e57::BitpackIntegerEncoder< RegisterT >::offset_
protected

◆ register_

template<typename RegisterT >
RegisterT e57::BitpackIntegerEncoder< RegisterT >::register_
protected

◆ registerBitsUsed_

template<typename RegisterT >
unsigned e57::BitpackIntegerEncoder< RegisterT >::registerBitsUsed_
protected

◆ scale_

template<typename RegisterT >
double e57::BitpackIntegerEncoder< RegisterT >::scale_
protected

◆ sourceBitMask_

template<typename RegisterT >
uint64_t e57::BitpackIntegerEncoder< RegisterT >::sourceBitMask_
protected

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