CustusX
2023.01.05-dev+develop.0da12
An IGT application
|
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>
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 () |
T | 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 |
Base class for algorithms that wants to thread and time their execution. T is the return type of the calculated data in the thread.
Definition at line 37 of file cxThreadedTimedAlgorithm.h.
|
inline |
Definition at line 40 of file cxThreadedTimedAlgorithm.h.
|
inlinevirtual |
Definition at line 47 of file cxThreadedTimedAlgorithm.h.
|
protectedpure virtual |
This is the threaded function, should only contain threadsafe function calls.
|
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.
|
inlineprotected |
Definition at line 66 of file cxThreadedTimedAlgorithm.h.
|
protected |
Definition at line 35 of file cxThreadedTimedAlgorithm.cpp.
|
inlineprotected |
Definition at line 74 of file cxThreadedTimedAlgorithm.h.
|
protected |
|
inlinevirtual |
Returns true after the finished() signal is emitted.
Implements cx::TimedBaseAlgorithm.
Definition at line 55 of file cxThreadedTimedAlgorithm.h.
|
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.
|
protectedpure virtual |
This happens when the thread (calculate) is finished, here non-thread safe functions can be called.
Reimplemented from cx::TimedBaseAlgorithm.
|
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.