STM32LIB
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
wink::slot< Signature > Struct Template Reference

Describes a slot that may be added to a signal, or used stand-alone for a call-back. More...

#include <slot.h>

Public Types

typedef Signature FnPtr
 A static function pointer with the correct signature. More...
 

Public Member Functions

 slot ()
 Construct a slot with no call-back. More...
 
 slot (FnPtr fn)
 
template<typename T , typename MemFnPtr >
 slot (T *obj, MemFnPtr fn)
 
 slot (const __this_type &slot)
 Copy constructor. More...
 
 ~slot ()
 Destructor. More...
 
__this_typeoperator= (const __this_type &slot)
 
template<class... Args>
void operator() (Args &&...args) const
 
bool operator== (const __this_type &slot) const
 
bool operator!= (const __this_type &slot) const
 
bool operator< (const __this_type &slot) const
 
bool operator> (const __this_type &slot) const
 
bool operator<= (const __this_type &slot) const
 
bool operator>= (const __this_type &slot) const
 

Static Public Member Functions

static slot< Signature > bind (Signature fn)
 
template<typename T , typename MemFnPtr >
static slot< Signature > bind (T *obj, MemFnPtr fn)
 

Private Types

typedef slot< Signature > __this_type
 
typedef fastdelegate::FastDelegate< Signature > __impl_delegate
 The implementation of the slot, as a delegate. More...
 

Private Attributes

__impl_delegate _delegate
 

Detailed Description

template<typename Signature>
struct wink::slot< Signature >

Describes a slot that may be added to a signal, or used stand-alone for a call-back.

This can be used as an alternative to std::function, as it is much faster.

Author
Miguel Martin

Member Typedef Documentation

template<typename Signature >
typedef slot<Signature> wink::slot< Signature >::__this_type
private
template<typename Signature >
typedef Signature wink::slot< Signature >::FnPtr

A static function pointer with the correct signature.

template<typename Signature >
typedef fastdelegate::FastDelegate<Signature> wink::slot< Signature >::__impl_delegate
private

The implementation of the slot, as a delegate.

Constructor & Destructor Documentation

template<typename Signature >
wink::slot< Signature >::slot ( )
inline

Construct a slot with no call-back.

template<typename Signature >
wink::slot< Signature >::slot ( FnPtr  fn)
inline

Construct a slot with a static/global function call-back

Parameters
fnThe static/global function
template<typename Signature >
template<typename T , typename MemFnPtr >
wink::slot< Signature >::slot ( T *  obj,
MemFnPtr  fn 
)
inline

Construct a slot with a member-function

Parameters
objThe object that the member-function belongs to
fnThe member function of the object
template<typename Signature >
wink::slot< Signature >::slot ( const __this_type slot)
inline

Copy constructor.

template<typename Signature >
wink::slot< Signature >::~slot ( )
inline

Destructor.

Member Function Documentation

template<typename Signature >
static slot<Signature> wink::slot< Signature >::bind ( Signature  fn)
inlinestatic

Binds a function

Parameters
fnThe function you wish to bind
Note
This function must be either marked as static, or not inside a class/struct (i.e. in global scope)
template<typename Signature >
template<typename T , typename MemFnPtr >
static slot<Signature> wink::slot< Signature >::bind ( T *  obj,
MemFnPtr  fn 
)
inlinestatic

Binds a member function

Parameters
objThe object you wish
template<typename Signature >
__this_type& wink::slot< Signature >::operator= ( const __this_type slot)
inline

Assignment operator

Parameters
slotThe slot you wish to assign to
Returns
*this
template<typename Signature >
template<class... Args>
void wink::slot< Signature >::operator() ( Args &&...  args) const
inline

Calls the slot

Parameters
argsAny arguments you want to pass to the slot
template<typename Signature >
bool wink::slot< Signature >::operator== ( const __this_type slot) const
inline
template<typename Signature >
bool wink::slot< Signature >::operator!= ( const __this_type slot) const
inline
template<typename Signature >
bool wink::slot< Signature >::operator< ( const __this_type slot) const
inline
template<typename Signature >
bool wink::slot< Signature >::operator> ( const __this_type slot) const
inline
template<typename Signature >
bool wink::slot< Signature >::operator<= ( const __this_type slot) const
inline
template<typename Signature >
bool wink::slot< Signature >::operator>= ( const __this_type slot) const
inline

Member Data Documentation

template<typename Signature >
__impl_delegate wink::slot< Signature >::_delegate
private

The documentation for this struct was generated from the following file: