![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/Progress.h>
Generic interface to report operation/computation progress. More...
Inheritance diagram for Progress:Generic interface to report operation/computation progress.
The Progress interface can host progress reports of multiple independent tasks, where each can represent either a regular progress bar with an individual number of steps, or a busy indicator that runs endlessly until stopped. Algorithms that want to provide progress/status information request their individual Task instance, store it locally as variable, and report their progress/status update through it. As soon as the instance goes out of scope the progress report is automatically removed form the parent reporter.
Basic usage example:
By default the Progress interface is not thread-safe and must only be accessed from the same thread it was created on. You can request a limited support for concurrent access for individual tasks through Task::requestThreadSafety().
Classes | |
| class | Task |
| Represents the progress/status report of an individual task hosted by a Progress. More... | |
Public Member Functions | |
| Task | addTask (int numSteps, const std::string &description) |
| Create a new progress report for an operation with the given number of steps. | |
| Task | addBusyIndicator (const std::string &description) |
| Create a busy indicator for an operation but does not have a predefined number of steps. | |
Protected Member Functions | |
| virtual void | onTaskAdded (Task *task)=0 |
| Function is called whenever a new Task has been created. | |
| virtual void | onTaskUpdated (const Task *task)=0 |
| Function is called whenever the state of a Task has changed and the reporter should update its UI. | |
| virtual bool | onTaskRequestsThreadSafety (const Task *task)=0 |
| Function is called by Task::requestThreadSafety() in order to check whether the parent reporter supports concurrent access. | |
| virtual void | onTaskRemoved (const Task *task)=0 |
| Function is called whenever a Task is about to be destroyed and its pointer will become invalid. | |
| Task addTask | ( | int | numSteps, |
| const std::string & | description ) |
Create a new progress report for an operation with the given number of steps.
Convenience function with the same effect as calling the Task(this, numSteps, description) constructor.
| Task addBusyIndicator | ( | const std::string & | description | ) |
Create a busy indicator for an operation but does not have a predefined number of steps.
Convenience function with the same effect as calling the Task(this, 0, description) constructor.
|
protectedpure virtual |
Function is called whenever a new Task has been created.
Implemented in NestedProgress, ProgressDialog, and SubProgress.
|
protectedpure virtual |
Function is called whenever the state of a Task has changed and the reporter should update its UI.
Implemented in ConeBeamReconLoader, NestedProgress, ProgressDialog, SubProgress, CalibrationProgress, and WatershedComputer.
|
protectedpure virtual |
Function is called by Task::requestThreadSafety() in order to check whether the parent reporter supports concurrent access.
Implementations are free to ignore this request and return false. Otherwise they must ensure that subsequent concurrent calls to any of the onTask...() callbacks are handled correctly without race conditions. Implementations are free to return to a unsynchronized implementation as soon as all multi-threaded tasks have been removed from the reporter.
Implemented in NestedProgress, ProgressDialog, and SubProgress.
|
protectedpure virtual |
Function is called whenever a Task is about to be destroyed and its pointer will become invalid.
Implemented in NestedProgress, ProgressDialog, and SubProgress.