FERS 1.0.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)>
 

Public Member Functions

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

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 37 of file sim_threading.h.

Member Typedef Documentation

◆ Callback

using core::ProgressReporter::Callback = std::function<void(const std::string&, int, int)>

Definition at line 40 of file sim_threading.h.

Constructor & Destructor Documentation

◆ ProgressReporter()

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

Definition at line 42 of file sim_threading.h.

42: _callback(std::move(cb)) {}

Member Function Documentation

◆ report()

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

Definition at line 44 of file sim_threading.h.

45 {
46 if (_callback)
47 {
48 std::lock_guard<std::mutex> lock(_mutex);
49 _callback(msg, current, total);
50 }
51 }

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