Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::AnalysisRunner Class Reference

Manages the background thread and logic for running analysis workflows. More...

#include <AnalysisRunner.hpp>

Collaboration diagram for correlation::app::AnalysisRunner:

Public Member Functions

 AnalysisRunner (::AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, ProgramOptions &options, AppController &controller)
 Constructs the AnalysisRunner with injected services.
 ~AnalysisRunner ()
 Destructor. Ensures analysis thread is joined.
void handleRunAnalysis ()
 Handles triggering the trajectory analysis execution.
void updateProgress (float progress, const std::string &msg)
 Updates the UI progress indicator and status text.

Private Member Functions

void joinPreviousThreadAsync ()
 Asynchronously joins any running background thread to prevent blocking the UI.
std::string executeAnalysis ()
 Executes the analysis workflow synchronously within the worker thread.
void handleAnalysisCompletion (const std::string &err)
 Updates the UI state and models once the analysis has completed.

Private Attributes

::AppWindow & window_
TrajectoryLoader & loader_
AnalysisDispatcher & dispatcher_
ProgramOptions & options_
AppController & controller_
std::shared_ptr< std::atomic< bool > > alive_
 Lifetime guard for queued UI callbacks.
std::jthread analysis_thread_
 Handle for the background analysis computation.

Detailed Description

Manages the background thread and logic for running analysis workflows.

Constructor & Destructor Documentation

◆ AnalysisRunner()

correlation::app::AnalysisRunner::AnalysisRunner ( ::AppWindow & window,
TrajectoryLoader & loader,
AnalysisDispatcher & dispatcher,
ProgramOptions & options,
AppController & controller )

Constructs the AnalysisRunner with injected services.

Parameters
[in,out]windowReference to the UI window.
[in,out]loaderReference to the trajectory loader.
[in,out]dispatcherReference to the analysis dispatcher.
[in,out]optionsReference to program options.
[in,out]controllerReference to the main AppController.

◆ ~AnalysisRunner()

correlation::app::AnalysisRunner::~AnalysisRunner ( )

Destructor. Ensures analysis thread is joined.

Member Function Documentation

◆ executeAnalysis()

std::string correlation::app::AnalysisRunner::executeAnalysis ( )
nodiscardprivate

Executes the analysis workflow synchronously within the worker thread.

Returns
Error message if analysis failed or was aborted, empty string otherwise.
Here is the caller graph for this function:

◆ handleAnalysisCompletion()

void correlation::app::AnalysisRunner::handleAnalysisCompletion ( const std::string & err)
private

Updates the UI state and models once the analysis has completed.

Parameters
[in]errError message from execution, if any.
Here is the caller graph for this function:

◆ handleRunAnalysis()

void correlation::app::AnalysisRunner::handleRunAnalysis ( )

Handles triggering the trajectory analysis execution.

Here is the call graph for this function:

◆ joinPreviousThreadAsync()

void correlation::app::AnalysisRunner::joinPreviousThreadAsync ( )
private

Asynchronously joins any running background thread to prevent blocking the UI.

Here is the caller graph for this function:

◆ updateProgress()

void correlation::app::AnalysisRunner::updateProgress ( float progress,
const std::string & msg )

Updates the UI progress indicator and status text.

Parameters
[in]progressCompletion fraction [0.0 - 1.0].
[in]msgStatus update message string.
Here is the caller graph for this function:

Member Data Documentation

◆ alive_

std::shared_ptr<std::atomic<bool> > correlation::app::AnalysisRunner::alive_
private
Initial value:
{
std::make_shared<std::atomic<bool>>(true)}

Lifetime guard for queued UI callbacks.

◆ analysis_thread_

std::jthread correlation::app::AnalysisRunner::analysis_thread_
private

Handle for the background analysis computation.

◆ controller_

AppController& correlation::app::AnalysisRunner::controller_
private

◆ dispatcher_

AnalysisDispatcher& correlation::app::AnalysisRunner::dispatcher_
private

◆ loader_

TrajectoryLoader& correlation::app::AnalysisRunner::loader_
private

◆ options_

ProgramOptions& correlation::app::AnalysisRunner::options_
private

◆ window_

::AppWindow& correlation::app::AnalysisRunner::window_
private

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