|
Developer Documentation
|
#include <ACG/Utils/Progress.hh>
Classes | |
| class | ChildRecord |
Public Member Functions | |
| Progress (double maxProgress=1.0) | |
| void | setMaxProgress (double value) |
| double | getNormalizedProgress () const |
| double | getProgress () const |
| void | addSubProgress (Progress *progress, double contribution) |
| void | increment (double amount) |
Protected Member Functions | |
| void | onChildProgress (Progress *) |
| void | progressChanged () |
| void | updateDialog () |
| void | childGoesBye (Progress *child) |
Protected Attributes | |
| Progress * | parent |
| std::set< ChildRecord > | children |
| double | maxProgress |
| double | currentProgress |
| union { | |
| void * dialog_padding | |
| }; | |
Private Member Functions | |
| Progress (const Progress &rhs) | |
| Progress & | operator= (const Progress &rhs) |
Keep track of the progress of tasks and subtasks.
Not thread safe. Could easily be made thread safe, though. See "Thread safety" comments in the source code.
Usage Example:
Progress p1(5.0);
p1.increment(1.0);
assert(p1.getNormalizedProgress() == 0.2);
p1.increment(4.0);
assert(p1.getNormalizedProgress() == 1.0);
Progress p2(10.0);
{
Progress p2_1(10.0);
p2.addSubProgress(&p2_1, 5.0);
assert(p2.getNormalizedProgress() == 0.0);
p2_1.increment(5.0);
assert(p2_1.getNormalizedProgress() == 0.5);
assert(p2.getNormalizedProgress() == 0.25);
}
// When the sub progress gets destroyed, the parent
// assumes it is completed.
assert(p2.getNormalizedProgress() == 0.5);
Definition at line 90 of file Progress.hh.
|
inline |
Does NOT take ownership of the supplied Progress object.
Definition at line 134 of file Progress.hh.
|
inline |
Definition at line 114 of file Progress.hh.