lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.federated.extensions.TSExtension Class Reference

An extension class to the TSGenerator that enables certain federated functionalities. More...

Inherits org.lflang.federated.extensions.FedTargetExtension.

Public Member Functions

void addSenderIndexParameter (Reactor sender)
 Generate code for the parameter that specifies the sender index.
default void annotateReaction (Reaction reaction)
 Optionally apply additional annotations to the reaction.
String generateNetworkReceiverBody (Action action, VarRef sendingPort, VarRef receivingPort, FedConnectionInstance connection, InferredType type, CoordinationMode coordinationMode, MessageReporter messageReporter)
 Generate code for the body of a reaction that handles the action that is triggered by receiving a message from a remote federate.
String generateNetworkSenderBody (VarRef sendingPort, VarRef receivingPort, FedConnectionInstance connection, InferredType type, CoordinationMode coordinationMode, MessageReporter messageReporter)
 Generate code for the body of a reaction that handles an output that is to be sent over the network.
String generatePortAbsentReactionBody (VarRef srcOutputPort, FedConnectionInstance connection)
 Generate code for the body of a reaction that sends a port status message for the given port if it is absent.
String generatePreamble (FederateInstance federate, FederationFileConfig fileConfig, RtiConfig rtiConfig, MessageReporter messageReporter)
 Add preamble to the source to set up federated execution.
String getNetworkBufferType ()
 Return the type for the raw network buffer in the target language (e.g., uint_8 in C).
void initializeTargetConfig (LFGeneratorContext context, List< String > federateNames, FederateInstance federate, FederationFileConfig fileConfig, MessageReporter messageReporter, RtiConfig rtiConfig)
 Perform necessary actions to initialize the target config.
String outputInitializationBody ()
 Generate code for initializing a network output reactor from its startup reaction.
void supplySenderIndexParameter (Instantiation inst, int idx)
 Generate code for the sender index argument of instantiation.

Detailed Description

An extension class to the TSGenerator that enables certain federated functionalities.

Member Function Documentation

◆ addSenderIndexParameter()

void org.lflang.federated.extensions.TSExtension.addSenderIndexParameter ( Reactor sender)

Generate code for the parameter that specifies the sender index.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ annotateReaction()

default void org.lflang.federated.extensions.FedTargetExtension.annotateReaction ( Reaction reaction)
inherited

Optionally apply additional annotations to the reaction.

Implemented in org.lflang.federated.extensions.PythonExtension.

◆ generateNetworkReceiverBody()

String org.lflang.federated.extensions.TSExtension.generateNetworkReceiverBody ( Action action,
VarRef sendingPort,
VarRef receivingPort,
FedConnectionInstance connection,
InferredType type,
CoordinationMode coordinationMode,
MessageReporter messageReporter )

Generate code for the body of a reaction that handles the action that is triggered by receiving a message from a remote federate.

Parameters
actionThe action.
sendingPortThe output port providing the data to send.
receivingPortThe ID of the destination port.
connectionThe federated connection being lowered.
typeThe type of the data being sent over the connection.
coordinationModeThe coordination type
messageReporterUsed to report errors and warnings.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ generateNetworkSenderBody()

String org.lflang.federated.extensions.TSExtension.generateNetworkSenderBody ( VarRef sendingPort,
VarRef receivingPort,
FedConnectionInstance connection,
InferredType type,
CoordinationMode coordinationMode,
MessageReporter messageReporter )

Generate code for the body of a reaction that handles an output that is to be sent over the network.

Parameters
sendingPortThe output port providing the data to send.
receivingPortThe variable reference to the destination port.
connectionThe federated connection being lowered.
typeThe type of the data being sent over the connection.
coordinationModeWhether the federated program is centralized or decentralized.
messageReporterUsed to report errors and warnings.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ generatePortAbsentReactionBody()

String org.lflang.federated.extensions.TSExtension.generatePortAbsentReactionBody ( VarRef srcOutputPort,
FedConnectionInstance connection )

Generate code for the body of a reaction that sends a port status message for the given port if it is absent.

Parameters
srcOutputPortA reference to the output port of the federate instance.
connectionThe federated connection being lowered.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ generatePreamble()

String org.lflang.federated.extensions.TSExtension.generatePreamble ( FederateInstance federate,
FederationFileConfig fileConfig,
RtiConfig rtiConfig,
MessageReporter messageReporter )

Add preamble to the source to set up federated execution.

Parameters
federateThe federate to which the generated setup code will correspond.
fileConfigThe federation file configuration.
rtiConfigThe settings of the RTI.
messageReporterUsed to report errors and warnings.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ getNetworkBufferType()

String org.lflang.federated.extensions.TSExtension.getNetworkBufferType ( )

Return the type for the raw network buffer in the target language (e.g., uint_8 in C).

This would be the type of the network messages after serialization and before deserialization. It is primarily used to determine the type for the network action at the receiver.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ initializeTargetConfig()

void org.lflang.federated.extensions.TSExtension.initializeTargetConfig ( LFGeneratorContext context,
List< String > federateNames,
FederateInstance federate,
FederationFileConfig fileConfig,
MessageReporter messageReporter,
RtiConfig rtiConfig )

Perform necessary actions to initialize the target config.

Parameters
contextThe context of the original code generation process.
federateNamesThe names of all the federates in the program.
federateThe federate instance.
fileConfigAn instance of FedFileConfig.
messageReporterUsed to report errors.
rtiConfigThe RTI configuration settings.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ outputInitializationBody()

String org.lflang.federated.extensions.TSExtension.outputInitializationBody ( )

Generate code for initializing a network output reactor from its startup reaction.

Implements org.lflang.federated.extensions.FedTargetExtension.

◆ supplySenderIndexParameter()

void org.lflang.federated.extensions.TSExtension.supplySenderIndexParameter ( Instantiation inst,
int idx )

Generate code for the sender index argument of instantiation.

Implements org.lflang.federated.extensions.FedTargetExtension.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/federated/extensions/TSExtension.java