Direct Callback implementation. More...
#include <direct-callback.hpp>
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. More... | |
Public Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
BaseCallback ()=default | |
Default constructor. More... | |
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. More... | |
Additional Inherited Members | |
Public Types inherited from kouta::base::callback::BaseCallback< TArgs... > | |
using | Callable = std::function< void(TArgs...)> |
The type of the callable the Callback points to. More... | |
Protected Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
void | set_callable (Callable &&callable) |
Set the callable. More... | |
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. |
|
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. |
|
default |
|
default |