C Runtime for Lingua Franca
No Matches
lf_token_t Struct Reference

#include <lf_token.h>

Data Fields

size_t length
size_t ref_count
struct lf_token_tnext

Detailed Description

Token type for dynamically allocated arrays and structs sent as messages.

This struct is the wrapper around the dynamically allocated memory that carries the message. The message can be an array of values, where the size of each value is element_size (in bytes). If it is not an array, or is not to be treated as an array, the length == 1.

In the C LF target, a type for an output that ends in '*' or '[]' is treated specially. The value carried by the output is assumed to be in dynamically allocated memory, and, using reference counting, after the last downstream reader of the value has finished, the memory will be freed. To prevent this freeing from occurring, the output type can be specified using the syntax {= type* =}; this will not be treated as dynamically allocated memory. Alternatively, the programmer can give a typedef in the preamble that masks the trailing *.

Field Documentation

◆ length

size_t lf_token_t::length

Length of the array or 1 for a non-array.

◆ next

struct lf_token_t* lf_token_t::next

Convenience for constructing a temporary list of tokens.

◆ ref_count

size_t lf_token_t::ref_count

The number of times this token is on the event queue.

◆ type

token_type_t* lf_token_t::type

Pointer to the port or action defining the type of the data carried.

◆ value

void* lf_token_t::value

Pointer to dynamically allocated memory containing a message.

The documentation for this struct was generated from the following file: