interface for a listener that is notified when progress is done in the background and data is ready
More...
#include <cuthreadlistener.h>
|
virtual | ~CuThreadListener () |
|
virtual void | onProgress (int step, int total, const CuData &data)=0 |
| onProgress notifies the listener's thread about the progress of the ongoing work in the activity's background thread More...
|
|
virtual void | onResult (const CuData &data)=0 |
| onResult delivers to the listener's thread the results of the work performed by the activity's background thread More...
|
|
virtual void | onResult (const std::vector< CuData > &datalist)=0 |
| onResult delivers to the listener's thread the results of the work performed by the activity's background thread More...
|
|
virtual void | onResult (const CuUserData *u) |
| custom user-data flavor of the above More...
|
|
virtual CuData | getToken () const =0 |
| getToken returns a token characterizing the listener More...
|
|
interface for a listener that is notified when progress is done in the background and data is ready
Listeners will implement three methods, that are callbacks used to deliver data from the background activity thread to the listener's thread (in graphical applications often called the gui thread or main thread):
- onProgress: callback that delivers to the listener's thread progress information on the ongoing background operation in the CuActivity. Triggered by CuActivity::publishProgress
- onResult: callback that delivers results to the listener's thread from the background operation in the CuActivity. Triggered by CuActivity::publishResult
- getToken returns a descriptive token used to characterize the listener
Thread listeners are registered to the Cumbia engine in conjunction with the associated CuActivity through the method Cumbia::registerActivity.
Please see the md_src_tutorial_cuactivity documentation for an example.
- See also
- CuActivity
◆ ~CuThreadListener()
virtual CuThreadListener::~CuThreadListener |
( |
| ) |
|
|
inlinevirtual |
◆ getToken()
virtual CuData CuThreadListener::getToken |
( |
| ) |
const |
|
pure virtual |
getToken returns a token characterizing the listener
- Returns
- a CuData with key/value pairs describing the listener.
◆ onProgress()
virtual void CuThreadListener::onProgress |
( |
int |
step, |
|
|
int |
total, |
|
|
const CuData & |
data |
|
) |
| |
|
pure virtual |
onProgress notifies the listener's thread about the progress of the ongoing work in the activity's background thread
- Parameters
-
step | the current step |
total | the total number of steps |
data | CuData bundle storing (partial) results |
◆ onResult() [1/3]
virtual void CuThreadListener::onResult |
( |
const CuData & |
data | ) |
|
|
pure virtual |
onResult delivers to the listener's thread the results of the work performed by the activity's background thread
- Parameters
-
data | CuData bundle storing the results computed in the background activity |
◆ onResult() [2/3]
virtual void CuThreadListener::onResult |
( |
const CuUserData * |
u | ) |
|
|
inlinevirtual |
custom user-data flavor of the above
- Parameters
-
- Note
- This method does nothing by default and does not need to be implemented by subclasses
◆ onResult() [3/3]
virtual void CuThreadListener::onResult |
( |
const std::vector< CuData > & |
datalist | ) |
|
|
pure virtual |
onResult delivers to the listener's thread the results of the work performed by the activity's background thread
- Parameters
-
datalist | a std::vector of CuData bundle storing a list of results computed in the background activity |
The documentation for this class was generated from the following file: