A progress report in which the current state of progress is stored as a number of items completed.
More...
#include <progress/nprogresstypes.h>
List of all members.
Public Member Functions |
| NProgressNumber (long newCompleted=0, long newOutOf=-1) |
| Creates a new progress report containing the given details.
|
long | getCompleted () const |
| Returns the number of items completed.
|
long | getOutOf () const |
| Returns the expected total number of items.
|
NProgressStateNumeric | getNumericState () const |
| Returns both the number of items completed and the expected total number of items.
|
void | setCompleted (long newCompleted) |
| Sets the number of items completed.
|
void | incCompleted (unsigned long extraCompleted=1) |
| Increases the number of items completed by the given amount.
|
void | setOutOf (long newOutOf) |
| Sets the expected total number of items.
|
virtual bool | isPercent () const |
| Determines if the state of progress can be expressed as a percentage.
|
| NProgress () |
| Performs basic initialisation.
|
virtual | ~NProgress () |
| Destroys this object.
|
bool | hasChanged () const |
| Determines if the state of progress has changed since the last query.
|
bool | isFinished () const |
| Is the operation whose progress we are reporting completely finished?
|
void | setFinished () |
| Signifies that the operation whose progress we are reporting is completely finished.
|
void | cancel () const |
| Called by an external interface to request that the operation whose progress we are reporting be cancelled.
|
bool | isCancelled () const |
| Determines whether an external interface has requested that the operation whose progress we are reporting be cancelled.
|
std::string | getDescription () const |
| Returns a string description of the current state of progress.
|
double | getPercent () const |
| Returns the current state of progress as a percentage.
|
long | getRealTime () const |
| Returns the real time elapsed since this operation began.
|
long | totalCPUTime () const |
| Returns the total CPU time consumed by the program from the beginning to the end of this operation.
|
void | writeTextShort (std::ostream &out) const |
| Writes this object in short text format to the given output stream.
|
| ShareableObject () |
| Default constructor that does nothing.
|
virtual | ~ShareableObject () |
| Default destructor that does nothing.
|
virtual void | writeTextLong (std::ostream &out) const |
| Writes this object in long text format to the given output stream.
|
std::string | toString () const |
| Returns the output from writeTextShort() as a string.
|
std::string | toStringLong () const |
| Returns the output from writeTextLong() as a string.
|
Protected Member Functions |
virtual std::string | internalGetDescription () const |
| Returns a string description of the current state of progress.
|
virtual double | internalGetPercent () const |
| Returns the current state of progress as a percentage.
|
Additional Inherited Members |
bool | changed |
| Has the state of progress changed since the last query?
|
Detailed Description
A progress report in which the current state of progress is stored as a number of items completed.
The expected total number of items can be optionally specified.
- Python:
- Not present; all progress classes communicate with external interfaces through the NProgress interface.
Constructor & Destructor Documentation
regina::NProgressNumber::NProgressNumber |
( |
long |
newCompleted = 0 , |
|
|
long |
newOutOf = -1 |
|
) |
| |
|
inline |
Creates a new progress report containing the given details.
Note that the internal mutex is not locked during construction.
- Precondition:
- The new number of items completed is non-negative.
-
If the new expected total is non-negative, then the new number of items completed is at most the new expected total.
- Parameters:
-
newCompleted | the number of items completed; this defaults to 0. |
newOutOf | the expected total number of items, or -1 if this total is not known (the default). |
Member Function Documentation
long regina::NProgressNumber::getCompleted |
( |
| ) |
const |
|
inline |
Returns the number of items completed.
- Returns:
- the number of items completed.
Returns both the number of items completed and the expected total number of items.
- Returns:
- the current state of progress.
long regina::NProgressNumber::getOutOf |
( |
| ) |
const |
|
inline |
Returns the expected total number of items.
- Returns:
- the expected total number of items, or -1 if this total is not known.
void regina::NProgressNumber::incCompleted |
( |
unsigned long |
extraCompleted = 1 | ) |
|
|
inline |
Increases the number of items completed by the given amount.
- Precondition:
- If the expected total is non-negative, then the new total number of items completed is at most the expected total.
- Parameters:
-
extraCompleted | the number of items to add to the number of items already completed. |
virtual std::string regina::NProgressNumber::internalGetDescription |
( |
| ) |
const |
|
protectedvirtual |
Returns a string description of the current state of progress.
- Returns:
- the current state of progress.
Implements regina::NProgress.
double regina::NProgressNumber::internalGetPercent |
( |
| ) |
const |
|
inlineprotectedvirtual |
Returns the current state of progress as a percentage.
The default implementation returns 0.
- Precondition:
- Progress can be expressed as a percentage (see isPercent()).
- Returns:
- the current state of progress as a percentage.
Reimplemented from regina::NProgress.
bool regina::NProgressNumber::isPercent |
( |
| ) |
const |
|
inlinevirtual |
Determines if the state of progress can be expressed as a percentage.
The default implementation returns false
.
- Returns:
true
if and only if progress can be expressed as a percentage.
Reimplemented from regina::NProgress.
void regina::NProgressNumber::setCompleted |
( |
long |
newCompleted | ) |
|
|
inline |
Sets the number of items completed.
- Precondition:
- The new number of items completed is non-negative.
-
If the expected total is non-negative, then the new number of items completed is at most the expected total.
- Parameters:
-
newCompleted | the number of items completed. |
void regina::NProgressNumber::setOutOf |
( |
long |
newOutOf | ) |
|
|
inline |
Sets the expected total number of items.
- Precondition:
- If the new expected total is non-negative, then the new expected total is at least the number of items completed.
- Parameters:
-
newOutOf | the expected total number of items, or -1 if this total is not known. |
The documentation for this class was generated from the following file: