regina::NProgressNumber Class Reference
Progress Management

A progress report in which the current state of progress is stored as a number of items completed. More...

`#include <progress/nprogresstypes.h>`

Inheritance diagram for regina::NProgressNumber:

## Public Member Functions

| NProgressNumber (long newCompleted=0, long newOutOf=-1)
| Creates a new progress report containing the given details. More...
long | getCompleted () const
| Returns the number of items completed. More...
long | getOutOf () const
| Returns the expected total number of items. More...
NProgressStateNumeric | getNumericState () const
| Returns both the number of items completed and the expected total number of items. More...
void | setCompleted (long newCompleted)
| Sets the number of items completed. More...
void | incCompleted (unsigned long extraCompleted=1)
| Increases the number of items completed by the given amount. More...
void | setOutOf (long newOutOf)
| Sets the expected total number of items. More...
virtual bool | isPercent () const
| Determines if the state of progress can be expressed as a percentage. More...
Public Member Functions inherited from regina::NProgress
| NProgress ()
| Performs basic initialisation. More...
virtual | ~NProgress ()
| Destroys this object. More...
bool | hasChanged () const
| Determines if the state of progress has changed since the last query. More...
bool | isFinished () const
| Is the operation whose progress we are reporting completely finished? More...
void | setFinished ()
| Signifies that the operation whose progress we are reporting is completely finished. More...
void | cancel () const
| Called by an external interface to request that the operation whose progress we are reporting be cancelled. More...
bool | isCancelled () const
| Determines whether an external interface has requested that the operation whose progress we are reporting be cancelled. More...
std::string | getDescription () const
| Returns a string description of the current state of progress. More...
double | getPercent () const
| Returns the current state of progress as a percentage. More...
long | getRealTime () const
| Returns the real time elapsed since this operation began. More...
long | totalCPUTime () const
| Returns the total CPU time consumed by the program from the beginning to the end of this operation. More...
void | writeTextShort (std::ostream &out) const
| Writes this object in short text format to the given output stream. More...
Public Member Functions inherited from regina::ShareableObject
| ShareableObject ()
| Default constructor that does nothing. More...
virtual | ~ShareableObject ()
| Default destructor that does nothing. More...
virtual void | writeTextLong (std::ostream &out) const
| Writes this object in long text format to the given output stream. More...
std::string | str () const
| Returns the output from writeTextShort() as a string. More...
std::string | toString () const
| A deprecated alias for str(), which returns the output from writeTextShort() as a string. More...
std::string | detail () const
| Returns the output from writeTextLong() as a string. More...
std::string | toStringLong () const
| A deprecated alias for detail(), which returns the output from writeTextLong() as a string. More...

## Protected Member Functions

virtual std::string | internalGetDescription () const
| Returns a string description of the current state of progress. More...
virtual double | internalGetPercent () const
| Returns the current state of progress as a percentage. More...
Protected Member Functions inherited from regina::boost::noncopyable
| noncopyable ()
| A constructor which does nothing. More...
| ~noncopyable ()
| A destructor which does nothing. More...
Protected Member Functions inherited from regina::NMutex
| NMutex ()
| Creates a new mutex. More...
| ~NMutex ()
| Destroys this mutex. More...

## Additional Inherited Members

Protected Attributes inherited from regina::NProgress
bool | changed
| Has the state of progress changed since the last query? More...
bool | cancelled
| Has this operation been cancelled? More...

## 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.

Deprecated:
  This class is deprecated. Please use the more flexible and more streamlined NProgressTracker class instead.

## 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.

NProgressStateNumeric regina::NProgressNumber::getNumericState | ( |  | ) | const

inline

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

protected virtual

Returns a string description of the current state of progress.

This function must not touch the mutex, and is not required to alter the changed flag. The getDescription() routine takes care of all of these issues.

Precondition
  The mutex is currently locked.

Returns
  the current state of progress.

Implements regina::NProgress.

double regina::NProgressNumber::internalGetPercent | ( |  | ) | const

inline protected virtual

Returns the current state of progress as a percentage.

The default implementation returns 0.

This function must not touch the mutex, and is not required to alter the changed flag. The getDescription() routine takes care of all of these issues.

Precondition
  Progress can be expressed as a percentage (see isPercent()).
  The mutex is currently locked.

Returns
  the current state of progress as a percentage.

Reimplemented from regina::NProgress.

bool regina::NProgressNumber::isPercent | ( |  | ) | const

inline virtual

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:

- progress/nprogresstypes.h

Copyright © 1999-2013, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).