| #pragma once |
| |
| #include "aidl/android/aidl/versioned/tests/IFooInterface.h" |
| |
| #include <android/binder_ibinder.h> |
| #include <cassert> |
| |
| #ifndef __BIONIC__ |
| #ifndef __assert2 |
| #define __assert2(a,b,c,d) ((void)0) |
| #endif |
| #endif |
| |
| namespace aidl { |
| namespace android { |
| namespace aidl { |
| namespace versioned { |
| namespace tests { |
| class BnFooInterface : public ::ndk::BnCInterface<IFooInterface> { |
| public: |
| BnFooInterface(); |
| virtual ~BnFooInterface(); |
| ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) final; |
| ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) final; |
| protected: |
| ::ndk::SpAIBinder createBinder() override; |
| private: |
| }; |
| class IFooInterfaceDelegator : public BnFooInterface { |
| public: |
| explicit IFooInterfaceDelegator(const std::shared_ptr<IFooInterface> &impl) : _impl(impl) { |
| int32_t _impl_ver = 0; |
| if (!impl->getInterfaceVersion(&_impl_ver).isOk()) {; |
| __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Delegator failed to get version of the implementation."); |
| } |
| if (_impl_ver != IFooInterface::version) { |
| __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Mismatched versions of delegator and implementation is not allowed."); |
| } |
| } |
| |
| ::ndk::ScopedAStatus originalApi() override { |
| return _impl->originalApi(); |
| } |
| ::ndk::ScopedAStatus acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& in_u, std::string* _aidl_return) override { |
| return _impl->acceptUnionAndReturnString(in_u, _aidl_return); |
| } |
| ::ndk::ScopedAStatus ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& in_inFoo, ::aidl::android::aidl::versioned::tests::Foo* in_inoutFoo, ::aidl::android::aidl::versioned::tests::Foo* out_outFoo, int32_t in_value, int32_t* _aidl_return) override { |
| return _impl->ignoreParcelablesAndRepeatInt(in_inFoo, in_inoutFoo, out_outFoo, in_value, _aidl_return); |
| } |
| ::ndk::ScopedAStatus returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& in_foos, int32_t* _aidl_return) override { |
| return _impl->returnsLengthOfFooArray(in_foos, _aidl_return); |
| } |
| protected: |
| private: |
| std::shared_ptr<IFooInterface> _impl; |
| }; |
| |
| } // namespace tests |
| } // namespace versioned |
| } // namespace aidl |
| } // namespace android |
| } // namespace aidl |