Direct Callback implementation. More...
#include <direct-callback.hpp>


Public Types | |
| using | Callable = typename BaseCallback< TArgs... >::Callable |
| The type of the callable the Callback points to. | |
Public Types inherited from kouta::base::callback::BaseCallback< TArgs... > | |
| using | Callable = std::function< void(TArgs...)> |
| The type of the callable the Callback points to. | |
Public Member Functions | |
| DirectCallback (const DirectCallback &)=default | |
| DirectCallback & | operator= (const DirectCallback &)=default |
| DirectCallback (DirectCallback &&)=default | |
| DirectCallback & | operator= (DirectCallback &&)=default |
| ~DirectCallback () override=default | |
| template<class TClass > | |
| DirectCallback (TClass *object, void(TClass::*method)(TArgs...)) | |
| Callback constructor from a bound method. | |
| DirectCallback (const DirectCallback::Callable &callable) | |
| Callback constructor from a callable. | |
| DirectCallback (DirectCallback::Callable &&callable) | |
| Callback constructor from a callable. | |
Public Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
| BaseCallback ()=default | |
| Default constructor. | |
| BaseCallback (const BaseCallback &)=default | |
| BaseCallback (BaseCallback &&)=default | |
| BaseCallback & | operator= (const BaseCallback &)=default |
| BaseCallback & | operator= (BaseCallback &&)=default |
| virtual | ~BaseCallback ()=default |
| void | operator() (TArgs... args) const |
| Invoke the underlying callable. | |
Additional Inherited Members | |
Protected Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
| void | set_callable (const Callable &callable) |
| Set the callable. | |
| void | set_callable (Callable &&callable) |
| Set the callable. | |
Direct Callback implementation.
A direct Callback wraps a callable that is invoked within the caller's thread, making it no different to a direct invokation of a specific function or method.
The lifetime of the object the Callback points to must be guaranteed to surpass that of the Callback itself.
| TArgs | Callable arguments. |
| using kouta::base::callback::DirectCallback< TArgs >::Callable = typename BaseCallback<TArgs...>::Callable |
The type of the callable the Callback points to.
|
default |
|
default |
|
overridedefault |
|
inline |
Callback constructor from a bound method.
This constructor initializes the internal callable with a pointer to the specified bound method. The developer must guarantee the lifetime of the object to prevent invalid memory access.
| TClass | Object type. |
| [in] | object | Pointer to the object whose method is going to be called. |
| [in] | method | Pointer to the method that is going to be called. The arguments of the Callback must match those of this method. |
|
inlineexplicit |
Callback constructor from a callable.
This constructor initializes the internal callable to the one specified in callable , so that it is invoked from within the current context (i.e. as a regular function).
| [in] | callable | Callable to store. For instance, this could be a lambda or anything convertible to std::function. |
|
inlineexplicit |
Callback constructor from a callable.
This constructor initializes the internal callable to the one specified in callable , so that it is invoked from within the current context (i.e. as a regular function).
| [in] | callable | Callable to store. For instance, this could be a lambda or anything convertible to std::function. |
|
default |
|
default |