SingleFlightSyncAsyncRunner<TInput,TResult> specialized for OpenCV Mat inputs and outputs. The generic type parameters of the base are both Mat. Async input snapshots use copyTo into an internal buffer before asyncWork runs.
More...
|
| | MatSingleFlightSyncAsyncRunner (bool useAsyncWork, CancellationToken asyncWorkCancellationToken=default, Func< Task > disposeAsyncAfterWorkTask=null) |
| | Initializes a new runner. Only SingleFlightSyncAsyncRunner<Mat,Mat>.DisposeAsync runs disposeAsyncAfterWorkTask ; SingleFlightSyncAsyncRunner<Mat,Mat>.Dispose does not.
|
| |
| void | SubmitWork (Mat input, Func< Mat, Mat > syncWork, Func< Mat, Task< Mat > > asyncWork) |
| | Submits a single image; wraps Mat results as a one-element array for the base runner.
|
| |
| void | SubmitWork (Mat input, Func< Mat, Mat[]> syncWork, Func< Mat, Task< Mat[]> > asyncWork) |
| | Submits a single image by delegating to the Mat[] overload (length 1). Reuses an internal one-element scratch to avoid per-frame array allocation.
|
| |
| bool | TryGetLatestResult (out Mat result) |
| | Returns the single output Mat only when the latest buffer has length exactly one and that element is non-null. Whether the Mat is empty is for the caller to decide. If the latest results have two or more mats, returns false.
|
| |
| void | Cancel () |
| |
| void | Dispose () |
| | Cancels in-flight work, clears the task reference without awaiting, and releases latest and async buffers. Does not call disposeAsyncAfterWorkTask.
|
| |
| async ValueTask | DisposeAsync () |
| | Cancels, awaits the in-flight Task, then awaits the optional disposeAsyncAfterWorkTask callback, then releases state.
|
| |
| void | SubmitWork (TInput[] inputs, Func< TInput[], TResult[]> syncWork, Func< TInput[], Task< TResult[]> > asyncWork) |
| | Submits inputs for work: syncWork on the caller when UseAsyncWork is false, or a single in-flight asyncWork when true. When true, CopyInputsForAsync is used before asyncWork. syncWork receives inputs as passed in.
|
| |
| bool | TryGetLatestResult (out TResult[] results) |
| | Tries to return the latest successful result array. Deriving types can tighten validation via ValidateLatestForTryGet.
|
| |
|
| CancellationToken | InFlightAsyncWorkCancellationToken [get] |
| | Cancellation token produced by linking the constructor cancellation token with the runner local cancellation token while an asynchronous asyncWork delegate is executing. Outside that window (including the synchronous path), this is default.
|
| |
| bool | IsWorkInFlight [get] |
| | true while a previously started asynchronous Task is still in progress (not yet completed, faulted, or canceled). When true, SubmitWork will not start new work.
|
| |
| bool | UseAsyncWork [get, set] |
| | When true, at most one async task runs; a new one starts only when the previous task has completed. When false, SubmitWork runs syncWork on the caller thread (after any still-running asynchronous task from a prior async mode has finished; see IsWorkInFlight and SubmitWork remarks).
|
| |
| Action< WorkCompletion< TResult > > | WorkCompleted |
| | Occurs when a submitted work unit completes (success, cancellation, or fault), on the thread that completed the operation.
|
| |
SingleFlightSyncAsyncRunner<TInput,TResult> specialized for OpenCV Mat inputs and outputs. The generic type parameters of the base are both Mat. Async input snapshots use copyTo into an internal buffer before asyncWork runs.
◆ MatSingleFlightSyncAsyncRunner()
| OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.MatSingleFlightSyncAsyncRunner |
( |
bool | useAsyncWork, |
|
|
CancellationToken | asyncWorkCancellationToken = default, |
|
|
Func< Task > | disposeAsyncAfterWorkTask = null ) |
◆ CopyInputsForAsync()
| override void OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.CopyInputsForAsync |
( |
Mat[] | source, |
|
|
Mat[] | destination ) |
|
protected |
◆ SubmitWork() [1/2]
| void OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.SubmitWork |
( |
Mat | input, |
|
|
Func< Mat, Mat > | syncWork, |
|
|
Func< Mat, Task< Mat > > | asyncWork ) |
Submits a single image; wraps Mat results as a one-element array for the base runner.
◆ SubmitWork() [2/2]
| void OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.SubmitWork |
( |
Mat | input, |
|
|
Func< Mat, Mat[]> | syncWork, |
|
|
Func< Mat, Task< Mat[]> > | asyncWork ) |
Submits a single image by delegating to the Mat[] overload (length 1). Reuses an internal one-element scratch to avoid per-frame array allocation.
◆ TryGetLatestResult()
| bool OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.TryGetLatestResult |
( |
out Mat | result | ) |
|
Returns the single output Mat only when the latest buffer has length exactly one and that element is non-null. Whether the Mat is empty is for the caller to decide. If the latest results have two or more mats, returns false.
Disposal of the latest Mat (and the underlying buffer) is this runner's responsibility: it is released when newer results replace it or when this instance is disposed. Do not call Dispose on result ; the same instance remains owned by the runner until then. result is the runner's live buffer: in-place Mat operations change the stored result. If you need to modify it, call clone() (or copyTo to your own Mat) first, then work on the copy.
◆ ValidateLatestForTryGet()
| override bool OpenCVForUnity.UnityIntegration.Runner.MatSingleFlightSyncAsyncRunner.ValidateLatestForTryGet |
( |
Mat[] | latest | ) |
|
|
protected |
Rejects latest when any element is null. Empty Mat values are not filtered here; callers use empty() or other checks as needed.
The documentation for this class was generated from the following file: