Geogram
Version 1.9.1
A programming library of geometric algorithms
|
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 ProgressTask * | current_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. | |
Framework for tracking the progression of a task.
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.
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.
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.
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).
true | if the task was canceled with cancel() |
false | otherwise |
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.
[in] | client | a pointer to a ProgressClient |
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()
.