CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Member Functions | Protected Attributes | List of all members
CCCoreLib::NormalizedProgress Class Reference

Efficient management of progress based on a total number of steps different than 100. More...

#include <GenericProgressCallback.h>

Collaboration diagram for CCCoreLib::NormalizedProgress:
Collaboration graph
[legend]

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)
 
GenericProgressCallbackprogressCallback
 associated GenericProgressCallback
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ NormalizedProgress()

NormalizedProgress::NormalizedProgress ( GenericProgressCallback callback,
unsigned  totalSteps,
unsigned  totalPercentage = 100 
)

Default constructor.

Parameters
callbackassociated GenericProgressCallback instance (can be null)
totalStepstotal number of steps (> 0)
totalPercentageequivalent percentage (> 0)

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