BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
rle.h File Reference

Header file for the RLE (Run-Length Encoding) compression and decompression module. More...

#include <memory>
#include <b8/type.h>
#include <pipe.h>

Go to the source code of this file.

Classes

class  Rle::CRleEncoder
 Class for encoding data using run-length encoding (RLE). More...
 
class  Rle::CRleDecoder
 Class for decoding data using run-length encoding (RLE). More...
 

Namespaces

namespace  Rle
 The Rle namespace provides classes for run-length encoding (RLE) compression and decompression.
 

Detailed Description

Header file for the RLE (Run-Length Encoding) compression and decompression module.

This module provides classes for compressing and decompressing data using RLE. The CRleEncoder class encodes data from an input pipe and writes the compressed data to an output pipe. The CRleDecoder class decodes compressed data from an input pipe and writes the decompressed data to an output pipe.

Usage example:

#include <iostream>
#include <memory>
#include <vector>
#include <pipe.h>
#include <rle.h>
using namespace std;
using namespace Pipe;
using namespace Rle;
int main() {
// Prepare input data
vector<u8> input_data = {0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 0, 0, 0};
// Load input data into memory pipe
auto pipe_mem_reader = make_shared<CMemBufferPipe>();
for (auto data : input_data) {
pipe_mem_reader->Push(data);
}
// Prepare encoder and output pipe
auto pipe_mem_packed = make_shared<CMemBufferPipe>();
CRleEncoder encoder;
encoder.SetIn(pipe_mem_reader);
encoder.SetOut(pipe_mem_packed);
// Perform RLE encoding
encoder.Encode();
// Dump the encoded result
cout << "RLE Encoded Data:" << endl;
pipe_mem_packed->Dump();
// Prepare pipes for decoding
auto pipe_mem_unpacked = make_shared<CMemBufferPipe>();
CRleDecoder decoder;
decoder.SetIn(pipe_mem_packed);
decoder.SetOut(pipe_mem_unpacked);
// Perform RLE decoding
decoder.Decode();
// Dump the decoded result
cout << "RLE Decoded Data:" << endl;
pipe_mem_unpacked->Dump();
return 0;
}
Class for decoding data using run-length encoding (RLE).
Definition rle.h:142
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the decoder.
Definition rle.cpp:115
CRleDecoder::DecodeResult Decode()
Performs the RLE decoding process.
Definition rle.cpp:128
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the decoder.
Definition rle.cpp:119
Class for encoding data using run-length encoding (RLE).
Definition rle.h:105
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the encoder.
Definition rle.cpp:104
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the encoder.
Definition rle.cpp:108
CRleEncoder::EncodeResult Encode()
Performs the RLE encoding process.
Definition rle.cpp:36
The Rle namespace provides classes for run-length encoding (RLE) compression and decompression.
Module for data pipeline processing using pipes.
Header file for the RLE (Run-Length Encoding) compression and decompression module.
Note
This file is part of the RLE module.