![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <CookBook.h>
Public Member Functions | |
CookBook () | |
template<typename Type , typename... Dependencies> | |
CookBook & | addUniqueFactory (std::function< std::unique_ptr< Type >(Dependencies...)> factory) |
template<typename Type , typename... Dependencies> | |
CookBook & | addUniqueFactory (std::unique_ptr< Type >(*factory)(Dependencies...)) |
template<typename Type , typename... Dependencies> | |
CookBook & | addPrimaryFactory (std::function< std::shared_ptr< Type >(Dependencies...)> factory) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addPrimaryFactory (std::function< Annotated< Annotation, Type >(Dependencies...)> factory) |
template<typename Type , typename... Dependencies> | |
CookBook & | addPrimaryFactory (std::shared_ptr< Type >(*factory)(Dependencies...)) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addPrimaryFactory (Annotated< Annotation, Type >(*factory)(Dependencies...)) |
template<typename Type , typename... Dependencies> | |
CookBook & | addRequiredFactory (std::function< std::shared_ptr< Type >(Dependencies...)> factory) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addRequiredFactory (std::function< Annotated< Annotation, Type >(Dependencies...)> factory) |
template<typename Type , typename... Dependencies> | |
CookBook & | addRequiredFactory (std::shared_ptr< Type >(*factory)(Dependencies...)) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addRequiredFactory (Annotated< Annotation, Type >(*factory)(Dependencies...)) |
template<typename Type , typename... Dependencies> | |
CookBook & | addRetainedFactory (std::function< std::shared_ptr< Type >(Dependencies...)> factory) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addRetainedFactory (std::function< Annotated< Annotation, Type >(Dependencies...)> factory) |
template<typename Type , typename... Dependencies> | |
CookBook & | addRetainedFactory (std::shared_ptr< Type >(*factory)(Dependencies...)) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addRetainedFactory (Annotated< Annotation, Type >(*factory)(Dependencies...)) |
template<typename Type , typename... Dependencies> | |
CookBook & | addUnloadableFactory (std::function< std::shared_ptr< Type >(Dependencies...)> factory) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addUnloadableFactory (std::function< Annotated< Annotation, Type >(Dependencies...)> factory) |
template<typename Type , typename... Dependencies> | |
CookBook & | addUnloadableFactory (std::shared_ptr< Type >(*factory)(Dependencies...)) |
template<typename Annotation , typename Type , typename... Dependencies> | |
CookBook & | addUnloadableFactory (Annotated< Annotation, Type >(*factory)(Dependencies...)) |
template<typename Type > | |
CookBook & | addInstance (const Type &instance) |
CookBook & | addCookBook (const CookBook &cookBook) |
bool | checkCompleteness () |
bool | doRequiredGets (RuntimeManufactory &runtimeManufactory) |
template<typename Type > | |
std::unique_ptr< Type > | createUniquePointer (RuntimeManufactory &runtimeManufactory) |
template<typename Type > | |
std::unique_ptr< AbstractPointerCache > | createPointerCache () |
CookBook is a collection of recipes for creating instances.
|
inline |
Constructor.
|
inline |
|
inline |
Declare support for providing instances of an type from an already existing instance. Such instances are assumed to be "retained" for the lifecycle of this CookBook
.
Type | The type of interface supported. |
instance | The instance to be served up. |
CookBook
instance, with the added factory.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a primary
value (i.e. a value that must always be instantiated before all others). If multiple 'primary' factories are added, they will be instantiated in an arbitrary order - other than that required by any dependencies.
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a primary
value (i.e. a value that must always be instantiated before all others). If multiple 'primary' factories are added, they will be instantiated in an arbitrary order - other than that required by any dependencies.
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a primary
value (i.e. a value that must always be instantiated before all others). If multiple 'primary' factories are added, they will be instantiated in an arbitrary order - other than that required by any dependencies.
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a primary
value (i.e. a value that must always be instantiated before all others). If multiple 'primary' factories are added, they will be instantiated in an arbitrary order - other than that required by any dependencies.
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a required
value (i.e. a value that must always be instantiated).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a required
value (i.e. a value that must always be instantiated).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a required
value (i.e. a value that must always be instantiated).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a required
value (i.e. a value that must always be instantiated).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a retained
value (i.e. a value that must be retained once instantiated).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a retained
value (i.e. a value that must be retained once instantiated).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to a retained
value (i.e. a value that must be retained once instantiated).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to a retained
value (i.e. a value that must be retained once instantiated).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::unique_ptr
value.
Type | The full type (including std::unique_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::unique_ptr
value.
Type | The full type (including std::unique_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to an unloadable
value (i.e. a value that may be released when no longer referenced).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to an unloadable
value (i.e. a value that may be released when no longer referenced).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a std::shared_ptr<>
to an unloadable
value (i.e. a value that may be released when no longer referenced).
Type | The full type (including std::shared_ptr<>) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
Add a factory that returns a Annotated<>
pointer to an unloadable
value (i.e. a value that may be released when no longer referenced).
Annotation | The type used to differentiate the returned instance of Type . |
Type | The full type (including Annotated) returned by the factory. |
Dependencies | The dependencies (arguments) of the factory to be added. |
factory | The factory to be added. |
CookBook
.
|
inline |
|
inline |
Create a PointerCache<Type>
for the specified Type.
Type | The Type of object to be cached. |
PointerCache<Type>
instance.
|
inline |
Create a new instance Type
and return it via std::unique_ptr<>
.
Type | The type of value to instantiate. |
runtimeManufactory | The RuntimeManufactory to use to acquire dependencies of the new instance. |
std::unique_ptr<Type>
to the new instance of Type. createUniquePointer() returns a void* to a std::unique_ptr<Type> created on the heap. The following ensures that we retain the object, but delete the temporary std::unique_ptr pointed to by the void* before returning a std::unique_ptr to the object.
Cast the void* to a std::unique_ptr<Type>*.
Move the object from the underlying temporary std::unique_ptr on the heap. Now *temporaryPointerToUniquePointerOnHeap no longer owns the object.
Delete the temporary std::unique_ptr created on the heap. Without this, there is a memory leak.
|
inline |
Perform get<Type>() for each Required<Type> registered with this CookBook.
runtimeManufactory | The RuntimeManufactory from which to retrieve the Required<Type>s and any of their dependencies. |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0