Fifo

Examples of using a Fifo are described in Using A Fifo.

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

typedef std::shared_ptr<rogue::interfaces::stream::Fifo> rogue::interfaces::stream::FifoPtr

Shared pointer alias for Fifo.

The class description is shown below:

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

Stream frame FIFO.

Buffers incoming frames and forwards them to downstream slaves from a worker thread. For each accepted frame:

  • If noCopy is true, the original frame object is queued (no payload copy, no trim).

  • If noCopy is false, a new frame is allocated and payload bytes are copied.

  • In copy mode, trimSize can cap copied payload length.

Queue backpressure/drop behavior is controlled by maxDepth:

  • maxDepth > 0: once queue depth reaches maxDepth, new incoming frames are dropped.

  • maxDepth == 0: no busy/drop threshold is applied by this FIFO (queue can continue growing).

Trim behavior:

  • trimSize > 0 and noCopy == false: copied payload is limited to min(payload, trimSize).

  • trimSize == 0: copied payload is not trimmed.

  • noCopy == true: trimSize is ignored.

Public Functions

Fifo(uint32_t maxDepth, uint32_t trimSize, bool noCopy)

Constructs a FIFO stream buffer.

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

Parameters:
  • maxDepth – Queue busy/drop threshold in frames. 0 disables threshold-based drops.

  • trimSize – Payload trim limit in copy mode. 0 disables trimming.

  • noCopy – Set to true to queue original frames; when true, trimSize is ignored.

~Fifo()

Destroys the FIFO and stops internal worker thread.

std::size_t size()

Returns current FIFO queue depth.

std::size_t dropCnt() const

Returns the total dropped-frame counter.

void clearCnt()

Clears FIFO counters (including dropped-frame count).

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

Receives a frame from upstream and enqueues or drops it.

Parameters:

frame – Incoming frame.

Public Static Functions

static std::shared_ptr<rogue::interfaces::stream::Fifo> create(uint32_t maxDepth, uint32_t trimSize, bool noCopy)

Creates a FIFO stream buffer.

Parameter semantics are identical to the constructor; see Fifo() for queue-depth and trim behavior details.

Exposed as rogue.interfaces.stream.Fifo() in Python.

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.

Parameters:
  • maxDepth – Queue busy/drop threshold in frames. 0 disables threshold-based drops.

  • trimSize – Payload trim limit in copy mode. 0 disables trimming.

  • noCopy – Set to true to queue original frames; when true, trimSize is ignored.

Returns:

Shared pointer to the created FIFO.

static void setup_python()

Registers this type with Python bindings.