AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
TypeRegistry.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_TYPEREGISTRY_H_
17 #define ACSDK_SDKCLIENT_INCLUDE_ACSDK_SDKCLIENT_INTERNAL_TYPEREGISTRY_H_
18 
19 #include <unordered_set>
20 
23 
24 namespace alexaClientSDK {
25 namespace sdkClient {
26 namespace internal {
30 class TypeRegistry {
31 public:
36  template <typename ComponentType>
38  m_types.insert(avsCommon::utils::getTypeIndex<ComponentType>());
39  }
40 
45  void addTypeIndex(const avsCommon::utils::TypeIndex& typeIndex);
46 
51  template <typename ComponentType>
53  m_types.erase(avsCommon::utils::getTypeIndex<ComponentType>());
54  }
55 
60  bool empty() const;
61 
67  TypeRegistry typeDifference(const TypeRegistry& other) const;
68 
74  bool typeDifferenceIsEmpty(const TypeRegistry& other) const;
75 
81  void outputToStream(std::ostream& stream) const;
82 
88  std::string toString() const;
89 
91  using const_iterator = std::unordered_set<avsCommon::utils::TypeIndex>::const_iterator;
92 
97  const_iterator cbegin() const;
98 
103  const_iterator cend() const;
104 
105 private:
107  std::unordered_set<avsCommon::utils::TypeIndex> m_types;
108 };
109 
117 inline std::ostream& operator<<(std::ostream& stream, const TypeRegistry& typeRegistry) {
118  typeRegistry.outputToStream(stream);
119  return stream;
120 }
121 } // namespace internal
122 } // namespace sdkClient
123 } // namespace alexaClientSDK
124 #endif // ACSDK_SDKCLIENT_INCLUDE_ACSDK_SDKCLIENT_INTERNAL_TYPEREGISTRY_H_
void outputToStream(std::ostream &stream) const
::std::string string
Definition: gtest-port.h:1097
bool typeDifferenceIsEmpty(const TypeRegistry &other) const
TypeRegistry typeDifference(const TypeRegistry &other) const
std::unordered_set< avsCommon::utils::TypeIndex >::const_iterator const_iterator
type alias for const_iterator, no order is guaranteed
Definition: TypeRegistry.h:91
std::ostream & operator<<(std::ostream &stream, const TypeRegistry &typeRegistry)
Definition: TypeRegistry.h:117
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
ACSDK_INLINE_VISIBILITY void removeType()
Definition: TypeRegistry.h:52
#define ACSDK_INLINE_VISIBILITY
Compiler-specific macro for inline-only methods.
Definition: PlatformDefinitions.h:116
ACSDK_INLINE_VISIBILITY void addType()
Definition: TypeRegistry.h:37
void addTypeIndex(const avsCommon::utils::TypeIndex &typeIndex)

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