hololink::emulation::DataPlaneCtxt

View as Markdown

Common, target-invariant per-DataPlane context.

Each platform defines its own extension struct (LinuxDataPlaneCtxt, STM32DataPlaneCtxt) with struct ``DataPlaneCtxt`` base as its first member. Standard-layout C++ guarantees &ext->base == reinterpret_cast<DataPlaneCtxt*>(ext), so the DataPlane base class can hold a DataPlaneCtxt* (pointing at the embedded base) without knowing the platform extension, and platform code can downcast back via reinterpret_cast<LinuxDataPlaneCtxt*> (or STM32 equivalent) to reach the platform extras.

Synchronization: running is a plain bool. On platforms where DataPlane::start/stop and DataPlane::is_running may be called from concurrent threads (Linux), the platform extension supplies a mutex that the corresponding platform DataPlane::{start,stop,is_running} implementations acquire around every read/write of running. On single-threaded platforms (STM32) no mutex is needed.

Send paths (DataPlane::send and any transmitter / subclass update_metadata) must NOT read running — sending is intended to be possible at any time the transmitter exists, and checking running from a send path would couple the data path to the BootP control path unnecessarily.

#include <hololink/emulation/data_plane.hpp>

Member variables

NameTypeDescription
dp_registersstruct DPRegisters *
dp_sensor_registersstruct DPSensorRegisters *
runningbool

Inner classes

start_time

struct hololink::emulation::DataPlaneCtxt::start_time