AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType > Class Template Referenceabstract

#include <NotifierInterface.h>

Inheritance diagram for alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >:
Inheritance graph
[legend]

Public Member Functions

virtual ~NotifierInterface ()=default
 
virtual void addObserver (const std::shared_ptr< ObserverType > &observer)=0
 
virtual void removeObserver (const std::shared_ptr< ObserverType > &observer)=0
 
virtual void addWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0
 
virtual void removeWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0
 
virtual void notifyObservers (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0
 
virtual bool notifyObserversInReverse (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0
 
virtual void setAddObserverFunction (std::function< void(const std::shared_ptr< ObserverType > &)> postAddFunc)=0
 

Detailed Description

template<typename ObserverType>
class alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >

Interface for maintains a set of observers that are notified with a caller defined function.

Template Parameters
ObserverTypeThe type of observer notified by the template instantiation.

Constructor & Destructor Documentation

◆ ~NotifierInterface()

template<typename ObserverType >
virtual alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::~NotifierInterface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addObserver()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::addObserver ( const std::shared_ptr< ObserverType > &  observer)
pure virtual

Add an observer. Duplicate additions are ignored.

Parameters
observerThe observer to add.
Deprecated:
In the future, Notifier will no longer maintain the life cycle of its observers. Please start using the new addWeakPtrObserver() API instead.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ addWeakPtrObserver()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::addWeakPtrObserver ( const std::weak_ptr< ObserverType > &  observer)
pure virtual

Add an observer with weak_ptr. Duplicate additions are ignored.

Parameters
observerThe observer to add.
Note
Lifecycle of the observer will not be managed by the Notifier. If the observer object is expired, then no callback will be called to that object.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ notifyObservers()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::notifyObservers ( std::function< void(const std::shared_ptr< ObserverType > &)>  notify)
pure virtual

Notify the observers in the order that they were added.

Parameters
notifyThe function to invoke to notify an observer.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ notifyObserversInReverse()

template<typename ObserverType >
virtual bool alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::notifyObserversInReverse ( std::function< void(const std::shared_ptr< ObserverType > &)>  notify)
pure virtual

Notify the observers in the reverse order that they were added.

Parameters
notifyThe function to invoke to notify an observer.
Returns
true if (and only if) all observers were notified (observers added during calls to this method will miss out).

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ removeObserver()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::removeObserver ( const std::shared_ptr< ObserverType > &  observer)
pure virtual

Remove an observer. Invalid requests (nullptr or non member observers) are ignored.

Parameters
observerThe observer to remove.
Deprecated:
In the future, Notifier will no longer maintain the life cycle of its observers. Please start using the new removeWeakPtrObserver() API instead.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ removeWeakPtrObserver()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::removeWeakPtrObserver ( const std::weak_ptr< ObserverType > &  observer)
pure virtual

Remove an observer with weak_ptr. Invalid requests (nullptr or non member observers) are ignored.

Parameters
observerThe observer to remove.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.

◆ setAddObserverFunction()

template<typename ObserverType >
virtual void alexaClientSDK::acsdkNotifierInterfaces::NotifierInterface< ObserverType >::setAddObserverFunction ( std::function< void(const std::shared_ptr< ObserverType > &)>  postAddFunc)
pure virtual

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.

Parameters
postAddFuncThe function to call after an observer is added.

Implemented in alexaClientSDK::acsdkNotifier::Notifier< registrationManager::RegistrationObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< ObserverType >, alexaClientSDK::acsdkNotifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::acsdkNotifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkInteractionModelInterfaces::InteractionModelRequestProcessingObserverInterface >, alexaClientSDK::acsdkNotifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, and alexaClientSDK::acsdkNotifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.


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

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0