yarp-devices
|
Base class for a deferred task executor. More...
#include <FutureTask.hpp>
Public Member Functions | |
virtual | ~FutureTask ()=default |
Virtual destructor. | |
template<typename Fn , typename... Args> | |
void | add (Fn &&fn, Args &&... args) |
Register a deferred callback given a free function. | |
template<typename T , typename Fn , typename... Args> | |
void | add (T *p, Fn &&fn, Args &&... args) |
Register a deferred callback given a generic class instance. | |
virtual bool | dispatch ()=0 |
Dispatch the registered callbacks and returns their joint result. | |
unsigned int | size () const |
Get the number of registered deferred callbacks. | |
void | clear () |
Clear internal list of deferred callbacks. | |
Protected Attributes | |
std::vector< std::function< bool(int)> > | deferreds |
This class features a callback registry for instance methods that return a boolean value. The callbacks can be dispatched on request later on.