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
noCopyistrue, the original frame object is queued (no payload copy, no trim).If
noCopyisfalse, a new frame is allocated and payload bytes are copied.In copy mode,
trimSizecan cap copied payload length.
Queue backpressure/drop behavior is controlled by
maxDepth:maxDepth > 0: once queue depth reachesmaxDepth, new incoming frames are dropped.maxDepth == 0: no busy/drop threshold is applied by this FIFO (queue can continue growing).
Trim behavior:
trimSize > 0andnoCopy == false: copied payload is limited tomin(payload, trimSize).trimSize == 0: copied payload is not trimmed.noCopy == true:trimSizeis 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.
0disables threshold-based drops.trimSize – Payload trim limit in copy mode.
0disables trimming.noCopy – Set to
trueto queue original frames; whentrue,trimSizeis 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).
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_ptrownership compatible with Rogue pointer typedefs.- Parameters:
maxDepth – Queue busy/drop threshold in frames.
0disables threshold-based drops.trimSize – Payload trim limit in copy mode.
0disables trimming.noCopy – Set to
trueto queue original frames; whentrue,trimSizeis ignored.
- Returns:
Shared pointer to the created FIFO.
-
static void setup_python()
Registers this type with Python bindings.