StreamZip

The StreamZip class provides a payload compression engine for Rogue Frames. This module will receive Frames from an external master, compress the Frame payload and then pass the compressed frame to a downstream Slave.

This compression module uses the Bzip2 library.

StreamZip objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::utilities::StreamZip> rogue::utilities::StreamZipPtr

The class description is shown below:

class StreamZip : public rogue::interfaces::stream::Slave, public rogue::interfaces::stream::Master

Stream module that compresses frame payloads using bzip2.

StreamZip consumes frames on its slave side, compresses the payload bytes, and forwards a new frame downstream from its master side. Frame metadata (channel, flags, error state) is preserved.

Output frame allocation is requested via reqFrame(). The implementation starts with an output frame sized to the input payload and grows it if needed.

Threading model:

  • StreamZip does not create an internal worker thread.

  • Compression runs synchronously in the caller thread that invokes acceptFrame().

  • A lock is taken on the input frame while payload buffers are read, so the frame contents are stable during compression.

Public Functions

StreamZip()

Constructs a stream compressor.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

~StreamZip()

Destroys stream compressor.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)

Accepts a frame, compresses its payload, and forwards the result.

Parameters:

frame – Input frame to compress.

virtual std::shared_ptr<rogue::interfaces::stream::Frame> acceptReq(uint32_t size, bool zeroCopyEn)

Forwards frame-allocation requests upstream.

Parameters:
  • size – Requested payload size in bytes.

  • zeroCopyEntrue to request zero-copy buffer handling.

Returns:

Allocated frame from upstream master path.

Public Static Functions

static std::shared_ptr<rogue::utilities::StreamZip> create()

Creates a stream compressor instance.

This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Returns:

Shared pointer to the created compressor.

static void setup_python()

Registers Python bindings for this class.