AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes > Class Template Referenceabstract

#include <CommunicationInvokeHandlerInterface.h>

Public Member Functions

virtual ~CommunicationInvokeHandlerInterface ()=default
 
virtual bool registerFunction (const std::string &name, std::shared_ptr< FunctionInvokerInterface< ReturnType, ArgTypes... >> functionImplementation)=0
 
virtual alexaClientSDK::avsCommon::utils::error::SuccessResult< ReturnType > invoke (const std::string &name, ArgTypes...)=0
 
virtual bool deregister (const std::string &name, const std::shared_ptr< FunctionInvokerInterface< ReturnType, ArgTypes... >> &functionImplementation)=0
 

Detailed Description

template<typename ReturnType, typename... ArgTypes>
class alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes >

The CommunicationInvokeHandlerInterface is used to register, deregister, and invoke functions from another component with only a link to the CommunicationInvokeHandler. The implementation of this interface is not responsible for keeping FunctionInvokerInterface implementations alive.

Constructor & Destructor Documentation

◆ ~CommunicationInvokeHandlerInterface()

template<typename ReturnType, typename... ArgTypes>
virtual alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes >::~CommunicationInvokeHandlerInterface ( )
virtualdefault

Virtual destructor to assure proper cleanup of derived types.

Member Function Documentation

◆ deregister()

template<typename ReturnType, typename... ArgTypes>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes >::deregister ( const std::string &  name,
const std::shared_ptr< FunctionInvokerInterface< ReturnType, ArgTypes... >> &  functionImplementation 
)
pure virtual

Deregister the function

Parameters
nameThe name of the function to deregister
functionImplementationThe function that we are deregistering. Used for confirmation of ownership.
Returns
true if deregister succeeds, false otherwise

◆ invoke()

template<typename ReturnType, typename... ArgTypes>
virtual alexaClientSDK::avsCommon::utils::error::SuccessResult<ReturnType> alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes >::invoke ( const std::string &  name,
ArgTypes...   
)
pure virtual

Invokes the registered function specified by the name. If the function isn't registered or the function has expired nothing will be invoked.

Parameters
nameThe name of the function
ArgsThe args that will be passed to the function.
Returns
SuccessResult<ReturnType> if the callback succeeds or not. If successful the return value.

◆ registerFunction()

template<typename ReturnType, typename... ArgTypes>
virtual bool alexaClientSDK::acsdkCommunicationInterfaces::CommunicationInvokeHandlerInterface< ReturnType, ArgTypes >::registerFunction ( const std::string &  name,
std::shared_ptr< FunctionInvokerInterface< ReturnType, ArgTypes... >>  functionImplementation 
)
pure virtual

Register a new function that other components can trigger with the CommunicationInvokeHandlerInterface

Parameters
nameThe name of the function.
functionImplementationThe class that implements functionToBeInvoked
Returns
true if succeeds, false otherwise

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