casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
casa::ThreadController Class Reference

#include <ThreadController.h>

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

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. More...
 
virtual ~ThreadController ()
 
virtual void setError (const casacore::String &errorMessage)
 
virtual void setStatus (const casacore::String &status)
 Allows the cache to set the status. More...
 
virtual void setProgress (unsigned int progress)
 Allows the cache to set the progress. More...
 
virtual void finished ()
 Thread signals it is done. More...
 
virtual void initializeProgress (const casacore::String &operationName)
 These signals are used to update the QtProgressWidget across different threads. More...
 
virtual void setProgress (unsigned int progress, const casacore::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. More...

 
virtual bool wasCanceled () const
 Callback for classes doing the work to check whether they should cancel what they are doing or not. More...
 
void setWorkThread (BackgroundThread *workThread)
 
virtual void background ()
 For when the user requests "background" for the thread. More...
 
virtual void pause ()
 For when the user requests "pause" for the thread. More...
 
virtual void resume ()
 For when the user requests "resume" for the thread. More...
 
virtual void cancel ()
 For when the user requests "cancel" for the thread. More...
 
virtual void postThreadMethod ()
 Executes the post-thread method as needed. More...
 
bool getResult () const
 Returns the result of the background operation. More...
 
casacore::String getError () const
 Returns any error from the background operation. More...
 
bool isErrorWarning () const
 
casacore::String getErrorTitle () const
 
PlotMSPlotgetPlot ()
 

Protected Member Functions

void startThread ()
 Starts the thread. More...
 
- Protected Member Functions inherited from casa::ThreadCommunication
 ThreadCommunication ()
 
virtual ~ThreadCommunication ()
 

Protected Attributes

volatile bool wasCanceled_
 Flag for whether thread was canceled or not. More...
 
casacore::String error
 Holds error messages. More...
 
casacore::String errorTitle
 
bool errorWarning
 
ProgressMonitoritsProgressWidget_
 Progress widget. More...
 
PMSPTMethoditsPostThreadMethod_
 Method/Object to run when thread is finished. More...
 
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.

casacore::String casa::ThreadController::getError ( ) const

Returns any error from the background operation.

casacore::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 casacore::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 casacore::String errorMessage)
virtual
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::setProgress ( unsigned int  progress,
const casacore::String status 
)
virtual

Implements casa::ThreadCommunication.

Reimplemented in casa::PlotMSThread.

virtual void casa::ThreadController::setStatus ( const casacore::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

BackgroundThread* casa::ThreadController::bgThread
private

Definition at line 142 of file ThreadController.h.

casacore::String casa::ThreadController::error
protected

Holds error messages.

Definition at line 122 of file ThreadController.h.

casacore::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.

PMSPTObject casa::ThreadController::itsPostThreadObject_
protected

Definition at line 134 of file ThreadController.h.

ProgressMonitor* casa::ThreadController::itsProgressWidget_
protected

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: