GL Studio Safety Critical Embedded C++ Runtime Library
gls_rle_decoder.h
Go to the documentation of this file.
1 #ifndef _GLS_RLE_DECODER_H
2 #define _GLS_RLE_DECODER_H
3 
4 /*! \file gls_rle_decoder.h
5 
6 \brief RLE ( Run Length Encoded compression ) decoder.
7  This decoder allows for incremental decoding of data in inline format in the
8  GL Studio DO-178B Runtime Library.
9 
10 \par Copyright Information
11 Copyright (C) 1999-2012 The DiSTI Corporation<br>
12 Orlando, FL USA<br>
13 All rights reserved.<br>
14 
15  This file is copyrighted software and contains proprietary trade secrets of
16 DiSTI, and embodies substantial creative efforts as well as confidential
17 information, ideas, and expressions.
18 
19  Permission to use, and copy this software and its documentation for any
20 purpose is hereby granted per the Distribution Agreement and/or the Licensing
21 Agreement signed with DiSTI. This permission is granted provided that:
22  1. The above copyright notice appears in all copies.
23  2. That both the copyright notice and this permission notice appear in
24  the supporting documentation.
25  3. That the names DiSTI and GL Studio not be used in advertising or
26  publicity pertaining to distribution of the software without specific,
27  written prior permission of DiSTI.
28 
29  Permission to modify the software is granted, but not the right to
30 distribute the source code whether modified, or non-modified. Modifying the
31 software might invalidate the DO-178B certification package.
32 
33  Permission to distribute binaries produced by compiling source code, or
34 modified source code is granted, provided you:
35  1. Provide your name and address as the primary contact for the support
36  of your modified version.
37  2. Retain our contact information in regard to use of the base software.
38 
39  DiSTI does not provide warranty for this software or guarantee that it
40 satisfies any specification or requirement unless otherwise stated in a
41 specific contractual arrangement between the customer and DiSTI.
42 
43 */
44 
45 #include "gls_include.h"
46 #include "gls_types.h"
47 #include "gls_util.h"
48 #include "gls_class_invariant.h"
49 
50 /** RLE ( Run Length Encoded compression ) decoder.
51  * This decoder allows for incremental decoding of RLE compressed data in inline format.
52  * \invariant _inlineReader invariant holds
53  */
55 {
56 public:
58 
59  /** Constructor - create an instance
60  * \param inlineData inline RLE data to decode
61  * \param inlineDataLength length in bytes of inline RLE data to decode
62  * ( not including terminators at end of lines )
63  * \param lineLength length (in bytes) of one line of data in the inline data
64  * (not including NULL terminator)
65  * \pre inlineData != GLS_NULL, inlineDataLength > 1, lineLength > 0
66  * \post instance created
67  */
68  GlsRLEDecoder( const GlsUChar* const inlineData[], const GlsUInt32 inlineDataLength,
69  const GlsUInt32 lineLength );
70 
71  /** Destructor - destroy instance
72  * \pre none
73  * \post instance destroyed
74  */
76 
77  /** Decode one byte of input
78  * \return decoded byte
79  * \pre there must be at least one more byte of input remaining
80  * \post one byte is read from input
81  */
82  GlsUChar DecodeByte( void );
83 
84  /** Determine if decoder is finished decoding input data
85  * \return GLS_TRUE if done else GLS_FALSE
86  * \pre none
87  * \post none
88  */
89  GlsBool IsDone( void ) const;
90 
91 protected:
92  static const GlsUChar TWO_BYTE_COUNT_FLAG = 0x80; /**< flag in input data that indicates
93  * a two byte repeat count */
94 
95  GlsUtil::InlineReader _inlineReader; /**< inline data reader */
96  GlsUChar _markerByte; /**< marker byte to signal run length */
97 
98  GlsUInt32 _sequenceRemaining; /**< number of repeated bytes remaining in sequence else 0 */
99  GlsUChar _repeatedByte; /**< current repeated byte if _sequenceRemaining > 0 */
100 
101 private:
102  // Disable implicit generated Members
103  GlsRLEDecoder& operator=( const GlsRLEDecoder &rhs );
104  GlsRLEDecoder( const GlsRLEDecoder &src );
105 };
106 
107 #endif // _GLS_RLE_DECODER_H
static const GlsUChar TWO_BYTE_COUNT_FLAG
Definition: gls_rle_decoder.h:92
unsigned char GlsUChar
Definition: gls_types.h:61
Definition: gls_rle_decoder.h:54
bool GlsBool
Definition: gls_types.h:96
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
This header defines general utility classes, functions and macros in the GL Studio DO-178B Runtime Li...
GlsBool IsDone(void) const
unsigned int GlsUInt32
Definition: gls_types.h:73
This header defines the basic types used by the GL Studio DO-178B Runtime Library.
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
GlsUChar _markerByte
Definition: gls_rle_decoder.h:96
Definition: gls_util.h:80
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
GlsRLEDecoder(const GlsUChar *const inlineData[], const GlsUInt32 inlineDataLength, const GlsUInt32 lineLength)
GlsUInt32 _sequenceRemaining
Definition: gls_rle_decoder.h:98
GlsUtil::InlineReader _inlineReader
Definition: gls_rle_decoder.h:95
GlsUChar _repeatedByte
Definition: gls_rle_decoder.h:99
GlsUChar DecodeByte(void)