
IORelation |
ptolemy.actor.IORelation |
This class mediates connections between ports that can send data to
one another via message passing. One purpose of this relation is to
ensure that IOPorts are only connected to IOPorts. A second purpose
is to support the notion of a width to represent something
like a bus. By default an IORelation is not a bus, which means that
its width is one. Calling setWidth() with
an argument larger than one makes the relation a bus of fixed width.
Calling setWidth() with an argument of zero makes the relation
a bus with indeterminate width, in which case the width will be
inferred (if possible) from the context. In particular,
if this relation is linked on the inside to a port with some
width, then the width of this relation will be inferred to
be the enough so that the widths of all inside linked relations
adds up to the outside width of the port.
The actual width of an IORelation
can never be less than one. If this IORelation is linked to another
instance of IORelation, then the width of the two IORelations is
constrained to be the same.
Instances of IORelation can only be linked to instances of IOPort
or instances of IORelation.
Derived classes may further constrain this to subclasses of IOPort
of IORelation.
Such derived classes should override the protected methods _checkPort()
and _checkRelation() to throw an exception.
To link a IOPort to an IORelation, use the link() or
liberalLink() method in the IOPort class. To remove a link,
use the unlink() method. To link (unlink) an IORelation to an IORelation,
use the link() (unlink()) method of IORelation.
The container for instances of this class can only be instances of
CompositeActor. Derived classes may wish to further constrain the
container to subclasses of ComponentEntity. To do this, they should
override the _checkContainer() method.
Author(s): Edward A. Lee, Jie Liu
Version:$Id: IORelation.java,v 1.93 2005/10/24 19:09:04 cxh Exp $
Pt.Proposed Rating:Green (eal)
Pt.Accepted Rating:Green (acataldo)
width
The width of this relation. This is an integer that defaults
to one. Set it to zero to infer the width from that of ports
to which this relation is linked on the inside.