CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
Efficient management of progress based on a total number of steps different than 100. More...
#include <GenericProgressCallback.h>
Public Member Functions | |
NormalizedProgress (GenericProgressCallback *callback, unsigned totalSteps, unsigned totalPercentage=100) | |
Default constructor. More... | |
virtual | ~NormalizedProgress () |
Destructor. | |
void | scale (unsigned totalSteps, unsigned totalPercentage=100, bool updateCurrentProgress=false) |
Scales inner parameters so that 'totalSteps' calls of the 'oneStep' method correspond to 'totalPercentage' percents. | |
void | reset () |
Resets progress state. | |
bool | oneStep () |
Increments total progress value of a single unit. | |
bool | steps (unsigned n) |
Increments total progress value of more than a single unit. | |
Protected Attributes | |
float | m_percent |
Total progress value (in percent) | |
unsigned | m_step |
Number of necessary calls to 'oneStep' to actually call progress callback. | |
float | m_percentAdd |
Percentage added to total progress value at each step. | |
AtomicCounter * | m_counter |
Current number of calls to 'oneStep' (thread safe) | |
GenericProgressCallback * | progressCallback |
associated GenericProgressCallback | |
Efficient management of progress based on a total number of steps different than 100.
DGM: can now be associated to a null 'callback' pointer to simplify the client code.
NormalizedProgress::NormalizedProgress | ( | GenericProgressCallback * | callback, |
unsigned | totalSteps, | ||
unsigned | totalPercentage = 100 |
||
) |
Default constructor.
callback | associated GenericProgressCallback instance (can be null) |
totalSteps | total number of steps (> 0) |
totalPercentage | equivalent percentage (> 0) |