| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/progress.h>
Public Member Functions | |
| Progress (const std::string &description, double totalValue, bool forceShow=false, bool allowChildProgress=true) | |
| ~Progress () | |
| std::string | description () const |
| double | totalValue () const |
| double | currentValue () const |
| double | percent () const |
| bool | isCanceled () const |
| double | timeElapsed () const |
| std::string | timeElapsedString () const |
| double | timeRemaining () const |
| std::string | timeRemainingString () const |
| bool | update (double complete, const std::string &newDescription=std::string()) |
| bool | finish () |
| void | cancel () |
| VRS::Progress::Progress | ( | const std::string & | description, | |
| double | totalValue, | |||
| bool | forceShow = false, |
|||
| bool | allowChildProgress = true | |||
| ) |
Constructs a new progress object with the given description. The totalValue specifies the value for which 100% of the tracked operation has been finished. If this value is less or equal to 0.0, the progress bar used for display shows a busy indicator instead of a percentage of the finished operation. The allowChildProgress-flag indicates whether the progress of progress objects created during the lifetime of this progress object should be tracked and displayed or not. NOTE: The progress objects cannot be dynamically created and destructed (using operators new and delete); they are managed on the stack via autmatic variables. Do not derive from this class, either, since the destructor is not virtual!
| VRS::Progress::~Progress | ( | ) |
| std::string VRS::Progress::description | ( | ) | const |
Returns the description for this progress object.
| double VRS::Progress::totalValue | ( | ) | const |
Returns the value for which 100% is assumed.
| double VRS::Progress::currentValue | ( | ) | const |
Returns the current value which is in the range [0.0, totalValue] or -1.0 if totalValue is less or equal to 0.0.
| double VRS::Progress::percent | ( | ) | const |
Returns the percentage of the work done in the range [0.0, 100.0] or -1.0 if totalValue is less or equal to 0.0.
| bool VRS::Progress::isCanceled | ( | ) | const |
Returns whether the operation that this progress objects tracks has been canceled.
| double VRS::Progress::timeElapsed | ( | ) | const |
Returns the number of seconds since the start (the construction) of this progress object.
| std::string VRS::Progress::timeElapsedString | ( | ) | const |
Returns the time elapsed time in a string (i.e., "0001:15:10") which can be used for display.
| double VRS::Progress::timeRemaining | ( | ) | const |
Returns the estimated number of seconds the tracked operation will probably take. NOTE: -1.0 is returned for the case of a too unprecise estimation.
| std::string VRS::Progress::timeRemainingString | ( | ) | const |
Returns the estimated time remaining for the tracked operation (i.e., "0001:15:10", "calc. ...", or "finished") which can be used for display.
| bool VRS::Progress::update | ( | double | complete, | |
| const std::string & | newDescription = std::string() | |||
| ) |
Changes the progress of the progress object to the given level of completeness. The completness will be clamped to the range [0.0, totalValue]. A registered progress bar object will be automatically informed of this update. If the totalValue specified during construction was less or equal to 0.0, the value of currentValue is ignored. The returned value indicates, if the operation should be continued (true) or canceled (false).
| bool VRS::Progress::finish | ( | ) |
Indicates that the operation in progess has been finished. It is a shortcut for: return (!isCanceled() && update(totalValue()));
| void VRS::Progress::cancel | ( | ) |
Signals that the tracked operation should be canceled.