Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Static Public Member Functions | Friends
Callback< R(ArgTs...)> Class Template Reference

Callback class based on template specialization. More...

#include <Callback.h>

Inheritance diagram for Callback< R(ArgTs...)>:
CallbackBase

Public Member Functions

 Callback () noexcept
 Create an empty Callback. More...
 
 Callback (std::nullptr_t) noexcept
 Create an empty Callback. More...
 
template<typename Obj , typename Method , typename std::enable_if_t< mstd::is_invocable_r< R, Method, Obj, ArgTs... >::value, int > = 0>
 Callback (Obj obj, Method method)
 Create a Callback with a member function. More...
 
template<typename Fn , typename BoundArg , typename std::enable_if_t< mstd::is_invocable_r< R, Fn, BoundArg, ArgTs... >::value, int > = 0>
 Callback (Fn func, BoundArg arg)
 Create a Callback with a static function and bound pointer. More...
 
template<typename F , typename std::enable_if_t< !detail::can_null_check< F >::value && mstd::is_invocable_r< R, F, ArgTs... >::value, int > = 0>
 Callback (F f)
 Create a Callback with a function object. More...
 
template<typename F , typename std::enable_if_t< detail::can_null_check< F >::value && mstd::is_invocable_r< R, F, ArgTs... >::value, int > = 0>
 Callback (F f)
 Create a Callback with a function pointer. More...
 
 ~Callback ()=default
 Destroy a callback. More...
 
void swap (Callback &that) noexcept
 Swap a callback. More...
 
template<typename F , typename = std::enable_if_t< mstd::is_invocable_r<R, F, ArgTs...>::value && !mstd::is_same<mstd::remove_cvref_t<F>, Callback>::value>>
Callbackoperator= (F &&f)
 Assign a callback. More...
 
Callbackoperator= (std::nullptr_t) noexcept
 Empty a callback. More...
 
call (ArgTs...args) const
 Call the attached function. More...
 
operator() (ArgTs...args) const
 Call the attached function. More...
 
 operator bool () const noexcept
 Test if function has been assigned. More...
 

Static Public Member Functions

static R thunk (void *func, ArgTs...args)
 Static thunk for passing as C-style function. More...
 

Friends

bool operator== (const Callback &f, std::nullptr_t) noexcept
 Test for emptiness. More...
 
bool operator== (std::nullptr_t, const Callback &f) noexcept
 Test for emptiness. More...
 
bool operator!= (const Callback &f, std::nullptr_t) noexcept
 Test for non-emptiness. More...
 
bool operator!= (std::nullptr_t, const Callback &f) noexcept
 Test for non-emptiness. More...
 

Detailed Description

template<typename R, typename... ArgTs>
class mbed::Callback< R(ArgTs...)>

Callback class based on template specialization.

Note
Synchronization level: Not protected

Definition at line 311 of file Callback.h.

Constructor & Destructor Documentation

Callback ( )
noexcept

Create an empty Callback.

Definition at line 317 of file Callback.h.

Callback ( std::nullptr_t  )
noexcept

Create an empty Callback.

Definition at line 321 of file Callback.h.

Callback ( Obj  obj,
Method  method 
)

Create a Callback with a member function.

Parameters
objPointer to object to invoke member function on
methodMember function to attach

Definition at line 351 of file Callback.h.

Callback ( Fn  func,
BoundArg  arg 
)

Create a Callback with a static function and bound pointer.

Parameters
funcStatic function to attach
argPointer argument to function

Definition at line 363 of file Callback.h.

Callback ( f)

Create a Callback with a function object.

Parameters
fFunction object to attach
Note
The function object is limited to a a few words of storage

Definition at line 379 of file Callback.h.

Callback ( f)

Create a Callback with a function pointer.

Parameters
fFunction pointer to attach

Definition at line 392 of file Callback.h.

~Callback ( )
default

Destroy a callback.

Member Function Documentation

R call ( ArgTs...  args) const

Call the attached function.

Definition at line 504 of file Callback.h.

operator bool ( ) const
explicitnoexcept

Test if function has been assigned.

Definition at line 520 of file Callback.h.

R operator() ( ArgTs...  args) const

Call the attached function.

Definition at line 513 of file Callback.h.

Callback& operator= ( F &&  f)

Assign a callback.

Definition at line 472 of file Callback.h.

Callback& operator= ( std::nullptr_t  )
noexcept

Empty a callback.

Definition at line 494 of file Callback.h.

void swap ( Callback< R(ArgTs...)> &  that)
noexcept

Swap a callback.

Definition at line 416 of file Callback.h.

static R thunk ( void *  func,
ArgTs...  args 
)
static

Static thunk for passing as C-style function.

Parameters
funcCallback to call passed as void pointer
argsArguments to be called with function func
Returns
the value as determined by func which is of type and determined by the signature of func

Definition at line 599 of file Callback.h.

Friends And Related Function Documentation

bool operator!= ( const Callback< R(ArgTs...)> &  f,
std::nullptr_t   
)
friend

Test for non-emptiness.

Definition at line 581 of file Callback.h.

bool operator!= ( std::nullptr_t  ,
const Callback< R(ArgTs...)> &  f 
)
friend

Test for non-emptiness.

Definition at line 588 of file Callback.h.

bool operator== ( const Callback< R(ArgTs...)> &  f,
std::nullptr_t   
)
friend

Test for emptiness.

Definition at line 556 of file Callback.h.

bool operator== ( std::nullptr_t  ,
const Callback< R(ArgTs...)> &  f 
)
friend

Test for emptiness.

Definition at line 563 of file Callback.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.