reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
Modal

API used internally to support modal reactors. More...

Files

file  modes.h
 Header file of the runtime infrastructure for modes in the C target of Lingua Franca.

Data Structures

struct  mode_environment_t
 Environment for modal reactors. More...
struct  mode_state_variable_reset_data_t
 A struct to store data for resetting state variables nested in modes. More...
struct  reactor_mode_state_t
 A struct to store state of the modes in a reactor instance and/or its relation to enclosing modes. More...
struct  reactor_mode_t
 A struct to represent a single mode instace in a reactor instance. More...

Macros

#define _LF_SET_MODE_WITH_TYPE(mode, change_type)
 Set the next mode of a modal reactor with an explicit change type (reset or history, from the enum lf_mode_change_type_t).

Enumerations

enum  lf_mode_change_type_t { no_transition , reset_transition , history_transition }
 Type of the mode change. More...

Functions

void _lf_add_suspended_event (event_t *event)
 Add a suspended event to the list of suspended events.
void _lf_handle_mode_changes (environment_t *env)
 Handle the mode changes in the environment.
void _lf_handle_mode_shutdown_reactions (environment_t *env, reaction_t **shutdown_reactions, int shutdown_reactions_size)
 Handle the mode shutdown reactions in the environment.
void _lf_handle_mode_startup_reset_reactions (environment_t *env, reaction_t **startup_reactions, int startup_reactions_size, reaction_t **reset_reactions, int reset_reactions_size, reactor_mode_state_t *states[], int states_size)
 Handle the mode startup reset reactions in the environment.
void _lf_handle_mode_triggered_reactions (environment_t *env)
 Handle the mode triggered reactions in the environment.
void _lf_initialize_mode_states (environment_t *env, reactor_mode_state_t *states[], int states_size)
 Initialize the mode states in the environment.
void _lf_initialize_modes (environment_t *env)
 Initialize the modes in the environment.
bool _lf_mode_is_active (reactor_mode_t *mode)
 Check whether a mode is active.
void _lf_process_mode_changes (environment_t *env, reactor_mode_state_t *states[], int states_size, mode_state_variable_reset_data_t reset_data[], int reset_data_size, trigger_t *timer_triggers[], int timer_triggers_size)
 Process the mode changes in the environment.
void _lf_terminate_modal_reactors (environment_t *env)
 Terminate the modal reactors in the environment.

Detailed Description

API used internally to support modal reactors.

These functions and types are not meant to be used directly by users, but are useful for developers.

Note
Only used in modal reactor execution.

Macro Definition Documentation

◆ _LF_SET_MODE_WITH_TYPE

#define _LF_SET_MODE_WITH_TYPE ( mode,
change_type )

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Value:
do { \
((self_base_t*)self)->_lf__mode_state.next_mode = mode; \
((self_base_t*)self)->_lf__mode_state.mode_change = change_type; \
} while (0)
The base type for all reactor self structs.
Definition lf_types.h:519

Set the next mode of a modal reactor with an explicit change type (reset or history, from the enum lf_mode_change_type_t).

This macro is not meant to be used by LF programmers. It is used in Python.

Parameters
modeThe target mode to set for activation.
change_typeThe change type of the transition.

Enumeration Type Documentation

◆ lf_mode_change_type_t

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Type of the mode change.

Enumerator
no_transition 
reset_transition 
history_transition 

Function Documentation

◆ _lf_add_suspended_event()

void _lf_add_suspended_event ( event_t * event)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Add a suspended event to the list of suspended events.

Parameters
eventThe event to add.

◆ _lf_handle_mode_changes()

void _lf_handle_mode_changes ( environment_t * env)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Handle the mode changes in the environment.

Parameters
envThe environment to handle the mode changes in.

◆ _lf_handle_mode_shutdown_reactions()

void _lf_handle_mode_shutdown_reactions ( environment_t * env,
reaction_t ** shutdown_reactions,
int shutdown_reactions_size )

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Handle the mode shutdown reactions in the environment.

Parameters
envThe environment to handle the mode shutdown reactions in.
shutdown_reactionsThe array of shutdown reactions to handle.
shutdown_reactions_sizeThe size of the shutdown reactions array.

◆ _lf_handle_mode_startup_reset_reactions()

void _lf_handle_mode_startup_reset_reactions ( environment_t * env,
reaction_t ** startup_reactions,
int startup_reactions_size,
reaction_t ** reset_reactions,
int reset_reactions_size,
reactor_mode_state_t * states[],
int states_size )

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Handle the mode startup reset reactions in the environment.

Parameters
envThe environment to handle the mode startup reset reactions in.
startup_reactionsThe array of startup reactions to handle.
startup_reactions_sizeThe size of the startup reactions array.
reset_reactionsThe array of reset reactions to handle.
reset_reactions_sizeThe size of the reset reactions array.
statesThe array of mode states to handle.
states_sizeThe size of the states array.

◆ _lf_handle_mode_triggered_reactions()

void _lf_handle_mode_triggered_reactions ( environment_t * env)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Handle the mode triggered reactions in the environment.

Parameters
envThe environment to handle the mode triggered reactions in.

◆ _lf_initialize_mode_states()

void _lf_initialize_mode_states ( environment_t * env,
reactor_mode_state_t * states[],
int states_size )

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Initialize the mode states in the environment.

Parameters
envThe environment to initialize the mode states in.
statesThe array of mode states to initialize.
states_sizeThe size of the states array.

◆ _lf_initialize_modes()

void _lf_initialize_modes ( environment_t * env)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Initialize the modes in the environment.

Parameters
envThe environment to initialize the modes in.

◆ _lf_mode_is_active()

bool _lf_mode_is_active ( reactor_mode_t * mode)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Check whether a mode is active.

Parameters
modeThe mode to check.
Returns
True if the mode is active, false otherwise.

◆ _lf_process_mode_changes()

void _lf_process_mode_changes ( environment_t * env,
reactor_mode_state_t * states[],
int states_size,
mode_state_variable_reset_data_t reset_data[],
int reset_data_size,
trigger_t * timer_triggers[],
int timer_triggers_size )

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Process the mode changes in the environment.

Parameters
envThe environment to process the mode changes in.
statesThe array of mode states to process.
states_sizeThe size of the states array.
reset_dataThe array of reset data to process.
reset_data_sizeThe size of the reset data array.
timer_triggersThe array of timer triggers to process.
timer_triggers_sizeThe size of the timer triggers array.

◆ _lf_terminate_modal_reactors()

void _lf_terminate_modal_reactors ( environment_t * env)

#include </Users/runner/work/reactor-c/reactor-c/include/core/modal_models/modes.h>

Terminate the modal reactors in the environment.

Parameters
envThe environment to terminate the modal reactors in.