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

Coordinates OS native save dialogs, comparison datasets formatting, and export I/O. More...

#include <PlotExportManager.hpp>

Public Types

using StatusCallback = std::function<void(const std::string &)>
 Callback type for reporting export results or user cancellations.

Public Member Functions

 PlotExportManager ()
 Default constructor.
 ~PlotExportManager ()
 Destructor. Joins active dialog thread if running.
 PlotExportManager (const PlotExportManager &)=delete
PlotExportManager & operator= (const PlotExportManager &)=delete
 PlotExportManager (PlotExportManager &&)=delete
PlotExportManager & operator= (PlotExportManager &&)=delete
void exportPlotAsync (const std::string &default_base_path, const std::string &plot_name, const correlation::analysis::Histogram *hist, correlation::plotters::PlotConfig config, std::vector< PinnedRun > pinned_runs, std::map< std::string, real_t > ashcroft_weights, StatusCallback on_status)
 Launches the native OS save dialog on a background worker and executes the save on completion.
bool isDialogActive () const noexcept
 Checks if a native save file dialog is currently active.

Static Public Member Functions

static std::expected< void, std::string > savePlot (const std::string &filepath, const std::string &plot_name, const correlation::analysis::Histogram *hist, correlation::plotters::PlotConfig config, std::span< const PinnedRun > pinned_runs, const std::map< std::string, real_t > &ashcroft_weights={})
 Saves a plot synchronously to a destination filepath.

Private Attributes

std::jthread dialog_thread_
std::atomic< bool > dialog_active_ {false}

Detailed Description

Coordinates OS native save dialogs, comparison datasets formatting, and export I/O.

Member Typedef Documentation

◆ StatusCallback

using correlation::app::PlotExportManager::StatusCallback = std::function<void(const std::string &)>

Callback type for reporting export results or user cancellations.

Constructor & Destructor Documentation

◆ PlotExportManager() [1/3]

correlation::app::PlotExportManager::PlotExportManager ( )
default

Default constructor.

Here is the caller graph for this function:

◆ ~PlotExportManager()

correlation::app::PlotExportManager::~PlotExportManager ( )

Destructor. Joins active dialog thread if running.

◆ PlotExportManager() [2/3]

correlation::app::PlotExportManager::PlotExportManager ( const PlotExportManager & )
delete
Here is the call graph for this function:

◆ PlotExportManager() [3/3]

correlation::app::PlotExportManager::PlotExportManager ( PlotExportManager && )
delete
Here is the call graph for this function:

Member Function Documentation

◆ exportPlotAsync()

void correlation::app::PlotExportManager::exportPlotAsync ( const std::string & default_base_path,
const std::string & plot_name,
const correlation::analysis::Histogram * hist,
correlation::plotters::PlotConfig config,
std::vector< PinnedRun > pinned_runs,
std::map< std::string, real_t > ashcroft_weights,
StatusCallback on_status )

Launches the native OS save dialog on a background worker and executes the save on completion.

Parameters
[in]default_base_pathBase output file path from program options.
[in]plot_nameName of the plot to export.
[in]histActive histogram pointer.
[in]configBase plot configuration.
[in]pinned_runsVector of pinned runs for comparison exports.
[in]ashcroft_weightsMap of Ashcroft weights.
[in]on_statusCallback invoked on the Slint main event loop with status text.
Here is the call graph for this function:

◆ isDialogActive()

bool correlation::app::PlotExportManager::isDialogActive ( ) const
nodiscardnoexcept

Checks if a native save file dialog is currently active.

Returns
True if dialog is running, false otherwise.

◆ operator=() [1/2]

PlotExportManager & correlation::app::PlotExportManager::operator= ( const PlotExportManager & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

PlotExportManager & correlation::app::PlotExportManager::operator= ( PlotExportManager && )
delete
Here is the call graph for this function:

◆ savePlot()

std::expected< void, std::string > correlation::app::PlotExportManager::savePlot ( const std::string & filepath,
const std::string & plot_name,
const correlation::analysis::Histogram * hist,
correlation::plotters::PlotConfig config,
std::span< const PinnedRun > pinned_runs,
const std::map< std::string, real_t > & ashcroft_weights = {} )
staticnodiscard

Saves a plot synchronously to a destination filepath.

Parameters
[in]filepathTarget file path on disk (SVG or PDF).
[in]plot_nameName of the plot to save.
[in]histActive histogram pointer.
[in]configBase plot configuration.
[in]pinned_runsSpan of pinned runs for comparison exports.
[in]ashcroft_weightsMap of Ashcroft weights for S(Q) partials.
Returns
Expected void on success or error description string on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dialog_active_

std::atomic<bool> correlation::app::PlotExportManager::dialog_active_ {false}
private

◆ dialog_thread_

std::jthread correlation::app::PlotExportManager::dialog_thread_
private

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