ObservableRef< DELEGATE > Class Template Reference

#include <observable.h>

Inheritance diagram for ObservableRef< DELEGATE >:

详细描述

template<typename DELEGATE>
class maxon::ObservableRef< DELEGATE >

Observable Class that allows to add subscribers to observables.

Template Parameters
DELEGATE Delegate of the observable class defined in the MAXON_OBSERVABLE macro. Usually "Delegate" is appended to the observable name, e.g. ObservableMachineStateChangedDelegate.

公共成员函数

template<typename FN >
Result < FunctionBaseRef >  AddObserver ( ObserverObjectInterface *observer, FN &&fn, Int priority= ADDOBSERVER_DEFAULTPRIORITY ) const
template<typename FN >
Result < FunctionBaseRef >  AddObserver ( ObserverObjectInterface *observer, FN &&fn, const JobQueueRef &queue, Int priority= ADDOBSERVER_DEFAULTPRIORITY ) const
template<typename FN >
Result < FunctionBaseRef >  AddObserver (FN &&fn, Int priority= ADDOBSERVER_DEFAULTPRIORITY ) const
template<typename FN , typename = typename std::enable_if<!STD_IS_REPLACEMENT(convertible, typename std::decay<FN>::type, ObserverObjectInterface*)>::type>
Result < FunctionBaseRef >  AddObserver (FN &&fn, const JobQueueRef &queue, Int priority= ADDOBSERVER_DEFAULTPRIORITY ) const

静态公共成员函数

static ObservableRef < DELEGATE >  NullValue ()

成员函数文档编制

◆  AddObserver() [1/4]

Result <FunctionBaseRef> AddObserver ( ObserverObjectInterface observer ,
FN &&  fn ,
Int   priority = ADDOBSERVER_DEFAULTPRIORITY  
) const

Adds a notification lambda as a subscriber to a observable.

参数
[in] observer Object to connect with the observable. This can be nullptr.
[in] fn Lambda function (or object with Handle* method) that should be called when the observable is fired.
[in] priority Priority in execution. Use ADDOBSERVER_DEFAULTPRIORITY as default. Greater values will execute later.
返回
If successful the entry object is returned. In case of failures a nullptr.

◆  AddObserver() [2/4]

Result <FunctionBaseRef> AddObserver ( ObserverObjectInterface observer ,
FN &&  fn ,
const JobQueueRef queue ,
Int   priority = ADDOBSERVER_DEFAULTPRIORITY  
) const

Adds a notification lambda as a subscriber to a observable.

参数
[in] observer Object to connect with the observable. This can be nullptr.
[in] fn Lambda function (or object with Handle* method) that should be called when the observable is fired.
[in] queue Queue in which the notification should be send. queuing is only possible if the observable has no return value.
[in] priority Priority in execution. Use ADDOBSERVER_DEFAULTPRIORITY as default. Greater values will execute later.
返回
If successful the entry object is returned. In case of failures a nullptr.

◆  AddObserver() [3/4]

Result <FunctionBaseRef> AddObserver ( FN &&  fn ,
Int   priority = ADDOBSERVER_DEFAULTPRIORITY  
) const

Adds a notification lambda as a subscriber to a observable.

参数
[in] fn Lambda function (or object with Handle* method) that should be called when the observable is fired.
[in] priority Priority in execution. Use ADDOBSERVER_DEFAULTPRIORITY as default. Greater values will execute later.
返回
If successful the entry object is returned. In case of failures a nullptr.

◆  AddObserver() [4/4]

Result <FunctionBaseRef> AddObserver ( FN &&  fn ,
const JobQueueRef queue ,
Int   priority = ADDOBSERVER_DEFAULTPRIORITY  
) const

Adds a notification lambda as a subscriber to a observable.

参数
[in] fn Lambda function (or object with Handle* method) that should be called when the observable is fired.
[in] queue Queue in which the notification should be send. queuing is only possible if the observable has no return value.
[in] priority Priority in execution. Use ADDOBSERVER_DEFAULTPRIORITY as default. Greater values will execute later.
返回
If successful the entry object is returned. In case of failures a nullptr.

◆  NullValue()

static ObservableRef <DELEGATE> NullValue ( )
static

Helper function for data type registration.