lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.python.PythonReactorGenerator Class Reference

Generate Python code for reactors. More...

Static Public Member Functions

static String generateListsToHoldClassInstances (ReactorInstance instance)
 Generate code to instantiate a Python list that will hold the Python class instance of reactor instance.
static String generatePythonClass (ReactorInstance instance, List< String > instantiatedClasses, ReactorInstance main, PythonTypes types)
 Generate a Python class corresponding to decl.
static String generatePythonClass (ReactorInstance instance, ReactorInstance main, PythonTypes types)
 Wrapper function for the more elaborate generatePythonReactorClass that keeps track of visited reactors to avoid duplicate generation.
static String generatePythonClassInstantiations (ReactorInstance instance, ReactorInstance main)
 Instantiate classes in Python, as well as subclasses.

Detailed Description

Generate Python code for reactors.

Member Function Documentation

◆ generateListsToHoldClassInstances()

String org.lflang.generator.python.PythonReactorGenerator.generateListsToHoldClassInstances ( ReactorInstance instance)
static

Generate code to instantiate a Python list that will hold the Python class instance of reactor instance.

Will recursively do the same for the children of instance as well.

Parameters
instanceThe reactor instance for which the Python list will be created.

◆ generatePythonClass() [1/2]

String org.lflang.generator.python.PythonReactorGenerator.generatePythonClass ( ReactorInstance instance,
List< String > instantiatedClasses,
ReactorInstance main,
PythonTypes types )
static

Generate a Python class corresponding to decl.

Parameters
instanceThe reactor instance to be generated
instantiatedClassesA list of visited instances to avoid generating duplicates
mainThe main reactor instance.
typesThe Python type helper.

◆ generatePythonClass() [2/2]

String org.lflang.generator.python.PythonReactorGenerator.generatePythonClass ( ReactorInstance instance,
ReactorInstance main,
PythonTypes types )
static

Wrapper function for the more elaborate generatePythonReactorClass that keeps track of visited reactors to avoid duplicate generation.

Parameters
instanceThe reactor instance to be generated
mainThe main reactor instance.
typesThe Python type helper.

◆ generatePythonClassInstantiations()

String org.lflang.generator.python.PythonReactorGenerator.generatePythonClassInstantiations ( ReactorInstance instance,
ReactorInstance main )
static

Instantiate classes in Python, as well as subclasses.

Instances are always instantiated as a list of className = [_className, _className, ...] depending on the size of the bank. If there is no bank or the size is 1, the instance would be generated as className = [_className]

Parameters
instanceThe reactor instance to be instantiated
mainThe main reactor

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