SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
qsg2dasyncresult.h File Reference
#include <QtGlobal>
#include <utility>
Include dependency graph for qsg2dasyncresult.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OpenSWMM::Render::Qsg2DAsyncResult< T >
 

Namespaces

namespace  OpenSWMM
 
namespace  OpenSWMM::Render
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

QSG-2D-1M Phase 7 — cancellation-safe double buffer for asynchronously recomputed derived render geometry (contour bands, isoline segments, velocity samples, far-LOD aggregates).

Contract (all calls on the GUI thread — workers hand their result back via a queued invocation before publishing):

  1. When inputs change, the owner calls beginJob() and captures the returned generation token alongside the input snapshot it hands to the worker.
  2. While a job is in flight, the owner keeps rendering value() — the last published result (double buffering: stale-but-consistent output instead of a stall).
  3. The worker's completion handler calls tryPublish(gen, result). A result whose generation is no longer current is dropped, so a time/style change racing a slow worker can never apply stale output.
  4. invalidate() bumps the generation without starting a job — used when the derived product becomes meaningless (geometry swap).

Header-only, no Qt dependency beyond <QtGlobal>. Unit-tested in tests/unit/test_qsg2d_dirtystate.cpp (stale-result section).