CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Public Member Functions | List of all members
integer_run_length_encoder Class Reference

Encoder for reducing the amount of space to store a sequence of integers. More...

#include <run_length_encoder.h>

Public Member Functions

 integer_run_length_encoder (size_t iRecordSize)
 Initialise the encoder.
 
void write (uint32_t iValue)
 Supply the next integer in the input sequence to the encoder.
 
void finish ()
 Inform the encoder that the input sequence has finished.
 
const uint32_t * get_output (size_t *pCount) const
 
void pump_output (lua_persist_writer *pWriter) const
 

Detailed Description

Encoder for reducing the amount of space to store a sequence of integers.

Designed primarily for reducing the amount of space taken up by persisting a THMap, this encoder transforms a sequence of integer records into a sequence of pairs, each pair having an integer object, and a repeat count. Terminology: Integer - An unsigned integer (up to) 32 bits wide. Record - One or more integers (for example, when encoding map nodes, each record would be 6 integers if a map node had 6 fields). Object - One or more records. Each object has an associated repeat count.

Constructor & Destructor Documentation

◆ integer_run_length_encoder()

integer_run_length_encoder::integer_run_length_encoder ( size_t  iRecordSize)
explicit

Initialise the encoder.

Prepares the encoder for accepting a sequence of records.

Parameters
iRecordSizeThe number of integers in a record.

Member Function Documentation

◆ finish()

void integer_run_length_encoder::finish ( )

Inform the encoder that the input sequence has finished.

finish() must be called prior to getOutput() or pumpOutput(). write() must not be called after finish() has been called.

◆ get_output()

const uint32_t * integer_run_length_encoder::get_output ( size_t *  pCount) const

◆ pump_output()

void integer_run_length_encoder::pump_output ( lua_persist_writer pWriter) const

◆ write()

void integer_run_length_encoder::write ( uint32_t  iValue)

Supply the next integer in the input sequence to the encoder.


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