OEDots

class OEDots

Provides a simple progress bar interface for command line applications. Dots, ., characters are printed to OEPlatform_oeerr to indicate to the user of the command line application that progress is indeed being made and the program is not hung indefinitely.

See also

A version of this class that is safe to used from multiple threads of computation: OEThreadedDots.

Constructors

OEDots(unsigned int bigstep, unsigned int smallstep,
       const char *objectname="", char *action = "processed")

Controls how the following output gets updated:

.......... 10000 things processed.
.......... 20000 things processed.
.......... 30000 things processed.
.......... 40000 things processed.
.......... 50000 things processed.
.......... 60000 things processed.
.......... 70000 things processed.
.......... 80000 things processed.
bigstep

The number of elements before a new line is generated. The above example is a bigstep of 10000.

smallstep

The number of elements before a single new dot, ., is printed. The above example is a smallstep of 1000. Or 10 dots per line.

objectname

A description of what is being processed. In the above example, this is “things”.

action

A description of what is done to the ‘objects’. In the above example, this is “processed”.

GetBigStep

unsigned int GetBigStep()

Returns the bigstep size used to construct this instance.

GetCounts

unsigned int GetCounts()

Returns the current number of elements counted by this instance.

GetSmallStep

unsigned int GetSmallStep()

Returns the smallstep size used to construct this instance.

SetBigStep

void SetBigStep(unsigned int s)

Sets a new bigstep size for this instance.

SetSmallStep

void SetSmallStep(unsigned int s)

Sets a new smallstep size for this instance.

Total

void Total()

Prints a final summary line like the following:

Total: 80000 things processed.

Typically only run once at the end of all processing.

Update

void Update(unsigned int step=1)
void Update(const char symbol, unsigned int step = 1)

Update the progress with the number of elements specified by step. The default is 1 element, but any number can be specified. However, 0 is not a valid step size and will throw an error. The second overload allows to specify a symbol to be displayed as progress, instead of a dot.

Note

Not thread-safe, see OEThreadedDots if this method needs to be called from multiple threads.

See also