FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
core::ProgressReporter Class Reference

A thread-safe wrapper for the simulation progress callback. More...

#include "sim_threading.h"

Public Types

using Callback = std::function< void(const std::string &, int, int)>
 Defines the signature for the progress reporting callback function.
 

Public Member Functions

 ProgressReporter (Callback cb)
 Constructs a ProgressReporter with the given callback.
 
void report (const std::string &msg, int current, int total)
 Safely reports progress to the underlying callback.
 

Detailed Description

A thread-safe wrapper for the simulation progress callback.

Allows multiple worker threads to report progress concurrently without race conditions.

Definition at line 67 of file sim_threading.h.

Member Typedef Documentation

◆ Callback

Defines the signature for the progress reporting callback function.

Definition at line 74 of file sim_threading.h.

Constructor & Destructor Documentation

◆ ProgressReporter()

core::ProgressReporter::ProgressReporter ( Callback  cb)
explicit

Constructs a ProgressReporter with the given callback.

Parameters
cbThe callback function to wrap.

Definition at line 80 of file sim_threading.h.

80: _callback(std::move(cb)) {}
math::Vec3 max

Member Function Documentation

◆ report()

void core::ProgressReporter::report ( const std::string &  msg,
int  current,
int  total 
)

Safely reports progress to the underlying callback.

Parameters
msgThe status message to report.
currentThe current progress value.
totalThe total progress value.

Definition at line 88 of file sim_threading.h.

89 {
90 if (_callback)
91 {
92 std::scoped_lock const lock(_mutex);
93 _callback(msg, current, total);
94 }
95 }

References max.


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