CustusX  20.03-rc1
An IGT application
cx::ThreadedTimedAlgorithm< T > Class Template Referenceabstract

Base class for algorithms that wants to thread and time their execution. T is the return type of the calculated data in the thread. More...

#include <cxThreadedTimedAlgorithm.h>

Inheritance diagram for cx::ThreadedTimedAlgorithm< T >:
cx::TimedBaseAlgorithm

Public Member Functions

 ThreadedTimedAlgorithm (QString product, int secondsBetweenAnnounce)
 
virtual ~ThreadedTimedAlgorithm ()
 
virtual void execute ()
 
virtual bool isFinished () const
 
virtual bool isRunning () const
 
- Public Member Functions inherited from cx::TimedBaseAlgorithm
 TimedBaseAlgorithm (QString product, int secondsBetweenAnnounce)
 
virtual ~TimedBaseAlgorithm ()
 
virtual QString getProduct () const
 

Protected Member Functions

virtual void preProcessingSlot ()
 This happens before the thread (calculate) is started, here non-thread safe functions can be called. More...
 
virtual void postProcessingSlot ()=0
 This happens when the thread (calculate) is finished, here non-thread safe functions can be called. More...
 
virtual T calculate ()=0
 This is the threaded function, should only contain threadsafe function calls. More...
 
void generate ()
 
getResult ()
 
template<>
cxResource_EXPORT void getResult ()
 
template<>
cxResource_EXPORT void getResult ()
 
- Protected Member Functions inherited from cx::TimedBaseAlgorithm
void startTiming ()
 
void stopTiming ()
 
QString getSecondsPassedAsString () const
 

Additional Inherited Members

- Signals inherited from cx::TimedBaseAlgorithm
void aboutToStart ()
 emitted at start of execute. Use to perform preprocessing More...
 
void started (int maxSteps)
 emitted at start of run. More...
 
void finished ()
 should be emitted when at the end of postProcessingSlot More...
 
void productChanged ()
 emitted whenever product string has changed More...
 
- Protected Slots inherited from cx::TimedBaseAlgorithm
- Protected Attributes inherited from cx::TimedBaseAlgorithm
bool mUseDefaultMessages
 

Detailed Description

template<class T>
class cx::ThreadedTimedAlgorithm< T >

Base class for algorithms that wants to thread and time their execution. T is the return type of the calculated data in the thread.

Date
Feb 22, 2011
Author
Janne Beate Bakeng, SINTEF

Definition at line 37 of file cxThreadedTimedAlgorithm.h.

Constructor & Destructor Documentation

template<class T>
cx::ThreadedTimedAlgorithm< T >::ThreadedTimedAlgorithm ( QString  product,
int  secondsBetweenAnnounce 
)
inline

Definition at line 40 of file cxThreadedTimedAlgorithm.h.

template<class T>
virtual cx::ThreadedTimedAlgorithm< T >::~ThreadedTimedAlgorithm ( )
inlinevirtual

Definition at line 47 of file cxThreadedTimedAlgorithm.h.

Member Function Documentation

template<class T>
virtual T cx::ThreadedTimedAlgorithm< T >::calculate ( )
protectedpure virtual

This is the threaded function, should only contain threadsafe function calls.

template<class T>
virtual void cx::ThreadedTimedAlgorithm< T >::execute ( )
inlinevirtual

Execute the algorithm. Parts of the execution can be in another thread, thus the call usually returns after preprocessing is complete. The exec starts by emitting aboutToStart(), which can be used by callers to set input arguments.

Implements cx::TimedBaseAlgorithm.

Reimplemented in cx::ConnectedThresholdImageFilter.

Definition at line 49 of file cxThreadedTimedAlgorithm.h.

template<class T>
void cx::ThreadedTimedAlgorithm< T >::generate ( )
inlineprotected

Definition at line 66 of file cxThreadedTimedAlgorithm.h.

template<>
cxResource_EXPORT void cx::ThreadedTimedAlgorithm< void >::getResult ( )
protected

Definition at line 35 of file cxThreadedTimedAlgorithm.cpp.

template<class T>
T cx::ThreadedTimedAlgorithm< T >::getResult ( )
inlineprotected

Definition at line 74 of file cxThreadedTimedAlgorithm.h.

template<>
cxResource_EXPORT void cx::ThreadedTimedAlgorithm< void >::getResult ( )
protected
template<class T>
virtual bool cx::ThreadedTimedAlgorithm< T >::isFinished ( ) const
inlinevirtual

Returns true after the finished() signal is emitted.

Implements cx::TimedBaseAlgorithm.

Definition at line 55 of file cxThreadedTimedAlgorithm.h.

template<class T>
virtual bool cx::ThreadedTimedAlgorithm< T >::isRunning ( ) const
inlinevirtual

Returns true if preprocess is started and postprocess not complete. (Right after aboutToStart, right before finished())

Implements cx::TimedBaseAlgorithm.

Definition at line 56 of file cxThreadedTimedAlgorithm.h.

template<class T>
virtual void cx::ThreadedTimedAlgorithm< T >::postProcessingSlot ( )
protectedpure virtual

This happens when the thread (calculate) is finished, here non-thread safe functions can be called.

Reimplemented from cx::TimedBaseAlgorithm.

template<class T>
virtual void cx::ThreadedTimedAlgorithm< T >::preProcessingSlot ( )
inlineprotectedvirtual

This happens before the thread (calculate) is started, here non-thread safe functions can be called.

Definition at line 60 of file cxThreadedTimedAlgorithm.h.


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