wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SimulationBlocker Class Reference

RAII guard that stops the simulation on construction and restarts it on destruction. More...

#include <SimulationBlocker.h>

Public Member Functions

 SimulationBlocker (Simulation *simulation)
 Stops simulation if it was running and records whether to restart.
 ~SimulationBlocker ()
 Restarts the simulation if it was running when this blocker was created.

Detailed Description

RAII guard that stops the simulation on construction and restarts it on destruction.

Used to safely perform operations (e.g. loading a file, rebuilding the element map) that must not run while the simulation timer is active.

Example:

{
SimulationBlocker blocker(simulation);
// ... do non-thread-safe circuit modification ...
} // simulation restarts here
SimulationBlocker(Simulation *simulation)
Stops simulation if it was running and records whether to restart.

Definition at line 29 of file SimulationBlocker.h.

Constructor & Destructor Documentation

◆ SimulationBlocker()

SimulationBlocker::SimulationBlocker ( Simulation * simulation)
explicit

Stops simulation if it was running and records whether to restart.

Parameters
simulationSimulation to block.

Definition at line 9 of file SimulationBlocker.cpp.

References qCDebug.

◆ ~SimulationBlocker()

SimulationBlocker::~SimulationBlocker ( )

Restarts the simulation if it was running when this blocker was created.

Definition at line 22 of file SimulationBlocker.cpp.

References qCDebug.


The documentation for this class was generated from the following files: