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 > &rFuture, ResultType(*const pFunc)()) | |
| template<typename P1 > | |
| CYIStaticTask (CYIFuture< ResultType > &rFuture, ResultType(*const pFunc)(P1), P1 const &funcParam1) | |
| template<typename P1 , typename P2 > | |
| CYIStaticTask (CYIFuture< ResultType > &rFuture, ResultType(*const pFunc)(P1, P2), P1 const &funcParam1, P2 const &funcParam2) | |
| template<typename P1 , typename P2 , typename P3 > | |
| CYIStaticTask (CYIFuture< ResultType > &rFuture, ResultType(*const pFunc)(P1, P2, P3), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3) | |
| template<typename P1 , typename P2 , typename P3 , typename P4 > | |
| CYIStaticTask (CYIFuture< ResultType > &rFuture, ResultType(*const pFunc)(P1, P2, P3, P4), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3, P4 const &funcParam4) | |
| CYIStaticTask (std::unique_ptr< CYIFuture< ResultType >> pFuture, ResultType(*const pFunc)()) | |
| template<typename P1 > | |
| CYIStaticTask (std::unique_ptr< CYIFuture< ResultType >> pFuture, ResultType(*const pFunc)(P1), P1 const &funcParam1) | |
| template<typename P1 , typename P2 > | |
| CYIStaticTask (std::unique_ptr< CYIFuture< ResultType >> pFuture, ResultType(*const pFunc)(P1, P2), P1 const &funcParam1, P2 const &funcParam2) | |
| template<typename P1 , typename P2 , typename P3 > | |
| CYIStaticTask (std::unique_ptr< CYIFuture< ResultType >> pFuture, ResultType(*const pFunc)(P1, P2, P3), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3) | |
| template<typename P1 , typename P2 , typename P3 , typename P4 > | |
| CYIStaticTask (std::unique_ptr< CYIFuture< ResultType >> pFuture, ResultType(*const pFunc)(P1, P2, P3, P4), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3, P4 const &funcParam4) | |
| CYIStaticTask (ResultType(*const pFunc)()) | |
| template<typename P1 > | |
| CYIStaticTask (ResultType(*const pFunc)(P1), P1 const &funcParam1) | |
| template<typename P1 , typename P2 > | |
| CYIStaticTask (ResultType(*const pFunc)(P1, P2), P1 const &funcParam1, P2 const &funcParam2) | |
| template<typename P1 , typename P2 , typename P3 > | |
| CYIStaticTask (ResultType(*const pFunc)(P1, P2, P3), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3) | |
| template<typename P1 , typename P2 , typename P3 , typename P4 > | |
| CYIStaticTask (ResultType(*const pFunc)(P1, P2, P3, P4), P1 const &funcParam1, P2 const &funcParam2, P3 const &funcParam3, P4 const &funcParam4) | |
| virtual | ~CYIStaticTask () |
Public Member Functions inherited from CYITask< ResultType > | |
| CYITask () | |
| CYITask (CYIFuture< ResultType > &rFuture) | |
| CYITask (std::unique_ptr< CYIFuture< ResultType >> pFuture) | |
| virtual | ~CYITask () |
| bool | SetFuture (CYIFuture< ResultType > &rFuture) |
| bool | SetFuture (std::unique_ptr< CYIFuture< ResultType >> rFuture) |
Public Member Functions inherited from CYITaskBase | |
| virtual | ~CYITaskBase () |
| virtual bool | TakeOwnershipOfFuture (std::unique_ptr< CYIAbstractFuture > pFuture) |
| TASK_STATE | GetState () const |
| bool | IsFutureOwner () const |
| bool | MarkPendingExecution () |
| void | RequestCancellation () |
| bool | Execute () |
Protected Member Functions | |
| virtual ResultType | Run () override |
Protected Member Functions inherited from CYITaskBase | |
| bool | IsCancellationRequested () const |
| void | SetCancellationRequestSucceeded () |
| virtual void | CleanUpAfterCancellation () |
Additional Inherited Members | |
Public Types inherited from CYITaskBase | |
| enum | TASK_STATE { TASK_NEW, TASK_PENDING_EXECUTION, TASK_EXECUTING, TASK_COMPLETED, TASK_CANCELLED } |
Protected Attributes inherited from CYITaskBase | |
| CYIMutex | m_mutex |
| CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > & | rFuture, |
| ResultType(*)() | pFunc | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with rFuture.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > & | rFuture, |
| ResultType(*)(P1) | pFunc, | ||
| P1 const & | funcParam1 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with rFuture. funcParam1 is passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > & | rFuture, |
| ResultType(*)(P1, P2) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with rFuture. funcParam1, funcParam2 are passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > & | rFuture, |
| ResultType(*)(P1, P2, P3) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | funcParam3 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with rFuture. funcParam1, funcParam2, funcParam3 are passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | CYIFuture< ResultType > & | rFuture, |
| ResultType(*)(P1, P2, P3, P4) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | funcParam3, | ||
| P4 const & | funcParam4 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with rFuture. funcParam1, funcParam2, funcParam3, funcParam4 are passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | std::unique_ptr< CYIFuture< ResultType >> | pFuture, |
| ResultType(*)() | pFunc | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with pFuture, which this task takes the ownership of.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | std::unique_ptr< CYIFuture< ResultType >> | pFuture, |
| ResultType(*)(P1) | pFunc, | ||
| P1 const & | funcParam1 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with pFuture, which this task takes the ownership of. funcParam1 is passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | std::unique_ptr< CYIFuture< ResultType >> | pFuture, |
| ResultType(*)(P1, P2) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with pFuture, which this task takes the ownership of. funcParam1, funcParam2 are passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | std::unique_ptr< CYIFuture< ResultType >> | pFuture, |
| ResultType(*)(P1, P2, P3) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | funcParam3 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with pFuture, which this task takes the ownership of. funcParam1, funcParam2, funcParam3 are passed to the static function.
| CYIStaticTask< ResultType >::CYIStaticTask | ( | std::unique_ptr< CYIFuture< ResultType >> | pFuture, |
| ResultType(*)(P1, P2, P3, P4) | pFunc, | ||
| P1 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | funcParam3, | ||
| P4 const & | funcParam4 | ||
| ) |
Creates a task from pFunc, which is a static function. Creates an association with pFuture, which this task takes the ownership of. 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 const & | 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 const & | funcParam1, | ||
| P2 const & | 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 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | 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 const & | funcParam1, | ||
| P2 const & | funcParam2, | ||
| P3 const & | funcParam3, | ||
| P4 const & | 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 >.