Detection Worker Adapter
app.infrastructure.adapters.detection_worker_adapterExplicit adapter wrapping DetectionWorker to DetectionWorkerInterface.
See Also
DetectionWorkerInterface— defines the exposed worker contractDetectionWorker— concrete worker being adapted
Layer: Infrastructure. Context: Implements concrete processing and I/O behind application-facing contracts.
DetectionWorkerAdapter
Bases: DetectionWorkerInterface
Explicit adapter that wraps a concrete DetectionWorker instance and
exposes the DetectionWorkerInterface contract.
In normal usage the concrete DetectionWorker already satisfies
DetectionWorkerInterface via structural subtyping (Protocol), so
this adapter is not required for runtime correctness. It exists to:
- Provide an explicit, named boundary at the infrastructure/application seam.
- Enable test doubles that replace the real worker without subclassing
DetectionWorker.
Note
Qt signals (batch_ready, progress_updated, finished_processing,
error_occurred) are not part of the interface contract and remain on
the concrete worker. Callers that need to connect signals must hold a
reference to the concrete DetectionWorker directly.
| PARAMETER | DESCRIPTION |
|---|---|
worker
|
Concrete detection worker wrapped by this adapter.
TYPE:
|
batch_ready
property
Expose the Qt signal so existing connect call-sites work unchanged.
progress_updated
property
Expose the Qt signal so existing connect call-sites work unchanged.
__init__(worker: DetectionWorker) -> None
get_all_detections() -> dict[int, list[DetectionResult]]
Return all cached detections grouped by frame index.
| RETURNS | DESCRIPTION |
|---|---|
dict[int, list[DetectionResult]]
|
New mapping copied from the wrapped worker's cache. |
get_detections(frame_index: int) -> list[DetectionResult] | None
Return cached detections for one frame.
| PARAMETER | DESCRIPTION |
|---|---|
frame_index
|
Zero-based index of the frame whose detections are requested.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DetectionResult] | None
|
Detections for the frame, or |
isRunning() -> bool
Return whether the worker thread is running.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
is_complete() -> bool
Return whether the worker has processed all frames.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
start() -> None
Start the wrapped detection worker.
stop() -> None
Stop the wrapped detection worker.