AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AbstractRecipe.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKMANUFACTORY_INTERNAL_ABSTRACTRECIPE_H_
17 #define ACSDKMANUFACTORY_INTERNAL_ABSTRACTRECIPE_H_
18 
20 
21 namespace alexaClientSDK {
22 namespace acsdkManufactory {
23 namespace internal {
24 
26 class RuntimeManufactory;
27 
32 public:
47  void* (*)(std::shared_ptr<AbstractRecipe> recipe, RuntimeManufactory& runtimeManufactory, void* cachedValue);
48 
54  using DeleteInstanceFunction = void (*)(void*);
55 
59  enum RecipeType {
66  };
67 
85  };
86 
90  virtual ~AbstractRecipe() = default;
91 
99  virtual bool isEquivalent(const std::shared_ptr<AbstractRecipe>& recipe) const = 0;
100 
106  RecipeType getRecipeType() const;
107 
114 
120 
126 
132  std::vector<avsCommon::utils::TypeIndex>::const_iterator begin() const;
133 
139  std::vector<avsCommon::utils::TypeIndex>::const_iterator end() const;
140 
141 protected:
143  std::vector<avsCommon::utils::TypeIndex> m_dependencies;
144 
147 
150 
153 
156 };
157 
159  return m_recipeType;
160 }
161 
163  return m_objectLifecycle;
164 }
165 
167  return m_produceFunction;
168 }
169 
171  return m_deleteFunction;
172 }
173 
174 inline std::vector<avsCommon::utils::TypeIndex>::const_iterator AbstractRecipe::begin() const {
175  return m_dependencies.begin();
176 }
177 
178 inline std::vector<avsCommon::utils::TypeIndex>::const_iterator AbstractRecipe::end() const {
179  return m_dependencies.end();
180 }
181 
182 } // namespace internal
183 } // namespace acsdkManufactory
184 } // namespace alexaClientSDK
185 
186 #endif // ACSDKMANUFACTORY_INTERNAL_ABSTRACTRECIPE_H_
std::vector< avsCommon::utils::TypeIndex > m_dependencies
Vector enumerating the dependencies of the interface this AbstractRecipe creates. ...
Definition: AbstractRecipe.h:143
A recipe whose means to produce the object is a pre-made object.
Definition: AbstractRecipe.h:65
A recipe added by addRetainedFactory will produce an object cached with a std::shared_ptr.
Definition: AbstractRecipe.h:78
virtual bool isEquivalent(const std::shared_ptr< AbstractRecipe > &recipe) const =0
DeleteInstanceFunction getDeleteInstanceFunction() const
Definition: AbstractRecipe.h:170
A recipe added by addRequiredFactory will produce an object cached with a std::shared_ptr.
Definition: AbstractRecipe.h:80
CachedInstanceLifecycle getLifecycle() const
Definition: AbstractRecipe.h:162
std::vector< avsCommon::utils::TypeIndex >::const_iterator begin() const
Definition: AbstractRecipe.h:174
A recipe whose means to produce the object is a function pointer.
Definition: AbstractRecipe.h:61
A recipe whose means to produce the object is a std::function.
Definition: AbstractRecipe.h:63
A recipe added by addInstance will cache the pre-made instance with a std::shared_ptr.
Definition: AbstractRecipe.h:74
DeleteInstanceFunction m_deleteFunction
Function pointer that can delete a cached value of this type.
Definition: AbstractRecipe.h:149
RecipeType getRecipeType() const
Definition: AbstractRecipe.h:158
RecipeType m_recipeType
The RecipeType of this recipe.
Definition: AbstractRecipe.h:152
void(*)(void *) DeleteInstanceFunction
Definition: AbstractRecipe.h:54
A recipe added by addPrimaryFactory will produce an object cached with a std::shared_ptr.
Definition: AbstractRecipe.h:76
A recipe added by addUniqueFactory will produce a new instance every time, and never cache them...
Definition: AbstractRecipe.h:82
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
CachedInstanceLifecycle m_objectLifecycle
The CachedInstanceLifecycle of a cached instance of this Type.
Definition: AbstractRecipe.h:155
ProduceInstanceFunction m_produceFunction
Function pointer that can produce an instance of this type.
Definition: AbstractRecipe.h:146
A recipe added by addUnloadableFactory will produce an object cached with a std::weak_ptr.
Definition: AbstractRecipe.h:84
ProduceInstanceFunction getProduceInstanceFunction() const
Definition: AbstractRecipe.h:166
void *(*)(std::shared_ptr< AbstractRecipe > recipe, RuntimeManufactory &runtimeManufactory, void *cachedValue) ProduceInstanceFunction
Definition: AbstractRecipe.h:47
std::vector< avsCommon::utils::TypeIndex >::const_iterator end() const
Definition: AbstractRecipe.h:178

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0