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

Abstract class to control a threaded operation from the GUI. More...

#include <PlotMSThread.qo.h>

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

Signals

void finishedOperation (PlotMSThread *thread)
 This signal MUST be emitted after start() has been called, and when the operation has finished. More...
 
void updateProgress (unsigned int value, const QString &statusStr)
 
void initProgress (const QString &operationName)
 
void finalizeProgress ()
 

Public Member Functions

 PlotMSThread (QtProgressWidget *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 ~PlotMSThread ()
 Destructor. More...
 
virtual void startOperation ()=0
 ABSTRACT METHODS //. More...
 
virtual void finished ()
 IMPLEMENTED METHODS //. More...
 
virtual void initializeProgress (const casacore::String &operationName)
 Overridden from BackgroundThread in order to update the progress widget on the GUI thread. More...
 
virtual void setProgress (unsigned int progress, const casacore::String &status)
 
virtual void finishProgress ()
 
int getId ()
 
virtual QString getName () const =0
 
virtual bool isCacheThread () const
 
- Public Member Functions inherited from 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. 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 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 Slots

void cancelThread ()
 For when the user requests "cancel" for the thread. More...
 

Protected Member Functions

virtual void threadFinished ()
 Allows subclasses to override and do any clean-up they need to once the background thread has completed. More...
 
void signalFinishedOperation (PlotMSThread *thread)
 Signal that clean-up and thread work is done. More...
 
- Protected Member Functions inherited from casa::ThreadController
void startThread ()
 Starts the thread. More...
 
- Protected Member Functions inherited from casa::ThreadCommunication
 ThreadCommunication ()
 
virtual ~ThreadCommunication ()
 

Private Slots

void backgroundThread ()
 For when the user requests "background" for the thread. More...
 
void pauseThread ()
 For when the user requests "pause" for the thread. More...
 
void resumeThread ()
 For when the user requests "resume" for the thread. More...
 

Private Attributes

int id
 

Additional Inherited Members

- Protected Attributes inherited from casa::ThreadController
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_
 

Detailed Description

Abstract class to control a threaded operation from the GUI.

Classes that want to run PlotMSThreads should: 1) Provide a QtProgressWidget in the main (GUI) thread. 2) Connect the finishedOperation() signal to a slot as needed. 3) Call startOperation() to start the thread. 4) Call the post-thread method after completion, if there is one.

Definition at line 44 of file PlotMSThread.qo.h.

Constructor & Destructor Documentation

casa::PlotMSThread::PlotMSThread ( QtProgressWidget 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::PlotMSThread::~PlotMSThread ( )
virtual

Destructor.

Member Function Documentation

void casa::PlotMSThread::backgroundThread ( )
privateslot

For when the user requests "background" for the thread.

void casa::PlotMSThread::cancelThread ( )
protectedslot

For when the user requests "cancel" for the thread.

void casa::PlotMSThread::finalizeProgress ( )
signal
virtual void casa::PlotMSThread::finished ( )
virtual

IMPLEMENTED METHODS //.

Reimplemented from casa::ThreadController.

void casa::PlotMSThread::finishedOperation ( PlotMSThread thread)
signal

This signal MUST be emitted after start() has been called, and when the operation has finished.

The thread parameter points to the thread that has just completed.

virtual void casa::PlotMSThread::finishProgress ( )
virtual

Reimplemented from casa::ThreadController.

int casa::PlotMSThread::getId ( )
virtual QString casa::PlotMSThread::getName ( ) const
pure virtual
virtual void casa::PlotMSThread::initializeProgress ( const casacore::String operationName)
virtual

Overridden from BackgroundThread in order to update the progress widget on the GUI thread.

Reimplemented from casa::ThreadController.

void casa::PlotMSThread::initProgress ( const QString &  operationName)
signal
virtual bool casa::PlotMSThread::isCacheThread ( ) const
virtual

Reimplemented in casa::PlotMSCacheThread.

void casa::PlotMSThread::pauseThread ( )
privateslot

For when the user requests "pause" for the thread.

void casa::PlotMSThread::resumeThread ( )
privateslot

For when the user requests "resume" for the thread.

virtual void casa::PlotMSThread::setProgress ( unsigned int  progress,
const casacore::String status 
)
virtual

Reimplemented from casa::ThreadController.

void casa::PlotMSThread::signalFinishedOperation ( PlotMSThread thread)
protected

Signal that clean-up and thread work is done.

virtual void casa::PlotMSThread::startOperation ( )
pure virtual

ABSTRACT METHODS //.

Abstract method which does the operation. IMPORTANT: subclasses MUST emit the finished() signal when finished.

Implemented in casa::PlotMSCacheThread, casa::PlotMSDrawThread, and casa::PlotMSExportThread.

virtual void casa::PlotMSThread::threadFinished ( )
inlineprotectedvirtual

Allows subclasses to override and do any clean-up they need to once the background thread has completed.

Reimplemented in casa::PlotMSCacheThread, and casa::PlotMSExportThread.

Definition at line 90 of file PlotMSThread.qo.h.

void casa::PlotMSThread::updateProgress ( unsigned int  value,
const QString &  statusStr 
)
signal

Member Data Documentation

int casa::PlotMSThread::id
private

Definition at line 109 of file PlotMSThread.qo.h.


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