2018-02-14 19:18:51 +01:00
|
|
|
|
#ifndef CONTROLLABLETASK_H
|
|
|
|
|
|
#define CONTROLLABLETASK_H
|
|
|
|
|
|
/** From answer by Hatter
|
|
|
|
|
|
*
|
|
|
|
|
|
* https://stackoverflow.com/questions/5423058/qfuture-that-can-be-cancelled-and-report-progress
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2018-08-05 09:05:24 +02:00
|
|
|
|
//#include "TaskControl.h"
|
|
|
|
|
|
class TaskControl;
|
2018-02-14 19:18:51 +01:00
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
|
class ControllableTask
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
2018-12-30 15:46:15 +01:00
|
|
|
|
using Result = T;
|
2018-02-14 19:18:51 +01:00
|
|
|
|
virtual ~ControllableTask() {}
|
2018-12-30 15:46:15 +01:00
|
|
|
|
virtual Result run(TaskControl& control) = 0;
|
2018-02-14 19:18:51 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CONTROLLABLETASK_H
|