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

Generate C code for watchdogs. More...

Static Public Member Functions

static boolean hasWatchdogs (Reactor reactor)
 Return true if the given reactor has one or more watchdogs.

Static Protected Member Functions

static void generateInitializeWatchdogs (CodeBuilder code, ReactorInstance instance)
 For the specified reactor instance, generate initialization code for each watchdog in the reactor.
static void generateWatchdogs (CodeBuilder src, CodeBuilder header, TypeParameterizedReactor tpr, boolean suppressLineDirectives, MessageReporter messageReporter)
 Generate watchdog functions definition for a reactor.
static void generateWatchdogStruct (CodeBuilder body, TypeParameterizedReactor tpr, CodeBuilder constructorCode)
 Generate watchdog definitions in the reactor's self struct.

Detailed Description

Generate C code for watchdogs.

This class contains a collection of static methods supporting code generation in C for watchdogs. These methods are protected because they are intended to be used only within the same package.

Author
Benjamin Asch
Edward A. Lee

Member Function Documentation

◆ generateInitializeWatchdogs()

void org.lflang.generator.c.CWatchdogGenerator.generateInitializeWatchdogs ( CodeBuilder code,
ReactorInstance instance )
staticprotected

For the specified reactor instance, generate initialization code for each watchdog in the reactor.

This code initializes the watchdog-related fields on the self struct of the reactor instance. It also increments the watchdog count in the environment the parent reactor instance is within.

Parameters
codeThe place to put the code
instanceThe reactor instance

◆ generateWatchdogs()

void org.lflang.generator.c.CWatchdogGenerator.generateWatchdogs ( CodeBuilder src,
CodeBuilder header,
TypeParameterizedReactor tpr,
boolean suppressLineDirectives,
MessageReporter messageReporter )
staticprotected

Generate watchdog functions definition for a reactor.

These functions have a single argument that is a void* pointing to the self struct of the reactor, which contains parameters, state variables, inputs (triggering or not), actions (triggering or produced), and outputs.

Parameters
srcThe place to put the code
headerThe place to put header code
tprThe reactor declaration
suppressLineDirectivesWhether to suppress the generation of line directives.
messageReporterUsed to report errors and warnings.

◆ generateWatchdogStruct()

void org.lflang.generator.c.CWatchdogGenerator.generateWatchdogStruct ( CodeBuilder body,
TypeParameterizedReactor tpr,
CodeBuilder constructorCode )
staticprotected

Generate watchdog definitions in the reactor's self struct.

Parameters
bodyThe place to put the definitions
tprThe concrete reactor class
constructorCodeThe place to put initialization code.

◆ hasWatchdogs()

boolean org.lflang.generator.c.CWatchdogGenerator.hasWatchdogs ( Reactor reactor)
static

Return true if the given reactor has one or more watchdogs.

Parameters
reactorThe reactor.
Returns
True if the given reactor has watchdogs.

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/c/CWatchdogGenerator.java