Regina Calculation Engine
Public Member Functions | List of all members
regina::NProgressManager Class Reference

Manages the sharing of an NProgress object between reading and writing threads. More...

#include <progress/nprogressmanager.h>

Inheritance diagram for regina::NProgressManager:
regina::ShareableObject regina::boost::noncopyable

Public Member Functions

 NProgressManager ()
 Creates a new progress manager with no NProgress to manage. More...
 
 ~NProgressManager ()
 Destroys this manager as well as the corresponding NProgress. More...
 
bool isStarted () const
 Determines if an NProgress has been assigned to this manager yet. More...
 
bool isFinished () const
 Determines if the NProgress that we are managing has finished. More...
 
const NProgressgetProgress () const
 Returns the NProgress that this manager is managing. More...
 
void setProgress (NProgress *newProgress)
 Assigns the given NProgress to this manager to manage. 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 toString () const
 Returns the output from writeTextShort() as a string. More...
 
std::string toStringLong () const
 Returns the output from writeTextLong() as a string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from regina::boost::noncopyable
 noncopyable ()
 A constructor which does nothing. More...
 
 ~noncopyable ()
 A destructor which does nothing. More...
 

Detailed Description

Manages the sharing of an NProgress object between reading and writing threads.

The life cycle of an NProgressManager and the corresponding NProgress is as follows. Note that the reading thread is the interface thread that is querying the state of progress, and the writing thread is the thread in which the operation is actually being performed.

Constructor & Destructor Documentation

regina::NProgressManager::NProgressManager ( )
inline

Creates a new progress manager with no NProgress to manage.

regina::NProgressManager::~NProgressManager ( )
inline

Destroys this manager as well as the corresponding NProgress.

Precondition
There is an NProgress assigned to this manager; that is, isStarted() returns true.
The NProgress that we are managing has finished, that is, isFinished() returns true.

Member Function Documentation

const NProgress * regina::NProgressManager::getProgress ( ) const
inline

Returns the NProgress that this manager is managing.

If isStarted() returns true, you are guaranteed that this routine will not return zero.

Returns
the NProgress that this manager is managing, or 0 if an NProgress has not yet been assigned to this manager.
bool regina::NProgressManager::isFinished ( ) const
inline

Determines if the NProgress that we are managing has finished.

That is, this routine determines if NProgress::isFinished() returns true.

Once this routine returns true, it will always return true; thus there will be no need to call it again.

Precondition
There is an NProgress assigned to this manager; that is, isStarted() returns true.
Returns
true if and only if the NProgress that we are managing has finished.
bool regina::NProgressManager::isStarted ( ) const
inline

Determines if an NProgress has been assigned to this manager yet.

Once this routine returns true, it will always return true; thus there will be no need to call it again.

Returns
true if and only if an NProgress has been assigned to this manager.
void regina::NProgressManager::setProgress ( NProgress newProgress)
inline

Assigns the given NProgress to this manager to manage.

Precondition
setProgress() has not already been called.
Python:
Not present; this routine should only be called from within calculation engine routines whose progress is being watched.
Parameters
newProgressthe NProgress that this manager will manage.
void regina::NProgressManager::writeTextShort ( std::ostream &  out) const
inlinevirtual

Writes this object in short text format to the given output stream.

The output should fit on a single line and no newline should be written.

Python:
The parameter out does not exist; standard output will be used.
Parameters
outthe output stream to which to write.

Implements regina::ShareableObject.


The documentation for this class was generated from the following file:

Copyright © 1999-2012, The Regina development team
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).