#include <observable.h>
Observable Class that allows to add subscribers to observables.
DELEGATE | Delegate of the observable class defined in the MAXON_OBSERVABLE macro. Usually "Delegate" is appended to the observable name, e.g. ObservableMachineStateChangedDelegate. |
Public Member Functions | |
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 Public Member Functions | |
static ObservableRef< DELEGATE > | NullValue () |
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. |
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. |
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. |
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. |
|
static |
Helper function for data type registration.