![]() |
lingua-franca 0.10.1
Lingua Franca code generator
|
Class that represents an instance of a federate, i.e., a reactor that is instantiated at the top level of a federated reactor. More...
Public Member Functions | |
| FederateInstance (Instantiation instantiation, int id, int bankIndex, int bankWidth, TargetConfig targetConfig, MessageReporter messageReporter) | |
| Construct a new federate instance on the basis of an instantiation in the federated reactor. | |
| LinkedHashMap< Output, TimeValue > | findOutputsConnectedToPhysicalActions (ReactorInstance instance) |
| Find output ports that are connected to a physical action trigger upstream in the same reactor. | |
| ActionInstance | findPhysicalAction (ReactorInstance instance) |
| Return the first found physical action or null if there is no physical action in this federate. | |
| Instantiation | getInstantiation () |
| boolean | includes (Action action) |
| Return true if this federate includes a top-level reaction that references the given action as a trigger, a source, or an effect. | |
| boolean | includes (Reaction reaction) |
| Return true if the specified reaction should be included in the code generated for this federate at the top-level. | |
| boolean | includes (ReactorInstance instance) |
| Return true if this federate instance includes the given instance. | |
| boolean | includes (Timer timer) |
| Return true if this federate includes a top-level reaction that references the given timer as a trigger, a source, or an effect. | |
| boolean | isInZeroDelayCycle () |
| Return true if there is a zero-delay path from this federate to itself. | |
| boolean | references (Import imp) |
| Return true if this federate references the given import. | |
| boolean | references (Parameter param) |
| Return true if this federate references the given parameter. | |
| boolean | references (ReactorDecl declaration) |
| Return true if the class declaration of the given instantiation references the declaration of a reactor class, either directly or indirectly (i.e, via a superclass or a contained instantiation of the reactor class). | |
| String | toString () |
Public Attributes | |
| int | bankIndex |
| The position within a bank of reactors for this federate. | |
| int | bankWidth |
| The width of the bank in which this federate was instantiated. | |
| Set< FedConnectionInstance > | connections = new LinkedHashSet<>() |
| A list of individual connections between federates. | |
| Map< FederateInstance, Set< Expression > > | dependsOn = new LinkedHashMap<>() |
| Map from the federates that this federate receives messages from to the delays on connections from that federate. | |
| HashSet< SupportedSerializers > | enabledSerializers = new HashSet<>() |
| Keep a unique list of enabled serializers. | |
| String | host = "localhost" |
| The host, if specified using the 'at' keyword. | |
| int | id |
| The integer ID of this federate. | |
| Set< FederateInstance > | inboundP2PConnections = new LinkedHashSet<>() |
| A set of federates with which this federate has an inbound connection There will only be one physical connection even if federate A has defined multiple physical connections to federate B. | |
| Instantiation | instantiation |
| The instantiation of the top-level reactor, or null if there is no federation. | |
| boolean | isRemote = false |
| Indicates whether the federate is remote or local. | |
| String | name |
| The name of this federate instance. | |
| HashMap< Action, Instantiation > | networkActionToInstantiation = new HashMap<>() |
| Keep a map of network actions to their associated instantiations. | |
| List< Connection > | networkConnections = new ArrayList<>() |
| List of generated network connections (network input and outputs) that belong to this federate instance. | |
| List< Instantiation > | networkHelperInstantiations = new ArrayList<>() |
| List of generated instantiations that serve as helpers for forming the network connections. | |
| int | networkIdSender = 0 |
| The counter used to assign IDs to network senders. | |
| List< Expression > | networkMessageActionDelays = new ArrayList<>() |
| List of after delay values of the corresponding entries of networkMessageActions. | |
| List< Action > | networkMessageActions = new ArrayList<>() |
| List of networkMessage actions. | |
| List< FederateInstance > | networkMessageSourceFederate = new ArrayList<>() |
| List of source federate IDs for networkMessage actions. | |
| Map< PortInstance, Instantiation > | networkPortToIndexer = new HashMap<>() |
| The mapping from network multiports of the federate to indexer reactors that split the multiport into individual ports. | |
| Map< PortInstance, Instantiation > | networkPortToInstantiation = new HashMap<>() |
| Mapping from a port instance of a connection to its associated network reaction. | |
| List< Reactor > | networkReactors = new ArrayList<>() |
| List of generated network reactors (network input and outputs) that belong to this federate instance. | |
| List< Instantiation > | networkReceiverInstantiations = new ArrayList<>() |
| List of generated network instantiations (network input and outputs) that belong to this federate instance. | |
| List< Reaction > | networkReceiverReactions = new ArrayList<>() |
| List of generated network reactions (network receivers) that belong to this federate instance. | |
| List< Instantiation > | networkSenderInstantiations = new ArrayList<>() |
| List of generated network instantiations (network input and outputs) that belong to this federate instance. | |
| List< Reaction > | networkSenderReactions = new ArrayList<>() |
| List of generated network reactions (network sender) that belong to this federate instance. | |
| Set< FederateInstance > | outboundP2PConnections = new LinkedHashSet<>() |
| A list of federate with which this federate has an outbound physical connection. | |
| int | port = 0 |
| The port, if specified using the 'at' keyword. | |
| List< Reaction > | portAbsentReactions = new ArrayList<>() |
| List of generated network control reactions (network sender) that belong to this federate instance. | |
| Map< FederateInstance, Set< Expression > > | sendsTo = new LinkedHashMap<>() |
| Map from the federates that this federate sends messages to the delays on connections to that federate. | |
| SortedSet< TimeValue > | staaOffsets = new TreeSet<TimeValue>() |
| A list of unique STAA offsets over all input ports of this federate. | |
| HashMap< TimeValue, List< Action > > | staToNetworkActionMap = new HashMap<>() |
| Keep a map of STP values to a list of network actions. | |
| TargetConfig | targetConfig |
| Parsed target config of the federate. | |
| String | user = null |
| The user, if specified using the 'at' keyword. | |
| List< Action > | zeroDelayCycleNetworkMessageActions = new ArrayList<>() |
| List of networkMessage actions corresponding to network input ports whose upstream federates are in zero-delay cycles and the connection has no after delay. | |
Package Functions | |
| private< T > List< T > | convertToEmptyListIfNull (List< T > list) |
Class that represents an instance of a federate, i.e., a reactor that is instantiated at the top level of a federated reactor.
| org.lflang.federated.generator.FederateInstance.FederateInstance | ( | Instantiation | instantiation, |
| int | id, | ||
| int | bankIndex, | ||
| int | bankWidth, | ||
| TargetConfig | targetConfig, | ||
| MessageReporter | messageReporter ) |
Construct a new federate instance on the basis of an instantiation in the federated reactor.
| instantiation | The AST node of the instantiation. |
| id | An identifier. |
| bankIndex | If instantiation.widthSpec !== null, this gives the bank position. |
| bankWidth | The width of the bank. |
| targetConfig | The target configuration. |
| messageReporter | An object for reporting messages to the user. |
|
package |
| LinkedHashMap< Output, TimeValue > org.lflang.federated.generator.FederateInstance.findOutputsConnectedToPhysicalActions | ( | ReactorInstance | instance | ) |
Find output ports that are connected to a physical action trigger upstream in the same reactor.
Return a list of such outputs paired with the minimum delay from the nearest physical action.
| instance | The reactor instance containing the output ports |
| ActionInstance org.lflang.federated.generator.FederateInstance.findPhysicalAction | ( | ReactorInstance | instance | ) |
Return the first found physical action or null if there is no physical action in this federate.
| instance | The reactor instance to check whether there is a physical action. |
| Instantiation org.lflang.federated.generator.FederateInstance.getInstantiation | ( | ) |
| boolean org.lflang.federated.generator.FederateInstance.includes | ( | Action | action | ) |
Return true if this federate includes a top-level reaction that references the given action as a trigger, a source, or an effect.
| action | The action to check whether it is to be included. |
| boolean org.lflang.federated.generator.FederateInstance.includes | ( | Reaction | reaction | ) |
Return true if the specified reaction should be included in the code generated for this federate at the top-level.
This means that if the reaction is triggered by or sends data to a port of a contained reactor, then that reaction is in the federate. Otherwise, return false.
NOTE: This method assumes that it will not be called with reaction arguments that are within other federates. It should only be called on reactions that are either at the top level or within this federate. For this reason, for any reaction not at the top level, it returns true.
| reaction | The reaction to check whether it is to be included. |
| boolean org.lflang.federated.generator.FederateInstance.includes | ( | ReactorInstance | instance | ) |
Return true if this federate instance includes the given instance.
NOTE: If the instance is a bank within the top level, then this returns true even though only one of the bank members is included in the federate.
| instance | The reactor instance to check whether it is to be included. |
| boolean org.lflang.federated.generator.FederateInstance.includes | ( | Timer | timer | ) |
Return true if this federate includes a top-level reaction that references the given timer as a trigger, a source, or an effect.
| timer | The action to check whether it is to be included. |
| boolean org.lflang.federated.generator.FederateInstance.isInZeroDelayCycle | ( | ) |
Return true if there is a zero-delay path from this federate to itself.
This is used to determine whether absent messages need to be sent. Note that this is not the same as causality loop detection. A federate may be in a zero-delay cycle (ZDC) even if there is no causality loop.
| boolean org.lflang.federated.generator.FederateInstance.references | ( | Import | imp | ) |
Return true if this federate references the given import.
| imp | The import to check whether it is referenced. |
| boolean org.lflang.federated.generator.FederateInstance.references | ( | Parameter | param | ) |
Return true if this federate references the given parameter.
| param | The parameter to check whether it is referenced. |
| boolean org.lflang.federated.generator.FederateInstance.references | ( | ReactorDecl | declaration | ) |
Return true if the class declaration of the given instantiation references the declaration of a reactor class, either directly or indirectly (i.e, via a superclass or a contained instantiation of the reactor class).
| declaration | The reactor declaration to check whether it is referenced. |
| String org.lflang.federated.generator.FederateInstance.toString | ( | ) |
| int org.lflang.federated.generator.FederateInstance.bankIndex |
The position within a bank of reactors for this federate.
This is 0 if the instantiation is not a bank of reactors.
| int org.lflang.federated.generator.FederateInstance.bankWidth |
The width of the bank in which this federate was instantiated.
This is 1 if the instantiation is not a bank of reactors.
| Set<FedConnectionInstance> org.lflang.federated.generator.FederateInstance.connections = new LinkedHashSet<>() |
A list of individual connections between federates.
| Map<FederateInstance, Set<Expression> > org.lflang.federated.generator.FederateInstance.dependsOn = new LinkedHashMap<>() |
Map from the federates that this federate receives messages from to the delays on connections from that federate.
The delay set may include null, meaning that there is a connection from the federate instance that has no delay.
| HashSet<SupportedSerializers> org.lflang.federated.generator.FederateInstance.enabledSerializers = new HashSet<>() |
Keep a unique list of enabled serializers.
| String org.lflang.federated.generator.FederateInstance.host = "localhost" |
The host, if specified using the 'at' keyword.
| int org.lflang.federated.generator.FederateInstance.id |
The integer ID of this federate.
| Set<FederateInstance> org.lflang.federated.generator.FederateInstance.inboundP2PConnections = new LinkedHashSet<>() |
A set of federates with which this federate has an inbound connection There will only be one physical connection even if federate A has defined multiple physical connections to federate B.
The message handler on federate A will be responsible for including the appropriate information in the message header (such as port ID) to help the receiver distinguish different events.
| Instantiation org.lflang.federated.generator.FederateInstance.instantiation |
The instantiation of the top-level reactor, or null if there is no federation.
| boolean org.lflang.federated.generator.FederateInstance.isRemote = false |
Indicates whether the federate is remote or local.
| String org.lflang.federated.generator.FederateInstance.name |
The name of this federate instance.
This will be the instantiation name, possibly appended with "__n", where n is the bank position of this instance if the instantiation is of a bank of reactors.
| HashMap<Action, Instantiation> org.lflang.federated.generator.FederateInstance.networkActionToInstantiation = new HashMap<>() |
Keep a map of network actions to their associated instantiations.
| List<Connection> org.lflang.federated.generator.FederateInstance.networkConnections = new ArrayList<>() |
List of generated network connections (network input and outputs) that belong to this federate instance.
| List<Instantiation> org.lflang.federated.generator.FederateInstance.networkHelperInstantiations = new ArrayList<>() |
List of generated instantiations that serve as helpers for forming the network connections.
| int org.lflang.federated.generator.FederateInstance.networkIdSender = 0 |
The counter used to assign IDs to network senders.
| List<Expression> org.lflang.federated.generator.FederateInstance.networkMessageActionDelays = new ArrayList<>() |
List of after delay values of the corresponding entries of networkMessageActions.
These will be null in the case of zero-delay connections and 0 in the case of microstep-delay connections.
| List<Action> org.lflang.federated.generator.FederateInstance.networkMessageActions = new ArrayList<>() |
List of networkMessage actions.
Each of these handles a message received from another federate over the network. The ID of receiving port is simply the position of the action in the list. The sending federate needs to specify this ID.
| List<FederateInstance> org.lflang.federated.generator.FederateInstance.networkMessageSourceFederate = new ArrayList<>() |
List of source federate IDs for networkMessage actions.
| Map<PortInstance, Instantiation> org.lflang.federated.generator.FederateInstance.networkPortToIndexer = new HashMap<>() |
The mapping from network multiports of the federate to indexer reactors that split the multiport into individual ports.
| Map<PortInstance, Instantiation> org.lflang.federated.generator.FederateInstance.networkPortToInstantiation = new HashMap<>() |
Mapping from a port instance of a connection to its associated network reaction.
We populate this map as we process connections as a means of annotating intra-federate dependencies
| List<Reactor> org.lflang.federated.generator.FederateInstance.networkReactors = new ArrayList<>() |
List of generated network reactors (network input and outputs) that belong to this federate instance.
| List<Instantiation> org.lflang.federated.generator.FederateInstance.networkReceiverInstantiations = new ArrayList<>() |
List of generated network instantiations (network input and outputs) that belong to this federate instance.
| List<Reaction> org.lflang.federated.generator.FederateInstance.networkReceiverReactions = new ArrayList<>() |
List of generated network reactions (network receivers) that belong to this federate instance.
| List<Instantiation> org.lflang.federated.generator.FederateInstance.networkSenderInstantiations = new ArrayList<>() |
List of generated network instantiations (network input and outputs) that belong to this federate instance.
| List<Reaction> org.lflang.federated.generator.FederateInstance.networkSenderReactions = new ArrayList<>() |
List of generated network reactions (network sender) that belong to this federate instance.
| Set<FederateInstance> org.lflang.federated.generator.FederateInstance.outboundP2PConnections = new LinkedHashSet<>() |
A list of federate with which this federate has an outbound physical connection.
There will only be one physical connection even if federate A has defined multiple physical connections to federate B. The message handler on federate B will be responsible for distinguishing the incoming messages by parsing their header and scheduling the appropriate action.
| int org.lflang.federated.generator.FederateInstance.port = 0 |
The port, if specified using the 'at' keyword.
| List<Reaction> org.lflang.federated.generator.FederateInstance.portAbsentReactions = new ArrayList<>() |
List of generated network control reactions (network sender) that belong to this federate instance.
| Map<FederateInstance, Set<Expression> > org.lflang.federated.generator.FederateInstance.sendsTo = new LinkedHashMap<>() |
Map from the federates that this federate sends messages to the delays on connections to that federate.
The delay set may include null, meaning that there is a connection from the federate instance that has no delay.
| SortedSet<TimeValue> org.lflang.federated.generator.FederateInstance.staaOffsets = new TreeSet<TimeValue>() |
A list of unique STAA offsets over all input ports of this federate.
| HashMap<TimeValue, List<Action> > org.lflang.federated.generator.FederateInstance.staToNetworkActionMap = new HashMap<>() |
Keep a map of STP values to a list of network actions.
| TargetConfig org.lflang.federated.generator.FederateInstance.targetConfig |
Parsed target config of the federate.
| String org.lflang.federated.generator.FederateInstance.user = null |
The user, if specified using the 'at' keyword.
| List<Action> org.lflang.federated.generator.FederateInstance.zeroDelayCycleNetworkMessageActions = new ArrayList<>() |
List of networkMessage actions corresponding to network input ports whose upstream federates are in zero-delay cycles and the connection has no after delay.
This should be a subset of the networkMessageActions.