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::SharedPointerCache Class Reference

#include <SharedPointerCache.h>

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

Public Member Functions

 SharedPointerCache (std::shared_ptr< AbstractRecipe > recipe)
 
 ~SharedPointerCache ()
 
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 shared_ptr to an instance.

Constructor & Destructor Documentation

◆ SharedPointerCache()

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

Constructor.

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

◆ ~SharedPointerCache()

alexaClientSDK::acsdkManufactory::internal::SharedPointerCache::~SharedPointerCache ( )

Destructor.

Member Function Documentation

◆ cleanup()

void alexaClientSDK::acsdkManufactory::internal::SharedPointerCache::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::SharedPointerCache::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