![]() |
lingua-franca 0.10.1
Lingua Franca code generator
|
Representation of a compile-time instance of a port. More...
Inherits org.lflang.generator.TriggerInstance< Port >.
Public Member Functions | |
| void | clearCaches () |
| Clear cached information about the connectivity of this port. | |
| List< Connection > | connectionsFrom (PortInstance upstreamPort) |
| For the given upstream port (the instance of a range returned by getDependsOnPorts()), return a list of connections from that port or null if there are no connections from that port. | |
| List< Connection > | connectionsTo (PortInstance downstreamPort) |
| For the given downstream port (the instance of a range returned by getDependentPorts()), return a list of connections to that port or null if there are no connections to that port. | |
| List< SendRange > | eventualDestinations () |
| Return a list of ranges of this port, where each range sends to a list of destination ports that receive data from the range of this port. | |
| List< RuntimeRange< PortInstance > > | eventualSources () |
| Return a list of ranges of ports that send data to this port. | |
| List< SendRange > | getDependentPorts () |
| Return the list of ranges of this port together with the downstream ports that are connected to this port. | |
| Set< ReactionInstance > | getDependentReactions () |
| Return the reaction instances that are triggered or read by this trigger. | |
| List< RuntimeRange< PortInstance > > | getDependsOnPorts () |
| Return the list of upstream ports that are connected to this port, or an empty set if there are none. | |
| Set< ReactionInstance > | getDependsOnReactions () |
| Return the reaction instances that may send data via this port or action. | |
| int | getLevelUpperBound (MixedRadixInt index) |
| Return the minimum of the levels of the reactions that are downstream of this port. | |
| String | getName () |
| Return the name of this trigger. | |
| boolean | isInput () |
| Return true if the port is an input. | |
| boolean | isMultiport () |
| Return true if this is a multiport. | |
| boolean | isOutput () |
| Return true if the port is an output. | |
| boolean | isReset () |
| Return true if this trigger is "startup". | |
| boolean | isShutdown () |
| Return true if this trigger is "shutdown". | |
| boolean | isStartup () |
| Return true if this trigger is "startup". | |
| TimeValue | minDelayFrom (PortInstance upstreamPort) |
| For the given upstream port (the instance of a range returned by getDependsOnPorts()), return the minimum of the after delays on connections from that port. | |
| PortInstance (Port definition, ReactorInstance parent) | |
| Create a runtime instance from the specified definition and with the specified parent that instantiated it. | |
| PortInstance (Port definition, ReactorInstance parent, MessageReporter messageReporter) | |
| Create a port instance from the specified definition and with the specified parent that instantiated it. | |
| void | recordIndexForPortChannel (MixedRadixInt index, int level) |
| Record that the indexth sub-port of this has a dependent reaction of level level. | |
| String | toString () |
Static Package Functions | |
| static TriggerInstance< BuiltinTriggerVariable > | builtinTrigger (BuiltinTriggerRef trigger, ReactorInstance parent) |
| Construct a new instance for a special builtin trigger. | |
Package Attributes | |
| List< SendRange > | dependentPorts = new ArrayList<>() |
| Ranges of this port together with downstream ports that are connected directly to this port. | |
| Set< ReactionInstance > | dependentReactions |
| Reaction instances that are triggered or read by this trigger. | |
| List< RuntimeRange< PortInstance > > | dependsOnPorts = new ArrayList<>(1) |
| Upstream ports that are connected directly to this port, if there are any. | |
| Set< ReactionInstance > | dependsOnReactions |
| Reaction instances that may send data via this port or action. | |
| Map< PortInstance, List< Connection > > | downstreamConnections = new LinkedHashMap<>(1) |
| Map from the ports listed in dependentPorts to the connection(s) to those ports. | |
| boolean | isMultiport = false |
| Indicator of whether this is a multiport. | |
| Map< PortInstance, List< Connection > > | upstreamConnections = new LinkedHashMap<>(1) |
| Map from the ports listed in dependsOnPorts to the connection(s) from those ports. | |
Representation of a compile-time instance of a port.
Like ReactorInstance, if one or more parents of this port is a bank of reactors, then there will be more than one runtime instance corresponding to this compile-time instance.
This may be a single port or a multiport. If it is a multiport, then one instance of this PortInstance class represents all channels. If in addition any parent is a bank, then it represents all channels of all bank members. The eventualDestinations() and eventualSources() functions report the connectivity of all such channels as lists of SendRange and RuntimeRange objects.
| org.lflang.generator.PortInstance.PortInstance | ( | Port | definition, |
| ReactorInstance | parent ) |
Create a runtime instance from the specified definition and with the specified parent that instantiated it.
| definition | The declaration in the AST. |
| parent | The parent. |
| org.lflang.generator.PortInstance.PortInstance | ( | Port | definition, |
| ReactorInstance | parent, | ||
| MessageReporter | messageReporter ) |
Create a port instance from the specified definition and with the specified parent that instantiated it.
| definition | The declaration in the AST. |
| parent | The parent. |
| messageReporter | An error reporter, or null to throw exceptions. |
|
staticpackageinherited |
Construct a new instance for a special builtin trigger.
| trigger | The actual trigger definition. |
| parent | The reactor instance that creates this instance. |
| void org.lflang.generator.PortInstance.clearCaches | ( | ) |
Clear cached information about the connectivity of this port.
In particular, eventualDestinations() and eventualSources() cache the lists they return. To force those methods to recompute their lists, call this method. This method also clears the caches of any ports that are listed as eventual destinations and sources.
| List< Connection > org.lflang.generator.PortInstance.connectionsFrom | ( | PortInstance | upstreamPort | ) |
For the given upstream port (the instance of a range returned by getDependsOnPorts()), return a list of connections from that port or null if there are no connections from that port.
| upstreamPort | The upstream port. |
| List< Connection > org.lflang.generator.PortInstance.connectionsTo | ( | PortInstance | downstreamPort | ) |
For the given downstream port (the instance of a range returned by getDependentPorts()), return a list of connections to that port or null if there are no connections to that port.
| downstreamPort | The downstream port. |
| List< SendRange > org.lflang.generator.PortInstance.eventualDestinations | ( | ) |
Return a list of ranges of this port, where each range sends to a list of destination ports that receive data from the range of this port.
Each destination port is annotated with the channel range on which it receives data. The ports listed are only ports that are sources for reactions, not relay ports that the data may go through on the way. Also, if there is an "after" delay anywhere along the path, then the destination is not in the resulting list.
If this port itself has dependent reactions, then this port will be included as a destination in all items on the returned list.
Each item in the returned list has the following fields:
Each item also has a method, SendRange#getNumberOfDestinationReactors(), that returns the total number of unique destination reactors for its range. This is not necessarily the same as the number of ports in its destinations field because some of the ports may share the same container reactor.
| List< RuntimeRange< PortInstance > > org.lflang.generator.PortInstance.eventualSources | ( | ) |
Return a list of ranges of ports that send data to this port.
If this port is directly written to by one or more reactions, then it is its own eventual source and only this port will be represented in the result.
If this is not a multiport and is not within a bank, then the list will have only one item and the range will have a total width of one. Otherwise, it will have enough items so that the range widths add up to the width of this multiport multiplied by the total number of instances within containing banks.
The ports listed are only ports that are written to by reactions, not relay ports that the data may go through on the way.
| List< SendRange > org.lflang.generator.PortInstance.getDependentPorts | ( | ) |
Return the list of ranges of this port together with the downstream ports that are connected to this port.
The total with of the ranges in the returned list is a multiple N >= 0 of the total width of this port.
|
inherited |
Return the reaction instances that are triggered or read by this trigger.
If this port is an output, then the reaction instances belong to the parent of the port's parent. If the port is an input, then the reaction instances belong to the port's parent.
| List< RuntimeRange< PortInstance > > org.lflang.generator.PortInstance.getDependsOnPorts | ( | ) |
Return the list of upstream ports that are connected to this port, or an empty set if there are none.
For an ordinary port, this list will have length 0 or 1. For a multiport, it can have a larger size.
|
inherited |
Return the reaction instances that may send data via this port or action.
If this is an input port, then the reaction instance belongs to parent of the port's parent. If it is an output port, the reaction instance belongs to the port's parent. If it is an action, then the reaction belongs to the same parent as that of this action.
| int org.lflang.generator.PortInstance.getLevelUpperBound | ( | MixedRadixInt | index | ) |
Return the minimum of the levels of the reactions that are downstream of this port.
If there are no reactions downstream of this port, this returns Integer.MAX_VALUE.
|
inherited |
Return the name of this trigger.
| boolean org.lflang.generator.PortInstance.isInput | ( | ) |
Return true if the port is an input.
| boolean org.lflang.generator.PortInstance.isMultiport | ( | ) |
Return true if this is a multiport.
| boolean org.lflang.generator.PortInstance.isOutput | ( | ) |
Return true if the port is an output.
|
inherited |
Return true if this trigger is "startup".
/
|
inherited |
Return true if this trigger is "shutdown".
|
inherited |
Return true if this trigger is "startup".
/
| TimeValue org.lflang.generator.PortInstance.minDelayFrom | ( | PortInstance | upstreamPort | ) |
For the given upstream port (the instance of a range returned by getDependsOnPorts()), return the minimum of the after delays on connections from that port.
This will be TimeValue.ZERO if there are no after delays or if the after delays are zero, and it will be TimeValue.MAX_VALUE if there are no connections from the port.
| upstreamPort | The upstream port. |
| void org.lflang.generator.PortInstance.recordIndexForPortChannel | ( | MixedRadixInt | index, |
| int | level ) |
Record that the indexth sub-port of this has a dependent reaction of level level.
| String org.lflang.generator.PortInstance.toString | ( | ) |
|
package |
Ranges of this port together with downstream ports that are connected directly to this port.
When there are multiple destinations, the destinations are listed in the order they appear in connections in the parent reactor instance of this port (inside connections), followed by the order in which they appear in the parent's parent (outside connections). The total of the widths of these SendRanges is an integer multiple N >= 0 of the width of this port (this is checked by the validator). Each channel of this port will be broadcast to N recipients (or, if there are no connections to zero recipients).
|
packageinherited |
Reaction instances that are triggered or read by this trigger.
If this port is an output, then the reaction instances belong to the parent of the port's parent. If the port is an input, then the reaction instances belong to the port's parent.
|
package |
Upstream ports that are connected directly to this port, if there are any.
For an ordinary port, this set will have size 0 or 1. For a multiport, it can have a larger size. This initially has capacity 1 because that is by far the most common case.
|
packageinherited |
Reaction instances that may send data via this port or action.
If this is an input port, then the reaction instance belongs to parent of the port's parent. If it is an output port, the reaction instance belongs to the port's parent. If it is an action, then the reaction belongs belongs to the same parent as this action.
|
package |
Map from the ports listed in dependentPorts to the connection(s) to those ports.
|
package |
Indicator of whether this is a multiport.
|
package |
Map from the ports listed in dependsOnPorts to the connection(s) from those ports.