![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Base type for ports (lf_port_base_t) and actions (trigger_t), which can carry tokens. More...
#include <lf_token.h>
Data Fields | |
| size_t | length |
| Length of the token's value array. | |
| lf_token_t * | token |
| Pointer to the current token. | |
| token_type_t | type |
| Type information for the token. | |
Base type for ports (lf_port_base_t) and actions (trigger_t), which can carry tokens.
The structs lf_port_base_t and trigger_t should start with an instance of this struct so that they can be cast to this struct to access these fields in a uniform way. This template provides the common structure for handling tokens in both ports and actions, ensuring consistent token management across different types of connections.
| size_t token_template_t::length |
Length of the token's value array.
Provides convenient access to the token's length in reactions. For non-array values, this will be 1. For arrays, this indicates the number of elements in the array. This field is cached here to avoid repeated dereferencing of the token structure.
| lf_token_t* token_template_t::token |
Pointer to the current token.
Points to the token currently associated with this template. May be NULL if no token is currently assigned. The token's reference count is managed by the runtime system to ensure proper memory management.
| token_type_t token_template_t::type |
Type information for the token.
This field means a token_template_tcan be cast to token_type_t to access type-specific information such as element size, destructor, and copy constructor. This allows for uniform handling of different token types while maintaining type safety.