1 /*
2  * This file is auto-generated.  DO NOT MODIFY.
3  * Using: out/host/linux-x86/bin/aidl --lang=ndk --structured --version 2 --hash c12818c51418fbfc76f1b81eba6678d75cf526c1 -t --stability vintf --min_sdk_version 29 -pout/soong/.intermediates/hardware/interfaces/common/aidl/android.hardware.common_interface/2/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/common/fmq/aidl/android.hardware.common.fmq_interface/1/preprocessed.aidl --ninja -d out/soong/.intermediates/hardware/interfaces/media/bufferpool/aidl/android.hardware.media.bufferpool2-V2-ndk-source/gen/staging/android/hardware/media/bufferpool2/IConnection.cpp.d -h out/soong/.intermediates/hardware/interfaces/media/bufferpool/aidl/android.hardware.media.bufferpool2-V2-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/media/bufferpool/aidl/android.hardware.media.bufferpool2-V2-ndk-source/gen/staging -Iframeworks/base/core/java -Nhardware/interfaces/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/2 hardware/interfaces/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/2/android/hardware/media/bufferpool2/IConnection.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/media/bufferpool2/Buffer.h>
26 #include <aidl/android/hardware/media/bufferpool2/IConnection.h>
27 #ifdef BINDER_STABILITY_SUPPORT
28 #include <android/binder_stability.h>
29 #endif  // BINDER_STABILITY_SUPPORT
30 
31 #ifndef __BIONIC__
32 #define __assert2(a,b,c,d) ((void)0)
33 #endif
34 
35 namespace aidl::android::hardware::media::bufferpool2 {
36 class Buffer;
37 }  // namespace aidl::android::hardware::media::bufferpool2
38 namespace aidl {
39 namespace android {
40 namespace hardware {
41 namespace media {
42 namespace bufferpool2 {
43 class IConnectionDelegator;
44 
45 class IConnection : public ::ndk::ICInterface {
46 public:
47   typedef IConnectionDelegator DefaultDelegator;
48   static const char* descriptor;
49   IConnection();
50   virtual ~IConnection();
51 
52   class FetchInfo {
53   public:
54     typedef std::false_type fixed_size;
55     static const char* descriptor;
56 
57     int64_t transactionId = 0L;
58     int32_t bufferId = 0;
59 
60     binder_status_t readFromParcel(const AParcel* parcel);
61     binder_status_t writeToParcel(AParcel* parcel) const;
62 
63     inline bool operator==(const FetchInfo& _rhs) const {
64       return std::tie(transactionId, bufferId) == std::tie(_rhs.transactionId, _rhs.bufferId);
65     }
66     inline bool operator<(const FetchInfo& _rhs) const {
67       return std::tie(transactionId, bufferId) < std::tie(_rhs.transactionId, _rhs.bufferId);
68     }
69     inline bool operator!=(const FetchInfo& _rhs) const {
70       return !(*this == _rhs);
71     }
72     inline bool operator>(const FetchInfo& _rhs) const {
73       return _rhs < *this;
74     }
75     inline bool operator>=(const FetchInfo& _rhs) const {
76       return !(*this < _rhs);
77     }
78     inline bool operator<=(const FetchInfo& _rhs) const {
79       return !(_rhs < *this);
80     }
81 
82     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()83     inline std::string toString() const {
84       std::ostringstream _aidl_os;
85       _aidl_os << "FetchInfo{";
86       _aidl_os << "transactionId: " << ::android::internal::ToString(transactionId);
87       _aidl_os << ", bufferId: " << ::android::internal::ToString(bufferId);
88       _aidl_os << "}";
89       return _aidl_os.str();
90     }
91   };
92   class FetchResult {
93   public:
94     typedef std::false_type fixed_size;
95     static const char* descriptor;
96 
97     enum class Tag : int32_t {
98       buffer = 0,
99       failure = 1,
100     };
101 
102     // Expose tag symbols for legacy code
103     static const inline Tag buffer = Tag::buffer;
104     static const inline Tag failure = Tag::failure;
105 
106     template<typename _Tp>
107     static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, FetchResult>;
108 
FetchResult()109     FetchResult() : _value(std::in_place_index<static_cast<size_t>(buffer)>, ::aidl::android::hardware::media::bufferpool2::Buffer()) { }
110 
111     template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
112     // NOLINTNEXTLINE(google-explicit-constructor)
FetchResult(_Tp && _arg)113     constexpr FetchResult(_Tp&& _arg)
114         : _value(std::forward<_Tp>(_arg)) {}
115 
116     template <size_t _Np, typename... _Tp>
FetchResult(std::in_place_index_t<_Np>,_Tp &&..._args)117     constexpr explicit FetchResult(std::in_place_index_t<_Np>, _Tp&&... _args)
118         : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
119 
120     template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)121     static FetchResult make(_Tp&&... _args) {
122       return FetchResult(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
123     }
124 
125     template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)126     static FetchResult make(std::initializer_list<_Tp> _il, _Up&&... _args) {
127       return FetchResult(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
128     }
129 
getTag()130     Tag getTag() const {
131       return static_cast<Tag>(_value.index());
132     }
133 
134     template <Tag _tag>
get()135     const auto& get() const {
136       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
137       return std::get<static_cast<size_t>(_tag)>(_value);
138     }
139 
140     template <Tag _tag>
get()141     auto& get() {
142       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
143       return std::get<static_cast<size_t>(_tag)>(_value);
144     }
145 
146     template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)147     void set(_Tp&&... _args) {
148       _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
149     }
150 
151     binder_status_t readFromParcel(const AParcel* _parcel);
152     binder_status_t writeToParcel(AParcel* _parcel) const;
153 
154     inline bool operator==(const FetchResult& _rhs) const {
155       return _value == _rhs._value;
156     }
157     inline bool operator<(const FetchResult& _rhs) const {
158       return _value < _rhs._value;
159     }
160     inline bool operator!=(const FetchResult& _rhs) const {
161       return !(*this == _rhs);
162     }
163     inline bool operator>(const FetchResult& _rhs) const {
164       return _rhs < *this;
165     }
166     inline bool operator>=(const FetchResult& _rhs) const {
167       return !(*this < _rhs);
168     }
169     inline bool operator<=(const FetchResult& _rhs) const {
170       return !(_rhs < *this);
171     }
172 
173     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()174     inline std::string toString() const {
175       std::ostringstream os;
176       os << "FetchResult{";
177       switch (getTag()) {
178       case buffer: os << "buffer: " << ::android::internal::ToString(get<buffer>()); break;
179       case failure: os << "failure: " << ::android::internal::ToString(get<failure>()); break;
180       }
181       os << "}";
182       return os.str();
183     }
184   private:
185     std::variant<::aidl::android::hardware::media::bufferpool2::Buffer, int32_t> _value;
186   };
187   static inline const int32_t version = 2;
188   static inline const std::string hash = "c12818c51418fbfc76f1b81eba6678d75cf526c1";
189   static constexpr uint32_t TRANSACTION_fetch = FIRST_CALL_TRANSACTION + 0;
190   static constexpr uint32_t TRANSACTION_sync = FIRST_CALL_TRANSACTION + 1;
191 
192   static std::shared_ptr<IConnection> fromBinder(const ::ndk::SpAIBinder& binder);
193   static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IConnection>& instance);
194   static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IConnection>* instance);
195   static bool setDefaultImpl(const std::shared_ptr<IConnection>& impl);
196   static const std::shared_ptr<IConnection>& getDefaultImpl();
197   virtual ::ndk::ScopedAStatus fetch(const std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchInfo>& in_fetchInfos, std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchResult>* _aidl_return) = 0;
198   virtual ::ndk::ScopedAStatus sync() = 0;
199   virtual ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) = 0;
200   virtual ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) = 0;
201 private:
202   static std::shared_ptr<IConnection> default_impl;
203 };
204 class IConnectionDefault : public IConnection {
205 public:
206   ::ndk::ScopedAStatus fetch(const std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchInfo>& in_fetchInfos, std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchResult>* _aidl_return) override;
207   ::ndk::ScopedAStatus sync() override;
208   ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override;
209   ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override;
210   ::ndk::SpAIBinder asBinder() override;
211   bool isRemote() override;
212 };
213 }  // namespace bufferpool2
214 }  // namespace media
215 }  // namespace hardware
216 }  // namespace android
217 }  // namespace aidl
218 namespace aidl {
219 namespace android {
220 namespace hardware {
221 namespace media {
222 namespace bufferpool2 {
toString(IConnection::FetchResult::Tag val)223 [[nodiscard]] static inline std::string toString(IConnection::FetchResult::Tag val) {
224   switch(val) {
225   case IConnection::FetchResult::Tag::buffer:
226     return "buffer";
227   case IConnection::FetchResult::Tag::failure:
228     return "failure";
229   default:
230     return std::to_string(static_cast<int32_t>(val));
231   }
232 }
233 }  // namespace bufferpool2
234 }  // namespace media
235 }  // namespace hardware
236 }  // namespace android
237 }  // namespace aidl
238 namespace ndk {
239 namespace internal {
240 #pragma clang diagnostic push
241 #pragma clang diagnostic ignored "-Wc++17-extensions"
242 template <>
243 constexpr inline std::array<aidl::android::hardware::media::bufferpool2::IConnection::FetchResult::Tag, 2> enum_values<aidl::android::hardware::media::bufferpool2::IConnection::FetchResult::Tag> = {
244   aidl::android::hardware::media::bufferpool2::IConnection::FetchResult::Tag::buffer,
245   aidl::android::hardware::media::bufferpool2::IConnection::FetchResult::Tag::failure,
246 };
247 #pragma clang diagnostic pop
248 }  // namespace internal
249 }  // namespace ndk
250