BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
zpack.h
Go to the documentation of this file.
1
50/*
51 ZPack format:
52 u8 _signature; // = 0x99 = ZPack::Signature
53 u8 _compression_method[2:0] // = 0:huffman->rle 1:huffman 2:flat 3:flat with size
54 reserved[7:3] // reserved
55
56 // only when 3:flat with size
57 u8 size[ 7 : 0]
58 u8 size[15 : 8]
59 u8 size[23 :16]
60*/
61
62#pragma once
63
64#include <memory>
65#include <b8/type.h>
66#include <pipe.h>
67
68namespace ZPack {
69constexpr u8 Signature = 0x99;
70
81
90 std::shared_ptr< Pipe::CPipe > _pipe_in = std::make_shared< Pipe::CNullPipe >();
91 std::shared_ptr< Pipe::CPipe > _pipe_out = std::make_shared< Pipe::CNullPipe >();
92public:
97 void SetIn ( std::shared_ptr< Pipe::CPipe > pipe_in_ );
98
103 void SetOut( std::shared_ptr< Pipe::CPipe > pipe_out_ );
104
108 void Encode();
109};
110
120 std::shared_ptr< Pipe::CPipe > _pipe_in = std::make_shared< Pipe::CNullPipe >();
121 std::shared_ptr< Pipe::CPipe > _pipe_out = std::make_shared< Pipe::CNullPipe >();
122public:
132
137 void SetIn ( std::shared_ptr< Pipe::CPipe > pipe_in_ );
138
143 void SetOut( std::shared_ptr< Pipe::CPipe > pipe_out_ );
144
150};
151
152} // namespace ZPack
Class for decoding data streams encoded with ZPack compression methods.
Definition zpack.h:119
CZPackDecoder::DecodeResult Decode()
Decodes the data from the input pipe and writes it to the output pipe.
Definition zpack.cpp:106
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the decoder.
Definition zpack.cpp:98
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the decoder.
Definition zpack.cpp:102
DecodeResult
Enum representing the result of the decoding process.
Definition zpack.h:127
@ DECODE_ERR_INVALID_SIGNATURE
Invalid signature in the encoded data.
Definition zpack.h:129
@ DECODE_INVALID_DATA
Invalid data in the encoded stream.
Definition zpack.h:130
@ DECODE_OK
Decoding was successful.
Definition zpack.h:128
Class for encoding data streams using various compression methods.
Definition zpack.h:89
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the encoder.
Definition zpack.cpp:19
void Encode()
Encodes the data from the input pipe and writes it to the output pipe.
Definition zpack.cpp:27
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the encoder.
Definition zpack.cpp:23
Module for data pipeline processing using pipes.
CompressionMethod
Enum representing the available compression methods.
Definition zpack.h:75
@ HuffmanToRle
Huffman encoding followed by Run-Length Encoding (RLE)
Definition zpack.h:76
@ Huffman
Huffman encoding only.
Definition zpack.h:77
@ FlatWithSize
No compression, includes original size.
Definition zpack.h:79
@ Flat
No compression.
Definition zpack.h:78