reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
environment.h
Go to the documentation of this file.
1
16#ifndef ENVIRONMENT_H
17#define ENVIRONMENT_H
18
19#include "lf_types.h"
20#include "low_level_platform.h"
21#include "tracepoint.h"
22
23// Forward declarations so that a pointers can appear in the environment struct.
27typedef struct watchdog_t watchdog_t;
28
39#define GLOBAL_ENVIRONMENT NULL
40
49typedef struct environment_t {
51 bool execution_started; // Events at the start tag have been pulled from the event queue.
52 char* name;
53 int id;
76#if defined(LF_SINGLE_THREADED)
77 pqueue_t* reaction_q;
78#else
86#endif // LF_SINGLE_THREADED
87#if defined(FEDERATED)
88 tag_t** _lf_intended_tag_fields;
89 int _lf_intended_tag_fields_size;
90 bool need_to_send_LTC;
91#endif // FEDERATED
92#ifdef LF_ENCLAVES // TODO: Consider dropping #ifdef
93 enclave_info_t* enclave_info;
94#endif
96
97#if defined(MODAL_REACTORS)
98struct mode_environment_t {
99 uint8_t triggered_reactions_request;
100 reactor_mode_state_t** modal_reactor_states;
101 int modal_reactor_states_size;
102 mode_state_variable_reset_data_t* state_resets;
103 int state_resets_size;
104};
105#endif
106
110int environment_init(environment_t* env, const char* name, int id, int num_workers, int num_timers,
111 int num_startup_reactions, int num_shutdown_reactions, int num_reset_reactions,
112 int num_is_present_fields, int num_modes, int num_state_resets, int num_watchdogs,
113 const char* trace_file_name);
114
121
127
132
140
141#endif
struct enclave_info_t enclave_info_t
Definition environment.h:26
struct mode_environment_t mode_environment_t
Definition environment.h:25
struct environment_t environment_t
Execution environment. This struct contains information about the execution environment....
Definition lf_types.h:262
int environment_init(environment_t *env, const char *name, int id, int num_workers, int num_timers, int num_startup_reactions, int num_shutdown_reactions, int num_reset_reactions, int num_is_present_fields, int num_modes, int num_state_resets, int num_watchdogs, const char *trace_file_name)
Initialize an environment struct with parameters given in the arguments.
Definition environment.c:207
int _lf_get_environments(environment_t **envs)
Will update the argument to point to the beginning of the array of environments in this program.
Definition src_gen_stub.c:19
void environment_verify(environment_t *env)
Verify that the environment is correctly set up.
Definition environment.c:294
void environment_init_tags(environment_t *env, instant_t start_time, interval_t duration)
Initialize the start and stop tags on the environment struct.
Definition environment.c:195
void environment_free(environment_t *env)
Free the dynamically allocated memory on the environment struct.
Definition environment.c:178
void * lf_thread_t
Definition lf_arduino_support.h:120
void * lf_mutex_t
Definition lf_arduino_support.h:118
Type definitions that are widely used across different parts of the runtime.
int trigger_handle_t
Definition lf_types.h:117
Platform API support for the C target of Lingua Franca.
instant_t start_time
Definition tag.c:33
instant_t duration
Definition reactor_common.c:85
Definition lf_types.h:58
Execution environment. This struct contains information about the execution environment....
Definition environment.h:49
int is_present_fields_abbreviated_size
Definition environment.h:61
lf_mutex_t mutex
Definition environment.h:81
int is_present_fields_size
Definition environment.h:59
_lf_tag_advancement_barrier barrier
Definition environment.h:84
int timer_triggers_size
Definition environment.h:65
lf_cond_t event_q_changed
Definition environment.h:82
int watchdogs_size
Definition environment.h:73
int id
Definition environment.h:53
bool initialized
Definition environment.h:50
int num_workers
Definition environment.h:79
mode_environment_t * modes
Definition environment.h:72
int reset_reactions_size
Definition environment.h:71
char * name
Definition environment.h:52
trigger_t ** timer_triggers
Definition environment.h:64
int worker_thread_count
Definition environment.h:75
reaction_t ** startup_reactions
Definition environment.h:66
tag_t stop_tag
Definition environment.h:55
int startup_reactions_size
Definition environment.h:67
reaction_t ** reset_reactions
Definition environment.h:70
pqueue_tag_t * recycle_q
Definition environment.h:57
bool execution_started
Definition environment.h:51
reaction_t ** shutdown_reactions
Definition environment.h:68
int shutdown_reactions_size
Definition environment.h:69
lf_cond_t global_tag_barrier_requestors_reached_zero
Definition environment.h:85
bool ** is_present_fields
Definition environment.h:58
trigger_handle_t _lf_handle
Definition environment.h:63
watchdog_t ** watchdogs
Definition environment.h:74
tag_t current_tag
Definition environment.h:54
bool ** is_present_fields_abbreviated
Definition environment.h:60
vector_t sparse_io_record_sizes
Definition environment.h:62
lf_scheduler_t * scheduler
Definition environment.h:83
lf_thread_t * thread_ids
Definition environment.h:80
pqueue_tag_t * event_q
Definition environment.h:56
Definition lf_POSIX_threads_support.h:41
Paramters used in schedulers of the threaded reactor C runtime.
Definition scheduler_instance.h:34
Definition pqueue_base.h:73
Definition lf_types.h:155
Definition tag.h:81
Definition lf_types.h:208
Definition vector.h:16
Definition watchdog.h:29
int64_t instant_t
Definition tag.h:66
int64_t interval_t
Definition tag.h:71
Definitions of tracepoint functions for use with the C code generator and any other code generator th...