
Buffer |
ptolemy.domains.rendezvous.lib.Buffer |
This actor buffers data provided at the input, sending it to the
output when needed. It uses two threads. The main actor thread
is willing to rendezvous with the output as long as the buffer
is not empty. A second thread is created on the first invocation
of fire(). This second thread is willing to rendezvous with the
input as long as the buffer is not full. Thus, this actor
acts as a FIFO (first-in, first-out) buffer that will accept
input tokens as long as it is not full, and will produce output
tokens as long as it is not empty.
<p>
If the capacity changes during execution, and the buffer already
contains more tokens than the new capacity, then no tokens are lost,
but no new tokens are accepted at the input until the number of
buffered tokens drops below the capacity.
<p>
This actor is similar to the ResourcePool actor except that
the input and output ports are not multiports and there are
no initial tokens in this buffer.
Author(s): Edward A. Lee
Version:$Id: Buffer.doc.html,v 1.1 2006/02/22 18:40:26 mangal Exp $
Pt.Proposed Rating:Yellow (eal)
Pt.Accepted Rating:Red (cxh)
input
The input port.
output
The output port. The type of this output is constrained
to be at least that of the input.
capacity
The capacity of the buffer. To provide "infinite" capacity,
set this to a negative number.