Embedded Template Library 1.0
etl::delegate< TReturn(TParam)> Class Template Reference

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 &&!etl::is_same< delegate_type, TFunctor >::value, int >::type=0)
 
template<typename TFunctor >
 delegate (const TFunctor &instance, typename etl::enable_if< etl::is_class< TFunctor >::value &&!etl::is_same< delegate_type, 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 &&!etl::is_same< delegate_type, TFunctor >::value, void >::type set (TFunctor &instance)
 Set from Functor.
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!etl::is_same< delegate_type, 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 , T const & Instance, TReturn(T::*)(TParam) const Method>
void set ()
 Set from const instance method (Compile time).
 
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 &&!etl::is_same< delegate_type, TFunctor >::value, delegate & >::type operator= (TFunctor &instance)
 Create from Functor.
 
template<typename TFunctor >
etl::enable_if< etl::is_class< TFunctor >::value &&!etl::is_same< delegate_type, 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< TReturn > call_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 &&!etl::is_same< delegate_type, TFunctor >::value, delegate >::type create (TFunctor &instance)
 Create from a Functor.
 
template<typename TFunctor >
static etl::enable_if< etl::is_class< TFunctor >::value &&!etl::is_same< delegate_type, 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 , T const & Instance, TReturn(T::*)(TParam) const Method>
static delegate create ()
 Create from const instance method (Compile time).
 
template<typename T , T & Instance>
static delegate create ()
 

Member Function Documentation

◆ call_or() [1/2]

template<typename TReturn , typename TParam >
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<typename TReturn , typename TParam >
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()

template<typename TReturn , typename TParam >
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.


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