![]() |
Peano
|
Frequently used implementation for job with a functor. More...
#include <Task.h>
Public Member Functions | |
TaskWithoutCopyOfFunctor ()=delete | |
TaskWithoutCopyOfFunctor (const TaskWithoutCopyOfFunctor &)=delete | |
TaskWithoutCopyOfFunctor (int taskType, int priority, std::function< void()> &taskFunctor) | |
virtual void | run () override |
Run the task. | |
![]() | |
Task (int taskType, int priority) | |
Construct task. | |
virtual | ~Task () |
int | getTaskType () const |
int | getPriority () const |
void | setPriority (int priority) |
Set priority. | |
virtual bool | canFuse () const |
virtual void | fuse (const std::list< Task * > &otherTasks, int targetDevice=Host) |
Fuse multiple tasks. | |
virtual std::string | toString () const |
Private Attributes | |
std::function< void()> & | _taskFunctor |
See the outer class description for an explanation why this is an attribute, i.e. | |
Additional Inherited Members | |
![]() | |
static constexpr int | DefaultPriority = 1024 |
static constexpr int | Host = -1 |
static constexpr int | DontFuse = -1 |
![]() | |
const int | _taskType |
int | _priority |
Frequently used implementation for job with a functor.
Cousin implementation to TaskWithCopyOfFunctor which does not copy the underlying functor but holds a reference to it. This implies that you have to ensure that the functor remains valid after you have spawned the task.
It can pay off to use this variant for very expensive functors, i.e. functors that internally copy a lot of things. In most cases, you won't need this class. I recommend to start with the copy version always.
Please consult TaskWithCopyOfFunctor for further information on the used attributes.
|
delete |
|
delete |
|
overridevirtual |
|
private |