F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DpZLibCompressor.hpp
Go to the documentation of this file.
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 
11 
12 #include <zlib.h>
13 
14 namespace Svc {
15 
17  public:
18  // ----------------------------------------------------------------------
19  // Component construction and destruction
20  // ----------------------------------------------------------------------
21 
23  DpZLibCompressor(const char* const compName
24  );
25 
28 
29  private:
30  // ----------------------------------------------------------------------
31  // Handler implementations for typed input ports
32  // ----------------------------------------------------------------------
33 
35  Svc::CompressionAlgorithm compressChunk_handler(FwIndexType portNum,
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
~DpZLibCompressor()
Destroy DpZLibCompressor object.
DpZLibCompressor(const char *const compName)
Construct DpZLibCompressor object.
PlatformSizeType FwSizeType
Auto-generated base for DpZLibCompressor component.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.