1 /*
2 * This file is auto-generated. DO NOT MODIFY.
3 * Using: out/host/linux-x86/bin/aidl --lang=ndk --structured --version 4 --hash 53178f8de9b8861df391cf0593f6f3e08adad33d -t --stability vintf --min_sdk_version 30 -pout/soong/.intermediates/hardware/interfaces/common/aidl/android.hardware.common_interface/2/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/graphics/common/aidl/android.hardware.graphics.common_interface/6/preprocessed.aidl --ninja -d out/soong/.intermediates/hardware/interfaces/neuralnetworks/aidl/android.hardware.neuralnetworks-V4-ndk-source/gen/staging/android/hardware/neuralnetworks/RequestMemoryPool.cpp.d -h out/soong/.intermediates/hardware/interfaces/neuralnetworks/aidl/android.hardware.neuralnetworks-V4-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/neuralnetworks/aidl/android.hardware.neuralnetworks-V4-ndk-source/gen/staging -Nhardware/interfaces/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4 hardware/interfaces/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestMemoryPool.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/neuralnetworks/Memory.h>
26 #ifdef BINDER_STABILITY_SUPPORT
27 #include <android/binder_stability.h>
28 #endif // BINDER_STABILITY_SUPPORT
29
30 #ifndef __BIONIC__
31 #define __assert2(a,b,c,d) ((void)0)
32 #endif
33
34 namespace aidl {
35 namespace android {
36 namespace hardware {
37 namespace neuralnetworks {
38 class RequestMemoryPool {
39 public:
40 typedef std::false_type fixed_size;
41 static const char* descriptor;
42
43 enum class Tag : int32_t {
44 pool = 0,
45 token = 1,
46 };
47
48 // Expose tag symbols for legacy code
49 static const inline Tag pool = Tag::pool;
50 static const inline Tag token = Tag::token;
51
52 template<typename _Tp>
53 static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, RequestMemoryPool>;
54
RequestMemoryPool()55 RequestMemoryPool() : _value(std::in_place_index<static_cast<size_t>(pool)>, ::aidl::android::hardware::neuralnetworks::Memory()) { }
56
57 template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
58 // NOLINTNEXTLINE(google-explicit-constructor)
RequestMemoryPool(_Tp && _arg)59 constexpr RequestMemoryPool(_Tp&& _arg)
60 : _value(std::forward<_Tp>(_arg)) {}
61
62 template <size_t _Np, typename... _Tp>
RequestMemoryPool(std::in_place_index_t<_Np>,_Tp &&..._args)63 constexpr explicit RequestMemoryPool(std::in_place_index_t<_Np>, _Tp&&... _args)
64 : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
65
66 template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)67 static RequestMemoryPool make(_Tp&&... _args) {
68 return RequestMemoryPool(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
69 }
70
71 template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)72 static RequestMemoryPool make(std::initializer_list<_Tp> _il, _Up&&... _args) {
73 return RequestMemoryPool(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
74 }
75
getTag()76 Tag getTag() const {
77 return static_cast<Tag>(_value.index());
78 }
79
80 template <Tag _tag>
get()81 const auto& get() const {
82 if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
83 return std::get<static_cast<size_t>(_tag)>(_value);
84 }
85
86 template <Tag _tag>
get()87 auto& get() {
88 if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
89 return std::get<static_cast<size_t>(_tag)>(_value);
90 }
91
92 template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)93 void set(_Tp&&... _args) {
94 _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
95 }
96
97 binder_status_t readFromParcel(const AParcel* _parcel);
98 binder_status_t writeToParcel(AParcel* _parcel) const;
99
100 inline bool operator==(const RequestMemoryPool& _rhs) const {
101 return _value == _rhs._value;
102 }
103 inline bool operator<(const RequestMemoryPool& _rhs) const {
104 return _value < _rhs._value;
105 }
106 inline bool operator!=(const RequestMemoryPool& _rhs) const {
107 return !(*this == _rhs);
108 }
109 inline bool operator>(const RequestMemoryPool& _rhs) const {
110 return _rhs < *this;
111 }
112 inline bool operator>=(const RequestMemoryPool& _rhs) const {
113 return !(*this < _rhs);
114 }
115 inline bool operator<=(const RequestMemoryPool& _rhs) const {
116 return !(_rhs < *this);
117 }
118
119 static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()120 inline std::string toString() const {
121 std::ostringstream os;
122 os << "RequestMemoryPool{";
123 switch (getTag()) {
124 case pool: os << "pool: " << ::android::internal::ToString(get<pool>()); break;
125 case token: os << "token: " << ::android::internal::ToString(get<token>()); break;
126 }
127 os << "}";
128 return os.str();
129 }
130 private:
131 std::variant<::aidl::android::hardware::neuralnetworks::Memory, int32_t> _value;
132 };
133 } // namespace neuralnetworks
134 } // namespace hardware
135 } // namespace android
136 } // namespace aidl
137 namespace aidl {
138 namespace android {
139 namespace hardware {
140 namespace neuralnetworks {
toString(RequestMemoryPool::Tag val)141 [[nodiscard]] static inline std::string toString(RequestMemoryPool::Tag val) {
142 switch(val) {
143 case RequestMemoryPool::Tag::pool:
144 return "pool";
145 case RequestMemoryPool::Tag::token:
146 return "token";
147 default:
148 return std::to_string(static_cast<int32_t>(val));
149 }
150 }
151 } // namespace neuralnetworks
152 } // namespace hardware
153 } // namespace android
154 } // namespace aidl
155 namespace ndk {
156 namespace internal {
157 #pragma clang diagnostic push
158 #pragma clang diagnostic ignored "-Wc++17-extensions"
159 template <>
160 constexpr inline std::array<aidl::android::hardware::neuralnetworks::RequestMemoryPool::Tag, 2> enum_values<aidl::android::hardware::neuralnetworks::RequestMemoryPool::Tag> = {
161 aidl::android::hardware::neuralnetworks::RequestMemoryPool::Tag::pool,
162 aidl::android::hardware::neuralnetworks::RequestMemoryPool::Tag::token,
163 };
164 #pragma clang diagnostic pop
165 } // namespace internal
166 } // namespace ndk
167