BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ProgressHandler Class Reference

Maintains information about progress of a computation. More...

Public Types

typedef std::function< bool(size_t)> Callback_t
 

Public Member Functions

 ProgressHandler (const ProgressHandler &other)
 
void subscribe (ProgressHandler::Callback_t callback)
 
void reset ()
 
void setExpectedNTicks (size_t n)
 
void incrementDone (size_t ticks_done)
 Increments number of completed computation steps (ticks). More...
 
bool alive ()
 

Detailed Description

Maintains information about progress of a computation.

Owner is the computation, which periodically calls the thread-safe function incrementDone(..). An application (GUI or script) may subscribe(..) to be informed about progress. It is then periodically called back by inform(..). The return value of inform(..) can be used to request termination of the computation.

Definition at line 30 of file ProgressHandler.h.

Member Function Documentation

◆ incrementDone()

void ProgressHandler::incrementDone ( size_t  ticks_done)

Increments number of completed computation steps (ticks).

Performs callback (method m_inform) to inform the subscriber about the state of the computation and to obtain as return value a flag that indicates whether to continue the computation.

Definition at line 31 of file ProgressHandler.cpp.


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