GL Studio Safety Critical Embedded C++ Runtime Library
GlsRLEDecoder Class Reference

#include <gls_rle_decoder.h>

Public Member Functions

 GlsRLEDecoder (const GlsUChar *const inlineData[], const GlsUInt32 inlineDataLength, const GlsUInt32 lineLength)
 
 ~GlsRLEDecoder ()
 
GlsUChar DecodeByte (void)
 
GlsBool IsDone (void) const
 

Protected Attributes

GlsUtil::InlineReader _inlineReader
 
GlsUChar _markerByte
 
GlsUInt32 _sequenceRemaining
 
GlsUChar _repeatedByte
 

Static Protected Attributes

static const GlsUChar TWO_BYTE_COUNT_FLAG = 0x80
 

Detailed Description

RLE ( Run Length Encoded compression ) decoder.
This decoder allows for incremental decoding of RLE compressed data in inline format.

Invariant
_inlineReader invariant holds

Constructor & Destructor Documentation

◆ GlsRLEDecoder()

GlsRLEDecoder::GlsRLEDecoder ( const GlsUChar *const  inlineData[],
const GlsUInt32  inlineDataLength,
const GlsUInt32  lineLength 
)

Constructor - create an instance

Parameters
inlineDatainline RLE data to decode
inlineDataLengthlength in bytes of inline RLE data to decode ( not including terminators at end of lines )
lineLengthlength (in bytes) of one line of data in the inline data (not including NULL terminator)
Precondition
inlineData != GLS_NULL, inlineDataLength > 1, lineLength > 0
Postcondition
instance created

◆ ~GlsRLEDecoder()

GlsRLEDecoder::~GlsRLEDecoder ( )

Destructor - destroy instance

Precondition
none
Postcondition
instance destroyed

Member Function Documentation

◆ DecodeByte()

GlsUChar GlsRLEDecoder::DecodeByte ( void  )

Decode one byte of input

Returns
decoded byte
Precondition
there must be at least one more byte of input remaining
Postcondition
one byte is read from input

◆ IsDone()

GlsBool GlsRLEDecoder::IsDone ( void  ) const

Determine if decoder is finished decoding input data

Returns
GLS_TRUE if done else GLS_FALSE
Precondition
none
Postcondition
none

Member Data Documentation

◆ _inlineReader

GlsUtil::InlineReader GlsRLEDecoder::_inlineReader
protected

inline data reader

◆ _markerByte

GlsUChar GlsRLEDecoder::_markerByte
protected

marker byte to signal run length

◆ _repeatedByte

GlsUChar GlsRLEDecoder::_repeatedByte
protected

current repeated byte if _sequenceRemaining > 0

◆ _sequenceRemaining

GlsUInt32 GlsRLEDecoder::_sequenceRemaining
protected

number of repeated bytes remaining in sequence else 0

◆ TWO_BYTE_COUNT_FLAG

const GlsUChar GlsRLEDecoder::TWO_BYTE_COUNT_FLAG = 0x80
staticprotected

flag in input data that indicates a two byte repeat count