| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include "lib/fidl/cpp/internal/header.h" |
| |
| namespace fidl { |
| namespace test { |
| namespace json { |
| |
| class Empty; |
| #ifdef __Fuchsia__ |
| |
| class EmptyProtocol; |
| using EmptyProtocolPtr = ::fidl::InterfacePtr<EmptyProtocol>; |
| class EmptyProtocol_Proxy; |
| class EmptyProtocol_Stub; |
| class EmptyProtocol_EventSender; |
| class EmptyProtocol_Sync; |
| using EmptyProtocolSyncPtr = ::fidl::SynchronousInterfacePtr<EmptyProtocol>; |
| class EmptyProtocol_SyncProxy; |
| using EmptyProtocolHandle = ::fidl::InterfaceHandle<EmptyProtocol>; |
| namespace internal { |
| constexpr uint64_t kEmptyProtocol_Send_Ordinal = 0x1109a64200000000lu; |
| constexpr uint64_t kEmptyProtocol_Send_GenOrdinal = 0x7a2963cbd88da03lu; |
| constexpr uint64_t kEmptyProtocol_Receive_Ordinal = 0x172c2b6f00000000lu; |
| constexpr uint64_t kEmptyProtocol_Receive_GenOrdinal = 0x63ba2e5c5fdb4895lu; |
| constexpr uint64_t kEmptyProtocol_SendAndReceive_Ordinal = 0x7b7cca3c00000000lu; |
| constexpr uint64_t kEmptyProtocol_SendAndReceive_GenOrdinal = |
| 0x1e59efe8b1bbd615lu; |
| |
| } // namespace internal |
| #endif // __Fuchsia__ |
| |
| class Empty final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| uint8_t __reserved = 0u; |
| |
| static inline ::std::unique_ptr<Empty> New() { |
| return ::std::make_unique<Empty>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, Empty* value, size_t _offset); |
| zx_status_t Clone(Empty* result) const; |
| }; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::Empty& _value, |
| ::fidl::test::json::Empty* _result) { |
| return _value.Clone(_result); |
| } |
| |
| using EmptyPtr = ::std::unique_ptr<Empty>; |
| #ifdef __Fuchsia__ |
| |
| class EmptyProtocol { |
| public: |
| using Proxy_ = EmptyProtocol_Proxy; |
| using Stub_ = EmptyProtocol_Stub; |
| using EventSender_ = EmptyProtocol_EventSender; |
| using Sync_ = EmptyProtocol_Sync; |
| virtual ~EmptyProtocol(); |
| |
| virtual void Send(Empty e) = 0; |
| using ReceiveCallback = fit::function<void(Empty)>; |
| using SendAndReceiveCallback = fit::function<void(Empty)>; |
| |
| virtual void SendAndReceive(Empty e, SendAndReceiveCallback callback) = 0; |
| }; |
| |
| class EmptyProtocol_RequestEncoder { |
| public: |
| static ::fidl::Message Send(::fidl::Encoder* _encoder, Empty* e) { |
| _encoder->Alloc(24 - sizeof(fidl_message_header_t)); |
| ::fidl::Encode(_encoder, e, 16); |
| return _encoder->GetMessage(); |
| } |
| static ::fidl::Message SendAndReceive(::fidl::Encoder* _encoder, Empty* e) { |
| _encoder->Alloc(24 - sizeof(fidl_message_header_t)); |
| ::fidl::Encode(_encoder, e, 16); |
| return _encoder->GetMessage(); |
| } |
| }; |
| |
| class EmptyProtocol_RequestDecoder { |
| public: |
| EmptyProtocol_RequestDecoder() = default; |
| virtual ~EmptyProtocol_RequestDecoder() = default; |
| static const fidl_type_t* GetType(uint64_t ordinal, bool* out_needs_response); |
| zx_status_t Decode_(::fidl::Message request) { |
| bool needs_response; |
| const fidl_type_t* request_type = |
| GetType(request.ordinal(), &needs_response); |
| if (request_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = request.Decode(request_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(request, request_type, error_msg); |
| return status; |
| } |
| ::fidl::Decoder request_decoder(std::move(request)); |
| switch (request.ordinal()) { |
| case internal::kEmptyProtocol_Send_Ordinal: |
| case internal::kEmptyProtocol_Send_GenOrdinal: { |
| auto arg0 = ::fidl::DecodeAs<Empty>(&request_decoder, 16); |
| Send(std::move(arg0)); |
| break; |
| } |
| case internal::kEmptyProtocol_SendAndReceive_Ordinal: |
| case internal::kEmptyProtocol_SendAndReceive_GenOrdinal: { |
| auto arg0 = ::fidl::DecodeAs<Empty>(&request_decoder, 16); |
| SendAndReceive(std::move(arg0)); |
| break; |
| } |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| virtual void Send(Empty e) = 0; |
| virtual void SendAndReceive(Empty e) = 0; |
| }; |
| |
| class EmptyProtocol_ResponseEncoder { |
| public: |
| static ::fidl::Message Receive(::fidl::Encoder* _encoder, Empty* e) { |
| _encoder->Alloc(24 - sizeof(fidl_message_header_t)); |
| ::fidl::Encode(_encoder, e, 16); |
| return _encoder->GetMessage(); |
| } |
| static ::fidl::Message SendAndReceive(::fidl::Encoder* _encoder, Empty* e) { |
| _encoder->Alloc(24 - sizeof(fidl_message_header_t)); |
| ::fidl::Encode(_encoder, e, 16); |
| return _encoder->GetMessage(); |
| } |
| }; |
| |
| class EmptyProtocol_ResponseDecoder { |
| public: |
| EmptyProtocol_ResponseDecoder() = default; |
| virtual ~EmptyProtocol_ResponseDecoder() = default; |
| static const fidl_type_t* GetType(uint64_t ordinal); |
| zx_status_t Decode_(::fidl::Message response) { |
| const fidl_type_t* response_type = GetType(response.ordinal()); |
| if (response_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = response.Decode(response_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(response, response_type, error_msg); |
| return status; |
| } |
| ::fidl::Decoder response_decoder(std::move(response)); |
| switch (response.ordinal()) { |
| case internal::kEmptyProtocol_Receive_Ordinal: |
| case internal::kEmptyProtocol_Receive_GenOrdinal: { |
| auto arg0 = ::fidl::DecodeAs<Empty>(&response_decoder, 16); |
| Receive(std::move(arg0)); |
| break; |
| } |
| case internal::kEmptyProtocol_SendAndReceive_Ordinal: |
| case internal::kEmptyProtocol_SendAndReceive_GenOrdinal: { |
| auto arg0 = ::fidl::DecodeAs<Empty>(&response_decoder, 16); |
| SendAndReceive(std::move(arg0)); |
| break; |
| } |
| default: { |
| break; |
| } |
| } |
| return ZX_OK; |
| } |
| virtual void Receive(Empty e) = 0; |
| virtual void SendAndReceive(Empty e) = 0; |
| }; |
| |
| class EmptyProtocol_EventSender { |
| public: |
| virtual ~EmptyProtocol_EventSender(); |
| virtual void Receive(Empty e) = 0; |
| }; |
| |
| class EmptyProtocol_Sync { |
| public: |
| using Proxy_ = EmptyProtocol_SyncProxy; |
| virtual ~EmptyProtocol_Sync(); |
| virtual zx_status_t Send(Empty e) = 0; |
| virtual zx_status_t SendAndReceive(Empty e, Empty* out_e) = 0; |
| }; |
| |
| class EmptyProtocol_Proxy final : public ::fidl::internal::Proxy, |
| public EmptyProtocol { |
| public: |
| explicit EmptyProtocol_Proxy(::fidl::internal::ProxyController* controller); |
| ~EmptyProtocol_Proxy() override; |
| |
| zx_status_t Dispatch_(::fidl::Message message) override; |
| void Send(Empty e) override; |
| ReceiveCallback Receive; |
| void SendAndReceive(Empty e, SendAndReceiveCallback callback) override; |
| |
| private: |
| EmptyProtocol_Proxy(const EmptyProtocol_Proxy&) = delete; |
| EmptyProtocol_Proxy& operator=(const EmptyProtocol_Proxy&) = delete; |
| |
| ::fidl::internal::ProxyController* controller_; |
| }; |
| |
| class EmptyProtocol_Stub final : public ::fidl::internal::Stub, |
| public EmptyProtocol_EventSender { |
| public: |
| typedef class ::fidl::test::json::EmptyProtocol EmptyProtocol_clazz; |
| explicit EmptyProtocol_Stub(EmptyProtocol_clazz* impl); |
| ~EmptyProtocol_Stub() override; |
| |
| zx_status_t Dispatch_(::fidl::Message message, |
| ::fidl::internal::PendingResponse response) override; |
| void Receive(Empty e) override; |
| |
| private: |
| EmptyProtocol_clazz* impl_; |
| }; |
| |
| class EmptyProtocol_SyncProxy : public EmptyProtocol_Sync { |
| public: |
| explicit EmptyProtocol_SyncProxy(::zx::channel channel); |
| ~EmptyProtocol_SyncProxy() override; |
| zx_status_t Send(Empty e) override; |
| zx_status_t SendAndReceive(Empty e, Empty* out_e) override; |
| |
| private: |
| ::fidl::internal::SynchronousProxy proxy_; |
| friend class ::fidl::SynchronousInterfacePtr<EmptyProtocol>; |
| }; |
| #endif // __Fuchsia__ |
| } // namespace json |
| } // namespace test |
| } // namespace fidl |
| namespace fidl { |
| |
| template <> |
| struct CodingTraits<::fidl::test::json::Empty> |
| : public EncodableCodingTraits<::fidl::test::json::Empty, 1> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::json::Empty& value, |
| ::fidl::test::json::Empty* result) { |
| return ::fidl::test::json::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::fidl::test::json::Empty> { |
| bool operator()(const ::fidl::test::json::Empty& _lhs, |
| const ::fidl::test::json::Empty& _rhs) const { |
| if (!::fidl::Equals(_lhs.__reserved, _rhs.__reserved)) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| } // namespace fidl |