AIStatefulTask ‐ Asynchronous, Stateful Task Scheduler library. Threads-like task objects evolving through user-defined states. |
Helper class for AIPackagedTask.
This object reserves storage a function pointer, its arguments and a return value.
The function pointer is initialized at creation, the arguments are added later.
The actual invokation of the function happens by calling the invoke() member function, which stores the return value once again in this object.
The return value can later be obtained through the member function get().
Usage example:
or
#include <AIDelayedFunction.h>
Public Member Functions | |
AIDelayedFunction (R(*fp)(Args...)) | |
Construct an AIDelayedFunction for a free function R f(Args...). | |
template<class C > | |
AIDelayedFunction (C *object, R(C::*memfn)(Args...)) | |
void | swap (AIDelayedFunction &other) noexcept |
Exchange the state with that of other. | |
void | operator() (Args... args) |
Store the arguments to be passed. | |
void | invoke () |
Actually invoke the call to the stored function with the stored arguments. | |
R const & | get () const |
Get the result, only valid after invoke was called. | |
|
inline |
Construct an AIDelayedFunction for a member function R C::f(Args...) of object.
The object must have a lifetime that exceeds the call to invoke.