reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
generic_port_capsule_struct Struct Reference

#include <python_port.h>

Data Fields

PyObject_HEAD PyObject * port
 
PyObject * value
 
bool is_present
 
int width
 
long current_index
 

Detailed Description

The struct used to represent ports in Python This template is used as a blueprint to create Python objects that follow the same structure. The resulting Python object will have the type py_port_capsule_t in C (LinguaFranca.port_capsule in Python).

port: A PyCapsule (https://docs.python.org/3/c-api/capsule.html) that safely holds a C void* inside a Python object. This capsule is passed through the Python code and is extracted in C functions like set and getitem. value: The value of the port at the time of invocation of

See also
convert_C_port_to_py. The value and is_present are copied from the port if it is not a multiport and can be accessed as port.value. For multiports, is_present will be false and value will be None. The value of each individual port can be accessed as port[idx].value (
port_capsule_get_item). Subsequent calls to set will also need to update the value and is_present fields so that they are reflected in Python code. is_present: Indicates if the value of the singular port is present at the current logical time width: Indicates the width of the multiport. This is set to -2 for non-multiports. current_index: Used to facilitate iterative functions (
port_iter)

Field Documentation

◆ current_index

long generic_port_capsule_struct::current_index

◆ is_present

bool generic_port_capsule_struct::is_present

◆ port

PyObject_HEAD PyObject* generic_port_capsule_struct::port

◆ value

PyObject* generic_port_capsule_struct::value

◆ width

int generic_port_capsule_struct::width

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