16 #ifndef ACSDKMANUFACTORY_INTERNAL_RUNTIMEMANUFACTORY_IMP_H_ 17 #define ACSDKMANUFACTORY_INTERNAL_RUNTIMEMANUFACTORY_IMP_H_ 26 namespace acsdkManufactory {
30 m_cookBook->doRequiredGets(*
this);
33 template <
typename Type>
35 Type* TypedPointer =
nullptr;
36 return innerGet(TypedPointer);
39 template <
typename Type>
40 inline std::unique_ptr<Type> RuntimeManufactory::innerGet(std::unique_ptr<Type>*) {
41 return m_cookBook->createUniquePointer<
Type>(*this);
44 template <
typename Type>
45 inline std::shared_ptr<Type> RuntimeManufactory::innerGet(std::shared_ptr<Type>*) {
46 using ResultType = std::shared_ptr<Type>;
49 auto resultTypeIndex = avsCommon::utils::getTypeIndex<ResultType>();
51 auto it = m_values.find(resultTypeIndex);
52 if (m_values.end() == it || !it->second) {
53 std::shared_ptr<AbstractPointerCache> cache(
std::move(m_cookBook->createPointerCache<ResultType>()));
54 m_values[resultTypeIndex] = cache;
55 ret = *
static_cast<ResultType*
>(cache->get(*
this));
59 ret = *
static_cast<ResultType*
>(cache->get(*
this));
66 template <
typename Annotation,
typename Type>
71 auto resultTypeIndex = avsCommon::utils::getTypeIndex<ResultType>();
73 auto it = m_values.find(resultTypeIndex);
74 if (m_values.end() == it || !it->second) {
75 std::shared_ptr<AbstractPointerCache> cache(
std::move(m_cookBook->createPointerCache<ResultType>()));
76 m_values[resultTypeIndex] = cache;
77 ret = *
static_cast<std::shared_ptr<Type>*
>(cache->get(*
this));
81 ret = *
static_cast<std::shared_ptr<Type>*
>(cache->get(*
this));
92 #endif // ACSDKMANUFACTORY_INTERNAL_RUNTIMEMANUFACTORY_IMP_H_ RuntimeManufactory(const CookBook &cookBook)
Definition: RuntimeManufactory_imp.h:29
Definition: CookBook.h:42
Type get()
Definition: RuntimeManufactory_imp.h:34
Definition: Annotated.h:35
Definition: AbstractPointerCache.h:29
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Type
Definition: Type.h:26
const T & move(const T &t)
Definition: gtest-port.h:1317