1 /*
2  * This file is auto-generated.  DO NOT MODIFY.
3  * Using: out/host/linux-x86/bin/aidl --lang=ndk -Weverything -Wno-missing-permission-annotation --structured --version 4 --hash notfrozen -t --stability vintf --min_sdk_version 33 --previous_api_dir=hardware/interfaces/contexthub/aidl/aidl_api/android.hardware.contexthub/3 --previous_hash 03f1982c8e20e58494a4ff8c9736b1c257dfeb6c --ninja -d out/soong/.intermediates/hardware/interfaces/contexthub/aidl/android.hardware.contexthub-V4-ndk-source/gen/staging/android/hardware/contexthub/HubInfo.cpp.d -h out/soong/.intermediates/hardware/interfaces/contexthub/aidl/android.hardware.contexthub-V4-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/contexthub/aidl/android.hardware.contexthub-V4-ndk-source/gen/staging -Nhardware/interfaces/contexthub/aidl hardware/interfaces/contexthub/aidl/android/hardware/contexthub/HubInfo.aidl
4  *
5  * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
6  * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
7  * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
8  */
9 #pragma once
10 
11 #include <array>
12 #include <cassert>
13 #include <cstdint>
14 #include <memory>
15 #include <optional>
16 #include <string>
17 #include <type_traits>
18 #include <utility>
19 #include <variant>
20 #include <vector>
21 #include <android/binder_enums.h>
22 #include <android/binder_interface_utils.h>
23 #include <android/binder_parcelable_utils.h>
24 #include <android/binder_to_string.h>
25 #include <aidl/android/hardware/contexthub/ContextHubInfo.h>
26 #include <aidl/android/hardware/contexthub/HubInfo.h>
27 #include <aidl/android/hardware/contexthub/VendorHubInfo.h>
28 #ifdef BINDER_STABILITY_SUPPORT
29 #include <android/binder_stability.h>
30 #endif  // BINDER_STABILITY_SUPPORT
31 
32 #ifndef __BIONIC__
33 #define __assert2(a,b,c,d) ((void)0)
34 #endif
35 
36 namespace aidl::android::hardware::contexthub {
37 class ContextHubInfo;
38 class VendorHubInfo;
39 }  // namespace aidl::android::hardware::contexthub
40 namespace aidl {
41 namespace android {
42 namespace hardware {
43 namespace contexthub {
44 class HubInfo {
45 public:
46   typedef std::false_type fixed_size;
47   static const char* descriptor;
48 
49   class HubDetails {
50   public:
51     typedef std::false_type fixed_size;
52     static const char* descriptor;
53 
54     enum class Tag : int32_t {
55       contextHubInfo = 0,
56       vendorHubInfo = 1,
57     };
58 
59     // Expose tag symbols for legacy code
60     static const inline Tag contextHubInfo = Tag::contextHubInfo;
61     static const inline Tag vendorHubInfo = Tag::vendorHubInfo;
62 
63     template<typename _Tp>
64     static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, HubDetails>;
65 
HubDetails()66     HubDetails() : _value(std::in_place_index<static_cast<size_t>(contextHubInfo)>, ::aidl::android::hardware::contexthub::ContextHubInfo()) { }
67 
68     template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
69     // NOLINTNEXTLINE(google-explicit-constructor)
HubDetails(_Tp && _arg)70     constexpr HubDetails(_Tp&& _arg)
71         : _value(std::forward<_Tp>(_arg)) {}
72 
73     template <size_t _Np, typename... _Tp>
HubDetails(std::in_place_index_t<_Np>,_Tp &&..._args)74     constexpr explicit HubDetails(std::in_place_index_t<_Np>, _Tp&&... _args)
75         : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
76 
77     template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)78     static HubDetails make(_Tp&&... _args) {
79       return HubDetails(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
80     }
81 
82     template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)83     static HubDetails make(std::initializer_list<_Tp> _il, _Up&&... _args) {
84       return HubDetails(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
85     }
86 
getTag()87     Tag getTag() const {
88       return static_cast<Tag>(_value.index());
89     }
90 
91     template <Tag _tag>
get()92     const auto& get() const {
93       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
94       return std::get<static_cast<size_t>(_tag)>(_value);
95     }
96 
97     template <Tag _tag>
get()98     auto& get() {
99       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
100       return std::get<static_cast<size_t>(_tag)>(_value);
101     }
102 
103     template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)104     void set(_Tp&&... _args) {
105       _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
106     }
107 
108     binder_status_t readFromParcel(const AParcel* _parcel);
109     binder_status_t writeToParcel(AParcel* _parcel) const;
110 
111     inline bool operator==(const HubDetails& _rhs) const {
112       return _value == _rhs._value;
113     }
114     inline bool operator<(const HubDetails& _rhs) const {
115       return _value < _rhs._value;
116     }
117     inline bool operator!=(const HubDetails& _rhs) const {
118       return !(*this == _rhs);
119     }
120     inline bool operator>(const HubDetails& _rhs) const {
121       return _rhs < *this;
122     }
123     inline bool operator>=(const HubDetails& _rhs) const {
124       return !(*this < _rhs);
125     }
126     inline bool operator<=(const HubDetails& _rhs) const {
127       return !(_rhs < *this);
128     }
129 
130     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()131     inline std::string toString() const {
132       std::ostringstream os;
133       os << "HubDetails{";
134       switch (getTag()) {
135       case contextHubInfo: os << "contextHubInfo: " << ::android::internal::ToString(get<contextHubInfo>()); break;
136       case vendorHubInfo: os << "vendorHubInfo: " << ::android::internal::ToString(get<vendorHubInfo>()); break;
137       }
138       os << "}";
139       return os.str();
140     }
141   private:
142     std::variant<::aidl::android::hardware::contexthub::ContextHubInfo, ::aidl::android::hardware::contexthub::VendorHubInfo> _value;
143   };
144   int64_t hubId = 0L;
145   ::aidl::android::hardware::contexthub::HubInfo::HubDetails hubDetails;
146 
147   binder_status_t readFromParcel(const AParcel* parcel);
148   binder_status_t writeToParcel(AParcel* parcel) const;
149 
150   inline bool operator==(const HubInfo& _rhs) const {
151     return std::tie(hubId, hubDetails) == std::tie(_rhs.hubId, _rhs.hubDetails);
152   }
153   inline bool operator<(const HubInfo& _rhs) const {
154     return std::tie(hubId, hubDetails) < std::tie(_rhs.hubId, _rhs.hubDetails);
155   }
156   inline bool operator!=(const HubInfo& _rhs) const {
157     return !(*this == _rhs);
158   }
159   inline bool operator>(const HubInfo& _rhs) const {
160     return _rhs < *this;
161   }
162   inline bool operator>=(const HubInfo& _rhs) const {
163     return !(*this < _rhs);
164   }
165   inline bool operator<=(const HubInfo& _rhs) const {
166     return !(_rhs < *this);
167   }
168 
169   static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
170   enum : int64_t { HUB_ID_INVALID = 0L };
171   enum : int64_t { HUB_ID_RESERVED = -1L };
toString()172   inline std::string toString() const {
173     std::ostringstream _aidl_os;
174     _aidl_os << "HubInfo{";
175     _aidl_os << "hubId: " << ::android::internal::ToString(hubId);
176     _aidl_os << ", hubDetails: " << ::android::internal::ToString(hubDetails);
177     _aidl_os << "}";
178     return _aidl_os.str();
179   }
180 };
181 }  // namespace contexthub
182 }  // namespace hardware
183 }  // namespace android
184 }  // namespace aidl
185 namespace aidl {
186 namespace android {
187 namespace hardware {
188 namespace contexthub {
toString(HubInfo::HubDetails::Tag val)189 [[nodiscard]] static inline std::string toString(HubInfo::HubDetails::Tag val) {
190   switch(val) {
191   case HubInfo::HubDetails::Tag::contextHubInfo:
192     return "contextHubInfo";
193   case HubInfo::HubDetails::Tag::vendorHubInfo:
194     return "vendorHubInfo";
195   default:
196     return std::to_string(static_cast<int32_t>(val));
197   }
198 }
199 }  // namespace contexthub
200 }  // namespace hardware
201 }  // namespace android
202 }  // namespace aidl
203 namespace ndk {
204 namespace internal {
205 #pragma clang diagnostic push
206 #pragma clang diagnostic ignored "-Wc++17-extensions"
207 template <>
208 constexpr inline std::array<aidl::android::hardware::contexthub::HubInfo::HubDetails::Tag, 2> enum_values<aidl::android::hardware::contexthub::HubInfo::HubDetails::Tag> = {
209   aidl::android::hardware::contexthub::HubInfo::HubDetails::Tag::contextHubInfo,
210   aidl::android::hardware::contexthub::HubInfo::HubDetails::Tag::vendorHubInfo,
211 };
212 #pragma clang diagnostic pop
213 }  // namespace internal
214 }  // namespace ndk
215