ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
e57::BitpackStringDecoder Class Reference

#include <Decoder.h>

Inheritance diagram for e57::BitpackStringDecoder:
Collaboration diagram for e57::BitpackStringDecoder:

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
 
void dump (int indent=0, std::ostream &os=std::cout) override
 
- Public Member Functions inherited from e57::BitpackDecoder
void destBufferSetNew (std::vector< SourceDestBuffer > &dbufs) override
 
uint64_t totalRecordsCompleted () override
 
size_t inputProcess (const char *source, const size_t availableByteCount) override
 
void stateReset () override
 
- Public Member Functions inherited from e57::Decoder
 Decoder ()=delete
 
virtual ~Decoder ()=default
 
unsigned bytestreamNumber () const
 

Protected Attributes

bool readingPrefix_ = true
 
int prefixLength_ = 1
 
uint8_t prefixBytes_ [8] = {}
 
int nBytesPrefixRead_ = 0
 
uint64_t stringLength_ = 0
 
ustring currentString_
 
uint64_t nBytesStringRead_ = 0
 
- Protected Attributes inherited from e57::BitpackDecoder
uint64_t currentRecordIndex_ = 0
 
uint64_t maxRecordCount_ = 0
 
std::shared_ptr< SourceDestBufferImpldestBuffer_
 
std::vector< char > inBuffer_
 
size_t inBufferFirstBit_ = 0
 
size_t inBufferEndByte_ = 0
 
unsigned int inBufferAlignmentSize_
 
unsigned int bitsPerWord_
 
unsigned int bytesPerWord_
 
- Protected Attributes inherited from e57::Decoder
unsigned int bytestreamNumber_
 

Additional Inherited Members

- Static Public Member Functions inherited from e57::Decoder
static std::shared_ptr< DecoderDecoderFactory (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)
 

Detailed Description

Definition at line 113 of file Decoder.h.

Constructor & Destructor Documentation

◆ BitpackStringDecoder()

BitpackStringDecoder::BitpackStringDecoder ( unsigned  bytestreamNumber,
SourceDestBuffer dbuf,
uint64_t  maxRecordCount 
)

Definition at line 468 of file Decoder.cpp.

Member Function Documentation

◆ dump()

void BitpackStringDecoder::dump ( int  indent = 0,
std::ostream &  os = std::cout 
)
overridevirtual

◆ inputProcessAligned()

size_t BitpackStringDecoder::inputProcessAligned ( const char *  inbuf,
const size_t  firstBit,
const size_t  endBit 
)
overridevirtual

Read from inbuf, decode, store in destBuffer Repeat until have filled destBuffer, or completed all records

Verify first bit is zero (always byte-aligned)

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.

Definition at line 474 of file Decoder.cpp.

References e57::BitpackDecoder::currentRecordIndex_, currentString_, e57::BitpackDecoder::destBuffer_, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, QtCompat::endl(), e57::BitpackDecoder::maxRecordCount_, nBytesPrefixRead_, nBytesStringRead_, prefixBytes_, prefixLength_, readingPrefix_, stringLength_, and e57::toString().

Member Data Documentation

◆ currentString_

ustring e57::BitpackStringDecoder::currentString_
protected

Definition at line 129 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ nBytesPrefixRead_

int e57::BitpackStringDecoder::nBytesPrefixRead_ = 0
protected

Definition at line 127 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ nBytesStringRead_

uint64_t e57::BitpackStringDecoder::nBytesStringRead_ = 0
protected

Definition at line 130 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ prefixBytes_

uint8_t e57::BitpackStringDecoder::prefixBytes_[8] = {}
protected

Definition at line 126 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ prefixLength_

int e57::BitpackStringDecoder::prefixLength_ = 1
protected

Definition at line 125 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ readingPrefix_

bool e57::BitpackStringDecoder::readingPrefix_ = true
protected

Definition at line 124 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().

◆ stringLength_

uint64_t e57::BitpackStringDecoder::stringLength_ = 0
protected

Definition at line 128 of file Decoder.h.

Referenced by dump(), and inputProcessAligned().


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