Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::Progress Namespace Reference

Framework for tracking the progression of a task. More...

Functions

void initialize ()
 Initializes the Progress framework. More...
 
void terminate ()
 Cleans up the Progress framework. More...
 
void set_client (ProgressClient *client)
 Sets the Progress client. More...
 
const ProgressTaskcurrent_progress_task ()
 Gets the current task. More...
 
void cancel ()
 Cancels the current task. More...
 
bool is_canceled ()
 Checks if the current task is canceled. More...
 
void clear_canceled ()
 Clears the cancellation flag.
 

Detailed Description

Framework for tracking the progression of a task.

Function Documentation

◆ cancel()

void GEO::Progress::cancel ( )

Cancels the current task.

This sets a cancellation flag to true. This makes the next call to ProgressTask::progress() throw an exception TaskCanceled. It is the responsibility of the client code to catch this exception and do appropriate cleanup. The cancellation flag can be tested with is_canceled() before ProgressTask::progress() is being called by the current task.

See also
is_canceled()
TaskCanceled

◆ current_progress_task()

const ProgressTask* GEO::Progress::current_progress_task ( )

Gets the current task.

The current task is the last ProgressTask being created, which corresponds to the top-most ProgressTask in the execution call stack.

Returns
a pointer the current ProgressTask if any or a null pointer if there's no current task.

◆ initialize()

void GEO::Progress::initialize ( )

Initializes the Progress framework.

This function must be called once at program startup to create the unique instance of the Progress class and set a default LoggerClient that logs progress to the console.

Note
This function is called by the Vorpaline initialization function.
See also
GEO::initialize()
CmdLine

◆ is_canceled()

bool GEO::Progress::is_canceled ( )

Checks if the current task is canceled.

This returns true if a request was made to cancel the task (e.g., from the user interface).

Return values
trueif the task was canceled with cancel()
falseotherwise

◆ set_client()

void GEO::Progress::set_client ( ProgressClient client)

Sets the Progress client.

Sets the Progress client to client. The Progress instance takes ownership of the client so there's no need to delete it when the Progress terminates.

Parameters
[in]clienta pointer to a ProgressClient

◆ terminate()

void GEO::Progress::terminate ( )

Cleans up the Progress framework.

This function must be called when the program exits to cleanup the framework. It is called by the Vorpaline cleanup function GEO::terminate().