#include <ThreadController.h>
Public Member Functions | |
ThreadController (ProgressMonitor *progress, PMSPTMethod postThreadMethod=NULL, PMSPTObject postThreadObject=NULL) | |
Constructor which takes the progress widget to use, and an optional post-thread method that should be called when the thread is finished. | |
virtual | ~ThreadController () |
virtual void | setError (const String &errorMessage) |
virtual void | setStatus (const String &status) |
Allows the cache to set the status. | |
virtual void | setProgress (unsigned int progress) |
Allows the cache to set the progress. | |
virtual void | finished () |
Thread signals it is done. | |
virtual void | initializeProgress (const String &operationName) |
These signals are used to update the QtProgressWidget across different threads. | |
virtual void | setProgress (unsigned int progress, const String &status) |
virtual void | finishProgress () |
virtual void | setAllowedOperations (bool background, bool pauseResume, bool cancel) |
Work classes can specify whether they support background operation, pause/resume, and cancelling. | |
virtual bool | wasCanceled () const |
Callback for classes doing the work to check whether they should cancel what they are doing or not. | |
void | setWorkThread (BackgroundThread *workThread) |
virtual void | background () |
For when the user requests "background" for the thread. | |
virtual void | pause () |
For when the user requests "pause" for the thread. | |
virtual void | resume () |
For when the user requests "resume" for the thread. | |
virtual void | cancel () |
For when the user requests "cancel" for the thread. | |
virtual void | postThreadMethod () |
Executes the post-thread method as needed. | |
bool | getResult () const |
Returns the result of the background operation. | |
String | getError () const |
Returns any error from the background operation. | |
bool | isErrorWarning () const |
String | getErrorTitle () const |
PlotMSPlot * | getPlot () |
Protected Member Functions | |
void | startThread () |
Starts the thread. | |
Protected Attributes | |
volatile bool | wasCanceled_ |
Flag for whether thread was canceled or not. | |
String | error |
Holds error messages. | |
String | errorTitle |
bool | errorWarning |
ProgressMonitor * | itsProgressWidget_ |
Progress widget. | |
PMSPTMethod * | itsPostThreadMethod_ |
Method/Object to run when thread is finished. | |
PMSPTObject | itsPostThreadObject_ |
Private Member Functions | |
ThreadController (const ThreadController &controller) | |
ThreadController | operator= (const ThreadController &other) |
Private Attributes | |
BackgroundThread * | bgThread |
Definition at line 44 of file ThreadController.h.
casa::ThreadController::ThreadController | ( | ProgressMonitor * | progress, | |
PMSPTMethod | postThreadMethod = NULL , |
|||
PMSPTObject | postThreadObject = NULL | |||
) |
Constructor which takes the progress widget to use, and an optional post-thread method that should be called when the thread is finished.
virtual casa::ThreadController::~ThreadController | ( | ) | [virtual] |
casa::ThreadController::ThreadController | ( | const ThreadController & | controller | ) | [private] |
virtual void casa::ThreadController::background | ( | ) | [virtual] |
For when the user requests "background" for the thread.
virtual void casa::ThreadController::cancel | ( | ) | [virtual] |
For when the user requests "cancel" for the thread.
Reimplemented in casa::PlotMSDrawThread, and casa::PlotMSExportThread.
virtual void casa::ThreadController::finished | ( | ) | [virtual] |
Thread signals it is done.
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSThread.
virtual void casa::ThreadController::finishProgress | ( | ) | [virtual] |
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSThread.
String casa::ThreadController::getError | ( | ) | const |
Returns any error from the background operation.
String casa::ThreadController::getErrorTitle | ( | ) | const |
PlotMSPlot* casa::ThreadController::getPlot | ( | ) |
bool casa::ThreadController::getResult | ( | ) | const |
Returns the result of the background operation.
virtual void casa::ThreadController::initializeProgress | ( | const String & | operationName | ) | [virtual] |
These signals are used to update the QtProgressWidget across different threads.
They shouldn't need to be used by other classes, even children.
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSThread.
bool casa::ThreadController::isErrorWarning | ( | ) | const |
ThreadController casa::ThreadController::operator= | ( | const ThreadController & | other | ) | [private] |
Reimplemented in casa::PlotMSCacheThread, casa::PlotMSDrawThread, and casa::PlotMSExportThread.
virtual void casa::ThreadController::pause | ( | ) | [virtual] |
For when the user requests "pause" for the thread.
virtual void casa::ThreadController::postThreadMethod | ( | ) | [virtual] |
Executes the post-thread method as needed.
Does nothing if a post-thread method was not set in the constructor.
virtual void casa::ThreadController::resume | ( | ) | [virtual] |
For when the user requests "resume" for the thread.
virtual void casa::ThreadController::setAllowedOperations | ( | bool | background, | |
bool | pauseResume, | |||
bool | cancel | |||
) | [virtual] |
Work classes can specify whether they support background operation, pause/resume, and cancelling.
Implements casa::ThreadCommunication.
virtual void casa::ThreadController::setError | ( | const String & | errorMessage | ) | [virtual] |
Implements casa::ThreadCommunication.
virtual void casa::ThreadController::setProgress | ( | unsigned int | progress, | |
const String & | status | |||
) | [virtual] |
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSThread.
virtual void casa::ThreadController::setProgress | ( | unsigned int | progress | ) | [virtual] |
Allows the cache to set the progress.
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSCacheThread.
virtual void casa::ThreadController::setStatus | ( | const String & | status | ) | [virtual] |
Allows the cache to set the status.
Implements casa::ThreadCommunication.
Reimplemented in casa::PlotMSCacheThread.
void casa::ThreadController::setWorkThread | ( | BackgroundThread * | workThread | ) |
void casa::ThreadController::startThread | ( | ) | [protected] |
Starts the thread.
virtual bool casa::ThreadController::wasCanceled | ( | ) | const [virtual] |
Callback for classes doing the work to check whether they should cancel what they are doing or not.
Implements casa::ThreadCommunication.
BackgroundThread* casa::ThreadController::bgThread [private] |
Definition at line 142 of file ThreadController.h.
String casa::ThreadController::error [protected] |
Holds error messages.
Definition at line 122 of file ThreadController.h.
String casa::ThreadController::errorTitle [protected] |
Definition at line 123 of file ThreadController.h.
bool casa::ThreadController::errorWarning [protected] |
Definition at line 124 of file ThreadController.h.
PMSPTMethod* casa::ThreadController::itsPostThreadMethod_ [protected] |
Method/Object to run when thread is finished.
Definition at line 133 of file ThreadController.h.
Definition at line 134 of file ThreadController.h.
Progress widget.
Definition at line 129 of file ThreadController.h.
volatile bool casa::ThreadController::wasCanceled_ [protected] |
Flag for whether thread was canceled or not.
Definition at line 119 of file ThreadController.h.