|
CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
|
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 |
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.
|
explicit |
Initialise the encoder.
Prepares the encoder for accepting a sequence of records.
| iRecordSize | The number of integers in a record. |
| 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.
| const uint32_t * integer_run_length_encoder::get_output | ( | size_t * | pCount | ) | const |
| void integer_run_length_encoder::pump_output | ( | lua_persist_writer * | pWriter | ) | const |
| void integer_run_length_encoder::write | ( | uint32_t | iValue | ) |
Supply the next integer in the input sequence to the encoder.