An utility class used to create a task from a static function.
The provided static function can be either a 'raw' static function, or a static member function of a given class.
Between 0 and 4 function parameters can be used with this class. A copy of the function parameter values is stored within the CYIStaticTask object.
The return type of the static function must match the templated type of the static task. Void functions are supported (use a CYIStaticTask<> when creating the static task).
Sample usage:
ResultType | the return type of the static function. |
#include <thread/YiStaticTask.h>
Public Member Functions | |
CYIStaticTask (CYIFuture< ResultType > future, ResultType(*const pFunc)()) | |
template<typename P1 > | |
CYIStaticTask (CYIFuture< ResultType > future, ResultType(*const pFunc)(P1), P1 funcParam1) | |
template<typename P1 , typename P2 > | |
CYIStaticTask (CYIFuture< ResultType > future, ResultType(*const pFunc)(P1, P2), P1 funcParam1, P2 funcParam2) | |
template<typename P1 , typename P2 , typename P3 > | |
CYIStaticTask (CYIFuture< ResultType > future, ResultType(*const pFunc)(P1, P2, P3), P1 funcParam1, P2 funcParam2, P3 funcParam3) | |
template<typename P1 , typename P2 , typename P3 , typename P4 > | |
CYIStaticTask (CYIFuture< ResultType > future, ResultType(*const pFunc)(P1, P2, P3, P4), P1 funcParam1, P2 funcParam2, P3 funcParam3, P4 funcParam4) | |
CYIStaticTask (ResultType(*const pFunc)()) | |
template<typename P1 > | |
CYIStaticTask (ResultType(*const pFunc)(P1), P1 funcParam1) | |
template<typename P1 , typename P2 > | |
CYIStaticTask (ResultType(*const pFunc)(P1, P2), P1 funcParam1, P2 funcParam2) | |
template<typename P1 , typename P2 , typename P3 > | |
CYIStaticTask (ResultType(*const pFunc)(P1, P2, P3), P1 funcParam1, P2 funcParam2, P3 funcParam3) | |
template<typename P1 , typename P2 , typename P3 , typename P4 > | |
CYIStaticTask (ResultType(*const pFunc)(P1, P2, P3, P4), P1 funcParam1, P2 funcParam2, P3 funcParam3, P4 funcParam4) | |
virtual | ~CYIStaticTask () |
![]() | |
CYITask () | |
CYITask (CYIFuture< ResultType > future) | |
bool | SetFuture (CYIFuture< ResultType > future) |
![]() | |
virtual | ~CYITaskBase () |
State | GetState () const |
bool | MarkPendingExecution () |
void | RequestCancellation () |
bool | IsCancellationRequested () const |
void | SetCancellationRequestSucceeded () |
bool | IsCancellationRequestSucceeded () const |
bool | Execute () |
Protected Member Functions | |
virtual ResultType | Run () override |
Additional Inherited Members | |
![]() | |
enum | State : uint8_t { State::New, State::PendingExecution, State::Executing, State::Completed, State::Cancelled } |
CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > | future, |
ResultType(*)() | pFunc | ||
) |
Creates a task from pFunc, which is a static function. Creates an association with future.
CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > | future, |
ResultType(*)(P1) | pFunc, | ||
P1 | funcParam1 | ||
) |
Creates a task from pFunc, which is a static function. Creates an association with future. funcParam1 is passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > | future, |
ResultType(*)(P1, P2) | pFunc, | ||
P1 | funcParam1, | ||
P2 | funcParam2 | ||
) |
Creates a task from pFunc, which is a static function. Creates an association with future. funcParam1, funcParam2 are passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > | future, |
ResultType(*)(P1, P2, P3) | pFunc, | ||
P1 | funcParam1, | ||
P2 | funcParam2, | ||
P3 | funcParam3 | ||
) |
Creates a task from pFunc, which is a static function. Creates an association with future. funcParam1, funcParam2, funcParam3 are passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > | future, |
ResultType(*)(P1, P2, P3, P4) | pFunc, | ||
P1 | funcParam1, | ||
P2 | funcParam2, | ||
P3 | funcParam3, | ||
P4 | funcParam4 | ||
) |
Creates a task from pFunc, which is a static function. Creates an association with future. funcParam1, funcParam2, funcParam3, funcParam4 are passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | ResultType(*)() | pFunc | ) |
Creates a task from pFunc, which is a static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | ResultType(*)(P1) | pFunc, |
P1 | funcParam1 | ||
) |
Creates a task from pFunc, which is a static function. funcParam1 is passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | ResultType(*)(P1, P2) | pFunc, |
P1 | funcParam1, | ||
P2 | funcParam2 | ||
) |
Creates a task from pFunc, which is a static function. funcParam1, funcParam2 are passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | ResultType(*)(P1, P2, P3) | pFunc, |
P1 | funcParam1, | ||
P2 | funcParam2, | ||
P3 | funcParam3 | ||
) |
Creates a task from pFunc, which is a static function. funcParam1, funcParam2, funcParam3 are passed to the static function.
CYIStaticTask< ResultType >::CYIStaticTask | ( | ResultType(*)(P1, P2, P3, P4) | pFunc, |
P1 | funcParam1, | ||
P2 | funcParam2, | ||
P3 | funcParam3, | ||
P4 | funcParam4 | ||
) |
Creates a task from pFunc, which is a static function. funcParam1, funcParam2, funcParam3, funcParam4 are passed to the static function.
|
virtual |
|
overrideprotectedvirtual |
Executes the static function to which this object has a reference, using the parameters provided during construction of this static task.
Implements CYITask< ResultType >.