casa::ThreadController Class Reference

#include <ThreadController.h>

Inheritance diagram for casa::ThreadController:
casa::ThreadCommunication casa::PlotMSThread casa::PlotMSCacheThread casa::PlotMSDrawThread casa::PlotMSExportThread

List of all members.

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
PlotMSPlotgetPlot ()

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
ProgressMonitoritsProgressWidget_
 Progress widget.
PMSPTMethoditsPostThreadMethod_
 Method/Object to run when thread is finished.
PMSPTObject itsPostThreadObject_

Private Member Functions

 ThreadController (const ThreadController &controller)
ThreadController operator= (const ThreadController &other)

Private Attributes

BackgroundThreadbgThread

Detailed Description

Definition at line 44 of file ThreadController.h.


Constructor & Destructor Documentation

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]

Member Function Documentation

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


Member Data Documentation

Definition at line 142 of file ThreadController.h.

String casa::ThreadController::error [protected]

Holds error messages.

Definition at line 122 of file ThreadController.h.

Definition at line 123 of file ThreadController.h.

Definition at line 124 of file ThreadController.h.

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1