reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
modes.h File Reference

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

#include <stddef.h>
#include <stdbool.h>
#include "lf_types.h"
#include "tag.h"

Go to the source code of this file.

Data Structures

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).

Typedefs

typedef struct mode_state_variable_reset_data_t mode_state_variable_reset_data_t
typedef struct reactor_mode_state_t reactor_mode_state_t
typedef struct reactor_mode_t reactor_mode_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

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

Author
Alexander Schulz-Rosengarten
Soroush Bateni

This file contains user macros for setting new modes, forward declarations for functions and types used in the generated code, and types definitions for the modal representation.

Any mode related code will only work in the presence of the MODAL_REACTORS definition. However, this header should be included regardless to provide definitions for mode-unaware pre-compilation.

This file is intended for direct include in reactor.h augmenting certain type definitions.

Typedef Documentation

◆ mode_state_variable_reset_data_t

typedef struct mode_state_variable_reset_data_t mode_state_variable_reset_data_t

◆ reactor_mode_state_t

typedef struct reactor_mode_state_t reactor_mode_state_t

◆ reactor_mode_t

typedef struct reactor_mode_t reactor_mode_t