GCC Code Coverage Report


Directory: ./
File: DpZLibCompressor.hpp
Date: 2026-09-03 22:13:38
Exec Total Coverage
Lines: 0 2 0.0%
Functions: 0 1 0.0%
Branches: 0 1 0.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title DpZLibCompressor.hpp
3 // \author kubiak
4 // \brief hpp file for DpZLibCompressor component implementation class
5 // ======================================================================
6
7 #ifndef Svc_DpZLibCompressor_HPP
8 #define Svc_DpZLibCompressor_HPP
9
10 #include "Svc/DpZLibCompressor/DpZLibCompressorComponentAc.hpp"
11
12 #include <zlib.h>
13
14 namespace Svc {
15
16 class DpZLibCompressor final : public DpZLibCompressorComponentBase {
17 public:
18 // ----------------------------------------------------------------------
19 // Component construction and destruction
20 // ----------------------------------------------------------------------
21
22 //! Construct DpZLibCompressor object
23 DpZLibCompressor(const char* const compName //!< The component name
24 );
25
26 //! Destroy DpZLibCompressor object
27 ~DpZLibCompressor();
28
29 private:
30 // ----------------------------------------------------------------------
31 // Handler implementations for typed input ports
32 // ----------------------------------------------------------------------
33
34 //! Handler implementation for compressChunk
35 Svc::CompressionAlgorithm compressChunk_handler(FwIndexType portNum, //!< The port number
36 Fw::Buffer& buffer,
37 FwSizeType min_compression,
38 FwSizeType write_offset) override;
39
40 struct ZLibCtx {
41 Fw::Buffer compression_buffer;
42
43 Fw::Buffer zlib_alloc_buffer;
44 FwSizeType bump_allocator;
45
46 z_stream zlib_stream;
47 DpZLibCompressor& comp;
48
49 explicit ZLibCtx(DpZLibCompressor& c)
50 : compression_buffer(), zlib_alloc_buffer(), bump_allocator(0), zlib_stream(), comp(c) {}
51 };
52
53 void cleanupContext(ZLibCtx& ctx);
54
55 CompressionAlgorithm zlibCompressionHelper(ZLibCtx& ctx, const Fw::Buffer& in_buffer);
56
57 static voidpf zlib_alloc_fn(voidpf opaque, uInt items, uInt size);
58 static void zlib_free_fn(voidpf opaque, voidpf address);
59 };
60
61 } // namespace Svc
62
63 #endif
64