![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Stores and updates current progress of computation in a location shared between the library and WL Kernel.
ProgressMonitor receives an instance of a shared Tensor<double> in constructor and becomes the (shared) owner. Progress is a single number of type double between 0. and 1. This class offers an interface for modifying the progress value (increase/decrease by a given step or set to an arbitrary value) and one static function for checking if a user requested to abort the computation in WL Kernel.
#include <ProgressMonitor.h>
Public Types | |
| using | SharedTensor = Tensor< double > |
| A type to represent a buffer shared between LLU and the Kernel which is used to report progress. More... | |
Public Member Functions | |
| ProgressMonitor (SharedTensor sharedIndicator, double step=defaultStep) | |
| Construct a new ProgressMonitor. More... | |
| ProgressMonitor (const ProgressMonitor &)=delete | |
| Copy-constructor is disabled because ProgressMonitor shares a Tensor with WL Kernel. More... | |
| ProgressMonitor & | operator= (const ProgressMonitor &)=delete |
| Copy-assignment is disabled because ProgressMonitor shares a Tensor with WL Kernel. More... | |
| ProgressMonitor (ProgressMonitor &&)=default | |
| Default move-constructor. More... | |
| ProgressMonitor & | operator= (ProgressMonitor &&)=default |
| Default move-assignment operator. More... | |
| ~ProgressMonitor ()=default | |
| Default destructor. More... | |
| double | get () const |
| Get current value of the progress. More... | |
| void | set (double progressValue) |
| Set current progress value. More... | |
| double | getStep () const |
| Get current step value. More... | |
| void | setStep (double stepValue) |
| Change step value to a given number. More... | |
| ProgressMonitor & | operator++ () |
Increment current progress value by step. More... | |
| ProgressMonitor & | operator+= (double progress) |
| Increment current progress value by a given number. More... | |
| ProgressMonitor & | operator-- () |
Decrement current progress value by step. More... | |
| ProgressMonitor & | operator-= (double progress) |
| Decrement current progress value by a given number. More... | |
Static Public Member Functions | |
| static void | checkAbort () |
| Check whether user requested to abort the computation in WL Kernel. More... | |
| static constexpr double | getDefaultStep () noexcept |
| Return default step for the ProgressMonitor. More... | |
| using LLU::ProgressMonitor::SharedTensor = Tensor<double> |
A type to represent a buffer shared between LLU and the Kernel which is used to report progress.
|
explicit |
Construct a new ProgressMonitor.
| sharedIndicator | - shared Tensor of type double. If tensor length is smaller than 1, the behavior is undefined. |
| step | - by how much to modify the progress value in operator++ and operator-- |
|
delete |
Copy-constructor is disabled because ProgressMonitor shares a Tensor with WL Kernel.
|
default |
Default move-constructor.
|
default |
Default destructor.
|
static |
Check whether user requested to abort the computation in WL Kernel.
| double LLU::ProgressMonitor::get | ( | ) | const |
Get current value of the progress.
double between 0. and 1.)
|
inlinestaticconstexprnoexcept |
Return default step for the ProgressMonitor.
| double LLU::ProgressMonitor::getStep | ( | ) | const |
Get current step value.
| ProgressMonitor & LLU::ProgressMonitor::operator++ | ( | ) |
Increment current progress value by step.
| ProgressMonitor & LLU::ProgressMonitor::operator+= | ( | double | progress | ) |
Increment current progress value by a given number.
| progress | - a real number between 0. and (1 - get()). No validation is done. |
| ProgressMonitor & LLU::ProgressMonitor::operator-- | ( | ) |
Decrement current progress value by step.
| ProgressMonitor & LLU::ProgressMonitor::operator-= | ( | double | progress | ) |
Decrement current progress value by a given number.
| progress | - a real number between 0. and get(). No validation is done. |
|
delete |
Copy-assignment is disabled because ProgressMonitor shares a Tensor with WL Kernel.
|
default |
Default move-assignment operator.
| void LLU::ProgressMonitor::set | ( | double | progressValue | ) |
Set current progress value.
| progressValue | - current progress (a double between 0. and 1.) |
| void LLU::ProgressMonitor::setStep | ( | double | stepValue | ) |
Change step value to a given number.
| stepValue | - any real number between 0. and 1. |