casa
$Rev:20696$
|
Simple object to synchronize operation progress information across threads. More...
#include <PlotOperation.h>
Public Member Functions | |
PlotOperation (const String &name, PlotMutexPtr mutex) | |
Constructor which takes the operation name and a synchronization mutex. | |
~PlotOperation () | |
Destructor. | |
String | name () const |
Accessors (synchronized). | |
bool | inProgress () const |
bool | isFinished () const |
unsigned int | currentProgress () const |
String | currentStatus () const |
bool | cancelRequested () const |
void | setInProgress (bool inProgress) |
Mutators (synchronized). | |
void | setIsFinished (bool isFinished) |
void | setCurrentProgress (unsigned int currentProgress) |
void | setCurrentStatus (const String ¤tStatus) |
void | setCancelRequested (bool cancel) |
void | setMutex (PlotMutexPtr mutex) |
Sets the operation's mutex to the given. | |
void | addWatcher (PlotOperationWatcher *watcher) |
Adds the given watcher for this object. | |
void | removeWatcher (PlotOperationWatcher *watcher) |
Removes the given watcher for this object. | |
void | reset () |
Resets the in progress, is finished, current progress, and current status members. | |
void | finish () |
Updates in progress, is finished, current progress, and current status members to reflect a "finished" state. | |
Private Member Functions | |
void | notifyWatchers () const |
Notifies any registered watchers that the operation has changed. | |
Private Attributes | |
String | m_name |
Name. | |
bool | m_inProgress |
Flags. | |
bool | m_isFinished |
unsigned int | m_currentProgress |
Current progress (0 - 100)%. | |
String | m_currentStatus |
Current status message. | |
bool | m_cancelRequested |
Cancel requested flag. | |
PlotMutexPtr | m_mutex |
Synchronization mutex. | |
vector< PlotOperationWatcher * > | m_watchers |
Watchers. |
Simple object to synchronize operation progress information across threads.
Definition at line 71 of file PlotOperation.h.
casa::PlotOperation::PlotOperation | ( | const String & | name, |
PlotMutexPtr | mutex | ||
) |
Constructor which takes the operation name and a synchronization mutex.
Destructor.
void casa::PlotOperation::addWatcher | ( | PlotOperationWatcher * | watcher | ) |
Adds the given watcher for this object.
bool casa::PlotOperation::cancelRequested | ( | ) | const |
unsigned int casa::PlotOperation::currentProgress | ( | ) | const |
String casa::PlotOperation::currentStatus | ( | ) | const |
void casa::PlotOperation::finish | ( | ) |
Updates in progress, is finished, current progress, and current status members to reflect a "finished" state.
Will notify registered watchers of a change.
bool casa::PlotOperation::inProgress | ( | ) | const |
bool casa::PlotOperation::isFinished | ( | ) | const |
String casa::PlotOperation::name | ( | ) | const |
Accessors (synchronized).
void casa::PlotOperation::notifyWatchers | ( | ) | const [private] |
Notifies any registered watchers that the operation has changed.
void casa::PlotOperation::removeWatcher | ( | PlotOperationWatcher * | watcher | ) |
Removes the given watcher for this object.
void casa::PlotOperation::reset | ( | ) |
Resets the in progress, is finished, current progress, and current status members.
Will notify registered watchers of a change.
void casa::PlotOperation::setCancelRequested | ( | bool | cancel | ) |
void casa::PlotOperation::setCurrentProgress | ( | unsigned int | currentProgress | ) |
void casa::PlotOperation::setCurrentStatus | ( | const String & | currentStatus | ) |
void casa::PlotOperation::setInProgress | ( | bool | inProgress | ) |
Mutators (synchronized).
Any mutator will notify registered watchers of a change.
void casa::PlotOperation::setIsFinished | ( | bool | isFinished | ) |
void casa::PlotOperation::setMutex | ( | PlotMutexPtr | mutex | ) |
Sets the operation's mutex to the given.
bool casa::PlotOperation::m_cancelRequested [private] |
Cancel requested flag.
Definition at line 132 of file PlotOperation.h.
unsigned int casa::PlotOperation::m_currentProgress [private] |
Current progress (0 - 100)%.
Definition at line 126 of file PlotOperation.h.
String casa::PlotOperation::m_currentStatus [private] |
Current status message.
Definition at line 129 of file PlotOperation.h.
bool casa::PlotOperation::m_inProgress [private] |
Flags.
Definition at line 123 of file PlotOperation.h.
bool casa::PlotOperation::m_isFinished [private] |
Definition at line 123 of file PlotOperation.h.
PlotMutexPtr casa::PlotOperation::m_mutex [private] |
Synchronization mutex.
Definition at line 135 of file PlotOperation.h.
String casa::PlotOperation::m_name [private] |
Name.
Definition at line 120 of file PlotOperation.h.
vector<PlotOperationWatcher*> casa::PlotOperation::m_watchers [private] |
Watchers.
Definition at line 138 of file PlotOperation.h.