Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::delegate< TReturn(TParam)> Class Template Reference

Public Types

typedef TReturn(* function_type) (TParam)
 
typedef TReturn return_type
 
typedef TParam argument_type
 

Public Member Functions

 delegate ()
 Default constructor.
 
 delegate (const delegate &other)
 
template<typename TFunctor >
 delegate (TFunctor &instance, typename etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, int >::type=0)
 
template<typename TFunctor >
 delegate (const TFunctor &instance, typename etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, int >::type=0)
 
template<TReturn(*)(TParam) Method>
void set ()
 Set from function (Compile time).
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, void >::type set (TFunctor &instance)
 Set from Functor.
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, void >::type set (const TFunctor &instance)
 Set from const Functor.
 
template<typename T , TReturn(T::*)(TParam) Method>
void set (T &instance)
 Set from instance method (Run time).
 
template<typename T , TReturn(T::*)(TParam) const Method>
void set (T &instance)
 Set from const instance method (Run time).
 
template<typename T , T & Instance, TReturn(T::*)(TParam) Method>
void set ()
 Set from instance method (Compile time).
 
template<typename T , TReturn(T::*)(TParam) Method, T & Instance>
void set ()
 
template<typename T , T const & Instance, TReturn(T::*)(TParam) const Method>
void set ()
 Set from const instance method (Compile time).
 
template<typename T , TReturn(T::*)(TParam) const Method, T const & Instance>
void set ()
 
ETL_CONSTEXPR14 void clear ()
 Clear the delegate.
 
TReturn operator() (TParam param) const
 Execute the delegate.
 
template<typename TAlternative >
TReturn call_or (TAlternative alternative, TParam param) const
 
template<TReturn(*)(TParam) Method>
TReturn call_or (TParam param) const
 
delegateoperator= (const delegate &rhs)
 Create from function (Compile time).
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, delegate & >::type operator= (TFunctor &instance)
 Create from Functor.
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, delegate & >::type operator= (const TFunctor &instance)
 Create from const Functor.
 
bool operator== (const delegate &rhs) const
 Checks equality.
 
bool operator!= (const delegate &rhs) const
 Returns true if the delegate is valid.
 
bool is_valid () const
 Returns true if the delegate is valid.
 
 operator bool () const
 Returns true if the delegate is valid.
 
- Public Member Functions inherited from etl::private_delegate::call_if_impl< delegate< TReturn(TParam)>, TReturn, TParam >
etl::optional< TReturncall_if (TParam param)
 

Static Public Member Functions

template<TReturn(*)(TParam) Method>
static delegate create ()
 Create from function (Compile time).
 
template<typename TFunctor >
static etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, delegate >::type create (TFunctor &instance)
 Create from a Functor.
 
template<typename TFunctor >
static etl::enable_if< etl::is_class< TFunctor >::value &&!is_delegate< TFunctor >::value, delegate >::type create (const TFunctor &instance)
 Create from a const Functor.
 
template<typename T , TReturn(T::*)(TParam) Method>
static delegate create (T &instance)
 Create from instance method (Run time).
 
template<typename T , TReturn(T::*)(TParam) const Method>
static delegate create (const T &instance)
 Create from const instance method (Run time).
 
template<typename T , T & Instance, TReturn(T::*)(TParam) Method>
static delegate create ()
 Create from instance method (Compile time).
 
template<typename T , TReturn(T::*)(TParam) Method, T & Instance>
static delegate create ()
 
template<typename T , T const & Instance, TReturn(T::*)(TParam) const Method>
static delegate create ()
 Create from const instance method (Compile time).
 
template<typename T , TReturn(T::*)(TParam) const Method, T const & Instance>
static delegate create ()
 
template<typename T , T & Instance>
static delegate create ()
 

Member Function Documentation

◆ call_or() [1/2]

template<typename TAlternative >
TReturn etl::delegate< TReturn(TParam)>::call_or ( TAlternative  alternative,
TParam  param 
) const
inline

Execute the delegate if valid or call alternative. Run time alternative.

◆ call_or() [2/2]

template<TReturn(*)(TParam) Method>
TReturn etl::delegate< TReturn(TParam)>::call_or ( TParam  param) const
inline

Execute the delegate if valid or call alternative. Compile time alternative.

◆ create() [1/3]

template<typename T , TReturn(T::*)(TParam) Method, T & Instance>
static delegate etl::delegate< TReturn(TParam)>::create ( )
inlinestatic

Create from instance method (Compile time). New API

◆ create() [2/3]

template<typename T , TReturn(T::*)(TParam) const Method, T const & Instance>
static delegate etl::delegate< TReturn(TParam)>::create ( )
inlinestatic

Create from const instance method (Compile time). New API

◆ create() [3/3]

template<typename T , T & Instance>
static delegate etl::delegate< TReturn(TParam)>::create ( )
inlinestatic

Create from instance function operator (Compile time). At the time of writing, GCC appears to have trouble with this.

◆ set() [1/2]

template<typename T , TReturn(T::*)(TParam) Method, T & Instance>
void etl::delegate< TReturn(TParam)>::set ( )
inline

Set from instance method (Compile time). New API

◆ set() [2/2]

template<typename T , TReturn(T::*)(TParam) const Method, T const & Instance>
void etl::delegate< TReturn(TParam)>::set ( )
inline

Set from const instance method (Compile time). New API


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