|
BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Maintain information about progress of a computation. More...
Public Types | |
| using | callback_t = std::function< bool(size_t)> |
Public Member Functions | |
| ProgressHandler ()=default | |
| ProgressHandler (callback_t callback, size_t max_ticks_count) | |
| ProgressHandler (const ProgressHandler &other)=delete | |
| bool | has_interrupt_request () const |
| ProgressHandler & | operator= (const ProgressHandler &other)=delete |
| void | reset () |
| Resets progress. More... | |
| void | setCompletedTicks (size_t value) |
| Increment number of completed computation steps. More... | |
| void | setMaxTicksCount (size_t value) |
| Sets expected ticks count, representing progress of a computation. More... | |
| void | subscribe (callback_t callback) |
Private Attributes | |
| size_t | completed_ticks {0} |
| bool | interrupt_request {false} |
| size_t | max_ticks_count {0} |
| std::mutex | mutex |
| callback_t | runner_callback |
Maintain information about progress of a computation.
Initialized with callback function to report progress and retrieve interruption request status.
Definition at line 27 of file progresshandler.h.
| using ModelView::ProgressHandler::callback_t = std::function<bool(size_t)> |
Definition at line 29 of file progresshandler.h.
|
default |
| ProgressHandler::ProgressHandler | ( | ProgressHandler::callback_t | callback, |
| size_t | max_ticks_count | ||
| ) |
Definition at line 19 of file progresshandler.cpp.
|
delete |
| bool ProgressHandler::has_interrupt_request | ( | ) | const |
Definition at line 37 of file progresshandler.cpp.
References interrupt_request.
Referenced by gui2::SpecularToySimulation::runSimulation(), and TEST_F().
|
delete |
| void ProgressHandler::reset | ( | ) |
Resets progress.
Definition at line 57 of file progresshandler.cpp.
References completed_ticks, and interrupt_request.
Referenced by gui2::SpecularToySimulation::runSimulation(), setMaxTicksCount(), and TEST_F().
| void ProgressHandler::setCompletedTicks | ( | size_t | value | ) |
Increment number of completed computation steps.
Performs callback to inform subscriber about current progress (in percents) and retrieves interrupt request flag.
Definition at line 45 of file progresshandler.cpp.
References completed_ticks, interrupt_request, max_ticks_count, mutex, and runner_callback.
Referenced by gui2::SpecularToySimulation::runSimulation(), and TEST_F().
| void ProgressHandler::setMaxTicksCount | ( | size_t | value | ) |
Sets expected ticks count, representing progress of a computation.
Definition at line 31 of file progresshandler.cpp.
References max_ticks_count, and reset().
Referenced by gui2::SpecularToySimulation::setProgressCallback().
| void ProgressHandler::subscribe | ( | ProgressHandler::callback_t | callback | ) |
Definition at line 24 of file progresshandler.cpp.
References runner_callback.
Referenced by gui2::SpecularToySimulation::setProgressCallback().
|
private |
Definition at line 51 of file progresshandler.h.
Referenced by reset(), and setCompletedTicks().
|
private |
Definition at line 52 of file progresshandler.h.
Referenced by has_interrupt_request(), reset(), and setCompletedTicks().
|
private |
Definition at line 50 of file progresshandler.h.
Referenced by setCompletedTicks(), and setMaxTicksCount().
|
private |
Definition at line 48 of file progresshandler.h.
Referenced by setCompletedTicks().
|
private |
Definition at line 49 of file progresshandler.h.
Referenced by setCompletedTicks(), and subscribe().