aivika-0.4.2: A multi-paradigm simulation library

Stabilityexperimental
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Safe HaskellNone

Simulation.Aivika.Dynamics.FIFO

Description

Tested with: GHC 7.4.1

This module defines the FIFO queue.

Synopsis

Documentation

data FIFO a Source

Represents the FIFO queue with rule: first input - first output.

fifoQueue :: FIFO a -> EventQueueSource

Return the event queue.

fifoNull :: FIFO a -> Dynamics BoolSource

Test whether the FIFO queue is empty.

fifoFull :: FIFO a -> Dynamics BoolSource

Test whether the FIFO queue is full.

fifoMaxCount :: FIFO a -> IntSource

The maximum available number of items.

fifoCount :: FIFO a -> Dynamics IntSource

Return the queue size.

fifoLostCount :: FIFO a -> Dynamics IntSource

Return the number of lost items.

newFIFO :: EventQueue -> Int -> Simulation (FIFO a)Source

Create a new FIFO queue with the specified maximum available number of items.

dequeueFIFO :: FIFO a -> Process aSource

Dequeue from the FIFO queue suspending the process if the queue is empty.

tryDequeueFIFO :: FIFO a -> Dynamics (Maybe a)Source

Try to dequeue from the FIFO queue immediately.

enqueueFIFO :: FIFO a -> a -> Process ()Source

Enqueue the item in the FIFO queue suspending the process if the queue is full.

tryEnqueueFIFO :: FIFO a -> a -> Dynamics BoolSource

Try to enqueue the item in the FIFO queue. Return False in the monad if the queue is full.

enqueueFIFOOrLost :: FIFO a -> a -> Dynamics ()Source

Try to enqueue the item in the FIFO queue. If the queue is full then the item will be lost.