AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Utils.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 ACSDK_SDKCLIENT_INCLUDE_ACSDK_SDKCLIENT_INTERNAL_UTILS_H_
17 #define ACSDK_SDKCLIENT_INCLUDE_ACSDK_SDKCLIENT_INTERNAL_UTILS_H_
18 
20 
21 namespace alexaClientSDK {
22 namespace sdkClient {
23 namespace internal {
26 template <typename T>
28  typedef T type;
29 };
30 
34 template <typename Annotation, typename ComponentType>
35 struct UnderlyingComponentType<Annotated<Annotation, ComponentType>> {
36  typedef ComponentType type;
37 };
38 
43 template <typename T>
45 
50 template <typename T>
51 struct IsSharedPtr<std::shared_ptr<T>> : std::true_type {};
52 
57 template <typename FeatureClientBuilderType>
59  static_assert(
60  std::is_base_of<FeatureClientBuilderInterface, FeatureClientBuilderType>::value,
61  "FeatureClientBuilderInterface must implement FeatureClientBuilderInterface");
62 
63  static_assert(
64  internal::IsSharedPtr<typename std::result_of<decltype (&FeatureClientBuilderType::construct)(
65  FeatureClientBuilderType, const std::shared_ptr<SDKClientRegistry>&)>::type>::value,
66  "FeatureClientBuilder must define a construct(const std::shared_ptr<SDKClientRegistry>&) method which returns "
67  "a shared_ptr");
68 
69  static_assert(
70  std::is_base_of<
72  typename std::result_of<decltype (&FeatureClientBuilderType::construct)(
73  FeatureClientBuilderType, const std::shared_ptr<SDKClientRegistry>&)>::type::element_type>::value,
74  "FeatureClientBuilder construct method must return a shared_ptr to a FeatureClientInterface implementation");
75 }
76 
77 } // namespace internal
78 } // namespace sdkClient
79 } // namespace alexaClientSDK
80 #endif // ACSDK_SDKCLIENT_INCLUDE_ACSDK_SDKCLIENT_INTERNAL_UTILS_H_
ACSDK_INLINE_VISIBILITY void AssertFeatureClientBuilderTypeIsValid()
Definition: Utils.h:58
Definition: CapabilityConfiguration.h:190
bool_constant< true > true_type
Definition: gtest-port.h:2210
Definition: Annotated.h:37
bool_constant< false > false_type
Definition: gtest-port.h:2209
Definition: FeatureClientInterface.h:37
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
#define ACSDK_INLINE_VISIBILITY
Compiler-specific macro for inline-only methods.
Definition: PlatformDefinitions.h:116

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