AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAssets::client::ArtifactWrapper Class Reference

#include <ArtifactWrapper.h>

Inheritance diagram for alexaClientSDK::acsdkAssets::client::ArtifactWrapper:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAssets::client::ArtifactWrapper:
Collaboration graph
[legend]

Public Member Functions

 ~ArtifactWrapper () override=default
 
bool operator== (const ArtifactWrapper &rhs) const
 
bool operator!= (const ArtifactWrapper &rhs) const
 
std::string name () const override
 
bool download () const override
 
bool isAvailable () const override
 
bool isPending () const override
 
std::shared_ptr< commonInterfaces::ArtifactRequestgetRequest () const override
 
std::string getPath () const override
 
commonInterfaces::Priority getPriority () const override
 
bool setPriority (commonInterfaces::Priority priority) override
 
void erase () override
 
void addWeakPtrObserver (const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Add a weak reference to an observer. More...
 
void removeWeakPtrObserver (const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Remove an observer. More...
 
- Public Member Functions inherited from alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface
virtual ~ArtifactWrapperInterface ()=default
 
virtual void addWeakPtrObserver (const std::weak_ptr< ArtifactChangeObserver > &observer)=0
 
virtual void removeWeakPtrObserver (const std::weak_ptr< ArtifactChangeObserver > &observer)=0
 
- Public Member Functions inherited from alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >
 Notifier ()
 
void addObserver (const std::shared_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Add an observer. More...
 
void removeObserver (const std::shared_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Remove an observer. More...
 
void addWeakPtrObserver (const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Add a weak reference to an observer. More...
 
void removeWeakPtrObserver (const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &observer) override
 Remove an observer. More...
 
void notifyObservers (std::function< void(const std::shared_ptr< clientInterfaces::ArtifactChangeObserver > &)> notify) override
 Notify the observers in the order that they were added. More...
 
bool notifyObserversInReverse (std::function< void(const std::shared_ptr< clientInterfaces::ArtifactChangeObserver > &)> notify) override
 Notify the observers in the reverse order that they were added. More...
 
void setAddObserverFunction (std::function< void(const std::shared_ptr< clientInterfaces::ArtifactChangeObserver > &)> addObserverFunc) override
 Set a function for notifications on an observer additions. More...
 
- Public Member Functions inherited from alexaClientSDK::notifierInterfaces::NotifierInterface< clientInterfaces::ArtifactChangeObserver >
virtual ~NotifierInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< int >
virtual ~CommunicationPropertyChangeSubscriber ()=default
 
- Public Member Functions inherited from alexaClientSDK::acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< std::string >
virtual ~CommunicationPropertyChangeSubscriber ()=default
 

Static Public Member Functions

static std::shared_ptr< ArtifactWrappercreate (const std::shared_ptr< commonInterfaces::AmdCommunicationInterface > &amdComm, const std::shared_ptr< commonInterfaces::ArtifactRequest > &request, const std::shared_ptr< clientInterfaces::ArtifactUpdateValidator > &updateValidator=nullptr)
 

Detailed Description

This class provides a mechanism for controlling artifacts in asset manager through aipc.

Constructor & Destructor Documentation

◆ ~ArtifactWrapper()

alexaClientSDK::acsdkAssets::client::ArtifactWrapper::~ArtifactWrapper ( )
overridedefault

Member Function Documentation

◆ addWeakPtrObserver()

void alexaClientSDK::acsdkAssets::client::ArtifactWrapper::addWeakPtrObserver ( const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &  observer)
inlineoverridevirtual

Add a weak reference to an observer.

Method adds a weak reference to observer. If the same observer has already been added as a strong or weak reference, the method does nothing.

If the observer function has been installed prior to this call, it will be invoked with the newly added observer.

Parameters
[in]observerThe observer to add. If observer is nullptr, the method does nothing.
Note
Lifecycle of observer will not be managed by the Notifier. If observer object is expired, then no callback will be called to that object.

Implements alexaClientSDK::notifierInterfaces::NotifierInterface< clientInterfaces::ArtifactChangeObserver >.

◆ create()

static std::shared_ptr<ArtifactWrapper> alexaClientSDK::acsdkAssets::client::ArtifactWrapper::create ( const std::shared_ptr< commonInterfaces::AmdCommunicationInterface > &  amdComm,
const std::shared_ptr< commonInterfaces::ArtifactRequest > &  request,
const std::shared_ptr< clientInterfaces::ArtifactUpdateValidator > &  updateValidator = nullptr 
)
static

Creates an artifact wrapper and request a download and creation on asset manager side. If the creation was successful or if the artifact already existed on asset manager, then this will return a valid artifact wrapper to manage that artifact.

Parameters
aipcWrapperREQUIRED, for aipc communication with asset manager
requestREQUIRED, to uniquely identify the artifact to download or use.
updateValidatorOPTIONAL, if none is provided, then the update will always be applied. Otherwise, the validator will be used to confirm that the new artifact is valid and should be applied.
Returns
NULLABLE, a smart pointer to an artifact wrapper if successfully registered, null otherwise.

◆ download()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::download ( ) const
overridevirtual

Requests the download of the artifact referenced by this wrapper if not already downloaded or downloading.

Returns
true if the request was submitted successfully, false otherwise.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ erase()

void alexaClientSDK::acsdkAssets::client::ArtifactWrapper::erase ( )
overridevirtual

Requests the removal and cleanup of the given artifact.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ getPath()

std::string alexaClientSDK::acsdkAssets::client::ArtifactWrapper::getPath ( ) const
overridevirtual
Returns
the path where to find the artifact on disk using aipc.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ getPriority()

commonInterfaces::Priority alexaClientSDK::acsdkAssets::client::ArtifactWrapper::getPriority ( ) const
overridevirtual
Returns
gets the current artifact priority using aipc.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ getRequest()

std::shared_ptr<commonInterfaces::ArtifactRequest> alexaClientSDK::acsdkAssets::client::ArtifactWrapper::getRequest ( ) const
inlineoverridevirtual
Returns
the request used to identify this artifact.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ isAvailable()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::isAvailable ( ) const
inlineoverridevirtual
Returns
true if the artifact is already downloaded and ready.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ isPending()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::isPending ( ) const
inlineoverridevirtual
Returns
if the artifact is being created, requested, or downloading.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ name()

std::string alexaClientSDK::acsdkAssets::client::ArtifactWrapper::name ( ) const
inlineoverridevirtual
Returns
unique name identifying this artifact wrapper.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.

◆ operator!=()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::operator!= ( const ArtifactWrapper rhs) const
inline

◆ operator==()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::operator== ( const ArtifactWrapper rhs) const
inline

◆ removeWeakPtrObserver()

void alexaClientSDK::acsdkAssets::client::ArtifactWrapper::removeWeakPtrObserver ( const std::weak_ptr< clientInterfaces::ArtifactChangeObserver > &  observer)
inlineoverridevirtual

Remove an observer.

Method removes a strong or weak reference to observer. If the class doesn't have a strong or weak reference to observer, the method does nothing.

Parameters
[in]observerThe observer to remove. If observer is nullptr, the method does nothing.

Implements alexaClientSDK::notifierInterfaces::NotifierInterface< clientInterfaces::ArtifactChangeObserver >.

◆ setPriority()

bool alexaClientSDK::acsdkAssets::client::ArtifactWrapper::setPriority ( commonInterfaces::Priority  priority)
overridevirtual

Sets the priority accordingly.

Returns
true if successful, false otherwise.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactWrapperInterface.


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