AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id > Class Template Reference

#include <SettingCallbackAdapter.h>

Inheritance diagram for alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >:
Collaboration graph
[legend]

Public Types

using ValueType = typename ManagerT::template ValueType< id >
 Setting value type. More...
 
using FunctionType = std::function< void(const ValueType &, SettingNotifications)>
 Callback function value type. More...
 

Public Member Functions

virtual ~SettingCallbackAdapter ()=default
 
Functions from @c SettingCallbackAdapterInterface
bool addToManager (ManagerT &manager) override
 
void removeFromManager (ManagerT &manager) override
 
- Public Member Functions inherited from alexaClientSDK::settings::SettingCallbackAdapterInterface< ManagerT >
virtual ~SettingCallbackAdapterInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< SettingCallbackAdaptercreate (FunctionType callback)
 

Detailed Description

template<typename ManagerT, size_t id>
class alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >

A SettingCallbackAdapter can be used to register callback functions called when there is a setting notification.

This is an example of how to use this adapter.

MyClass(std::shared_ptr<DeviceSettingsManager> manager) : m_manager {manager} {
// do something.
});
m_adapter->addToManager(*m_manager);
}
~MyClass() {
m_adapter->removeFromManager(*m_manager);
}
Template Parameters
ManagerTThe setting manager type that this callback will be added to.
idThe id of the setting inside the manager.

Member Typedef Documentation

◆ FunctionType

template<typename ManagerT , size_t id>
using alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::FunctionType = std::function<void(const ValueType&, SettingNotifications)>

Callback function value type.

◆ ValueType

template<typename ManagerT , size_t id>
using alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::ValueType = typename ManagerT::template ValueType<id>

Setting value type.

Constructor & Destructor Documentation

◆ ~SettingCallbackAdapter()

template<typename ManagerT , size_t id>
virtual alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::~SettingCallbackAdapter ( )
virtualdefault

The virtual destructor.

Member Function Documentation

◆ addToManager()

template<typename ManagerT , size_t id>
bool alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::addToManager ( ManagerT &  manager)
overridevirtual

Add callback to the given manager.

Parameters
managerManager that has the setting to be observed.
Returns
true if it succeeds; otherwise.

The template keyword is required because addObserver definition depends on ManagerT.

Implements alexaClientSDK::settings::SettingCallbackAdapterInterface< ManagerT >.

◆ create()

template<typename ManagerT , size_t id>
std::shared_ptr< SettingCallbackAdapter< ManagerT, id > > alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::create ( SettingCallbackAdapter< ManagerT, id >::FunctionType  callback)
static

Creates a SettingCallbackAdapter object.

Parameters
callbackThe function callback that should be called upon notification.

◆ removeFromManager()

template<typename ManagerT , size_t id>
void alexaClientSDK::settings::SettingCallbackAdapter< ManagerT, id >::removeFromManager ( ManagerT &  manager)
overridevirtual

Remove callback from the given manager.

Parameters
managerManager that has the setting that was being observed.

The template keyword is required because removeObserver definition depends on ManagerT.

Implements alexaClientSDK::settings::SettingCallbackAdapterInterface< ManagerT >.


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

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