Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 <nprogresstypes.h>

Inheritance diagram for regina::NProgressNumber:

regina::NProgress regina::ShareableObject regina::NMutex regina::boost::noncopyable 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.

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.

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.

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.

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.

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 [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:
Copyright © 1999-2004, Ben Burton
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).