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

#include <WeakPointerCache.h>

Inheritance diagram for alexaClientSDK::acsdkManufactory::internal::WeakPointerCache:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkManufactory::internal::WeakPointerCache:
Collaboration graph
[legend]

Public Member Functions

 WeakPointerCache (std::shared_ptr< AbstractRecipe > recipe)
 
 ~WeakPointerCache ()
 
AbstractPointerCache methods.
void * get (RuntimeManufactory &runtimeManufactory) override
 
void cleanup () override
 
- Public Member Functions inherited from alexaClientSDK::acsdkManufactory::internal::AbstractPointerCache
virtual ~AbstractPointerCache ()=default
 

Detailed Description

Class used to cache a weak_ptr to an instance.

Constructor & Destructor Documentation

◆ WeakPointerCache()

alexaClientSDK::acsdkManufactory::internal::WeakPointerCache::WeakPointerCache ( std::shared_ptr< AbstractRecipe recipe)

Constructor.

Parameters
recipeThe recipe that contains information on the means of producing an instance.

◆ ~WeakPointerCache()

alexaClientSDK::acsdkManufactory::internal::WeakPointerCache::~WeakPointerCache ( )

Destructor.

Member Function Documentation

◆ cleanup()

void alexaClientSDK::acsdkManufactory::internal::WeakPointerCache::cleanup ( )
overridevirtual

Release any unneeded references in the cache after calling get().

Note
If get() is called without calling cleanup() afterwards, that may result in memory leaks.

Implements alexaClientSDK::acsdkManufactory::internal::AbstractPointerCache.

◆ get()

void* alexaClientSDK::acsdkManufactory::internal::WeakPointerCache::get ( RuntimeManufactory runtimeManufactory)
overridevirtual

Get the instance from the cache.

Parameters
runtimeManufactoryThe RuntimeManufactory to use to acquire an instance if the cache is empty.
Returns
A void* to a shared_ptr<Type>. Caller is responsible for casting this to to shared_ptr<Type>*.

Implements alexaClientSDK::acsdkManufactory::internal::AbstractPointerCache.


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