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)