AlexaClientSDK
1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <Notifier.h>
Public Member Functions | |
Notifier () | |
NotifierInterface methods | |
void | addObserver (const std::shared_ptr< ObserverType > &observer) override |
void | removeObserver (const std::shared_ptr< ObserverType > &observer) override |
void | addWeakPtrObserver (const std::weak_ptr< ObserverType > &observer) override |
void | removeWeakPtrObserver (const std::weak_ptr< ObserverType > &observer) override |
void | notifyObservers (std::function< void(const std::shared_ptr< ObserverType > &)> notify) override |
bool | notifyObserversInReverse (std::function< void(const std::shared_ptr< ObserverType > &)> notify) override |
void | setAddObserverFunction (std::function< void(const std::shared_ptr< ObserverType > &)> addObserverFunc) override |
Public Member Functions inherited from alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType > | |
virtual | ~NotifierInterface ()=default |
Notifier maintains a set of observers that are notified with a caller defined function.
ObserverType | The type of observer notified by the template instantiation. |
|
inline |
Constructor.
|
inlineoverridevirtual |
Add an observer. Duplicate additions are ignored.
observer | The observer to add. |
Notifier
will no longer maintain the life cycle of its observers
. Please start using the new addWeakPtrObserver()
API instead. Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Add an observer with weak_ptr. Duplicate additions are ignored.
observer | The observer to add. |
Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Notify the observers in the order that they were added.
notify | The function to invoke to notify an observer. |
Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Notify the observers in the reverse order that they were added.
notify | The function to invoke to notify an observer. |
Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Remove an observer. Invalid requests (nullptr or non member observers) are ignored.
observer | The observer to remove. |
Notifier
will no longer maintain the life cycle of its observers
. Please start using the new removeWeakPtrObserver()
API instead. Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Remove an observer with weak_ptr. Invalid requests (nullptr or non member observers) are ignored.
observer | The observer to remove. |
Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
|
inlineoverridevirtual |
Set the function to be called after an observer is added (for example, to notify the newly-added observer of the current state).
If there's any observers that were added before setAddObserverFunction
is called, those added observers will be notified as well.
@warn Use caution when setting this function. The function MUST be reentrant, or else you run the risk of deadlock. When an observer adds itself to a NotifierInterface
, this function will be called in the same context.
postAddFunc | The function to call after an observer is added. |
Implements alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >.
AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0