| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <lib/fidl/internal.h> |
| #include <lib/fidl/llcpp/array.h> |
| #include <lib/fidl/llcpp/buffer_allocator.h> |
| #include <lib/fidl/llcpp/buffer_then_heap_allocator.h> |
| #include <lib/fidl/llcpp/client.h> |
| #include <lib/fidl/llcpp/coding.h> |
| #include <lib/fidl/llcpp/connect_service.h> |
| #include <lib/fidl/llcpp/envelope.h> |
| #include <lib/fidl/llcpp/errors.h> |
| #include <lib/fidl/llcpp/linearized_and_encoded.h> |
| #include <lib/fidl/llcpp/memory.h> |
| #include <lib/fidl/llcpp/server.h> |
| #include <lib/fidl/llcpp/service_handler_interface.h> |
| #include <lib/fidl/llcpp/string_view.h> |
| #include <lib/fidl/llcpp/sync_call.h> |
| #include <lib/fidl/llcpp/tracking_ptr.h> |
| #include <lib/fidl/llcpp/traits.h> |
| #include <lib/fidl/llcpp/transaction.h> |
| #include <lib/fidl/llcpp/vector_view.h> |
| #include <lib/fidl/txn_header.h> |
| #include <lib/fit/function.h> |
| #include <lib/zx/channel.h> |
| #include <zircon/fidl.h> |
| |
| #include <variant> |
| |
| namespace llcpp { |
| |
| namespace test { |
| namespace name { |
| |
| class Parent; |
| class Child; |
| |
| extern "C" const fidl_type_t test_name_ParentGetChildRequestTable; |
| extern "C" const fidl_type_t test_name_ParentGetChildResponseTable; |
| extern "C" const fidl_type_t test_name_ParentGetChildRequestRequestTable; |
| extern "C" const fidl_type_t test_name_ParentGetChildRequestResponseTable; |
| extern "C" const fidl_type_t test_name_ParentTakeChildRequestTable; |
| extern "C" const fidl_type_t test_name_ParentTakeChildResponseTable; |
| extern "C" const fidl_type_t test_name_ParentTakeChildRequestRequestTable; |
| extern "C" const fidl_type_t test_name_ParentTakeChildRequestResponseTable; |
| |
| class Parent final { |
| Parent() = delete; |
| |
| public: |
| struct GetChildResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::channel c; |
| explicit GetChildResponse(::zx::channel& c) : c(std::move(c)) { |
| _InitHeader(); |
| } |
| GetChildResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ParentGetChildResponseTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct GetChildRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit GetChildRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = GetChildResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct GetChildRequestResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::channel r; |
| explicit GetChildRequestResponse(::zx::channel& r) : r(std::move(r)) { |
| _InitHeader(); |
| } |
| GetChildRequestResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ParentGetChildRequestResponseTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct GetChildRequestRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| explicit GetChildRequestRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &::fidl::_llcpp_coding_AnyZeroArgMessageTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = GetChildRequestResponse; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct TakeChildRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::channel c; |
| explicit TakeChildRequest(zx_txid_t _txid, ::zx::channel& c) |
| : c(std::move(c)) { |
| _InitHeader(_txid); |
| } |
| explicit TakeChildRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ParentTakeChildRequestTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct TakeChildRequestRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::zx::channel r; |
| explicit TakeChildRequestRequest(zx_txid_t _txid, ::zx::channel& r) |
| : r(std::move(r)) { |
| _InitHeader(_txid); |
| } |
| explicit TakeChildRequestRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &test_name_ParentTakeChildRequestRequestTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = false; |
| static constexpr bool IsResource = true; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class GetChild_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| GetChild_Impl(::zx::unowned_channel _client_end); |
| ~GetChild_Impl() = default; |
| GetChild_Impl(GetChild_Impl&& other) = default; |
| GetChild_Impl& operator=(GetChild_Impl&& other) = default; |
| GetChild_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetChildRequest_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| GetChildRequest_Impl(::zx::unowned_channel _client_end); |
| ~GetChildRequest_Impl() = default; |
| GetChildRequest_Impl(GetChildRequest_Impl&& other) = default; |
| GetChildRequest_Impl& operator=(GetChildRequest_Impl&& other) = default; |
| GetChildRequest_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class TakeChild_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| TakeChild_Impl(::zx::unowned_channel _client_end, ::zx::channel& c); |
| ~TakeChild_Impl() = default; |
| TakeChild_Impl(TakeChild_Impl&& other) = default; |
| TakeChild_Impl& operator=(TakeChild_Impl&& other) = default; |
| TakeChild_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| class TakeChildRequest_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| TakeChildRequest_Impl(::zx::unowned_channel _client_end, |
| ::zx::channel& r); |
| ~TakeChildRequest_Impl() = default; |
| TakeChildRequest_Impl(TakeChildRequest_Impl&& other) = default; |
| TakeChildRequest_Impl& operator=(TakeChildRequest_Impl&& other) = default; |
| TakeChildRequest_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| |
| public: |
| using GetChild = GetChild_Impl<GetChildResponse>; |
| using GetChildRequest = GetChildRequest_Impl<GetChildRequestResponse>; |
| using TakeChild = TakeChild_Impl; |
| using TakeChildRequest = TakeChildRequest_Impl; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| template <typename ResponseType> |
| class GetChild_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| GetChild_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~GetChild_Impl() = default; |
| GetChild_Impl(GetChild_Impl&& other) = default; |
| GetChild_Impl& operator=(GetChild_Impl&& other) = default; |
| GetChild_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetChildRequest_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| GetChildRequest_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _response_buffer); |
| ~GetChildRequest_Impl() = default; |
| GetChildRequest_Impl(GetChildRequest_Impl&& other) = default; |
| GetChildRequest_Impl& operator=(GetChildRequest_Impl&& other) = default; |
| GetChildRequest_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| class TakeChild_Impl final : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| TakeChild_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, ::zx::channel c); |
| ~TakeChild_Impl() = default; |
| TakeChild_Impl(TakeChild_Impl&& other) = default; |
| TakeChild_Impl& operator=(TakeChild_Impl&& other) = default; |
| TakeChild_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| class TakeChildRequest_Impl final |
| : private ::fidl::internal::StatusAndError { |
| using Super = ::fidl::internal::StatusAndError; |
| |
| public: |
| TakeChildRequest_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, ::zx::channel r); |
| ~TakeChildRequest_Impl() = default; |
| TakeChildRequest_Impl(TakeChildRequest_Impl&& other) = default; |
| TakeChildRequest_Impl& operator=(TakeChildRequest_Impl&& other) = default; |
| TakeChildRequest_Impl(::fidl::internal::StatusAndError&& other) |
| : Super(std::move(other)) {} |
| using Super::error; |
| using Super::ok; |
| using Super::status; |
| }; |
| |
| public: |
| using GetChild = GetChild_Impl<GetChildResponse>; |
| using GetChildRequest = GetChildRequest_Impl<GetChildRequestResponse>; |
| using TakeChild = TakeChild_Impl; |
| using TakeChildRequest = TakeChildRequest_Impl; |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::GetChild GetChild(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::GetChild GetChild(::fidl::BytePart _response_buffer); |
| |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::GetChildRequest GetChildRequest(); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::GetChildRequest GetChildRequest( |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::TakeChild TakeChild(::zx::channel c); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::TakeChild TakeChild(::fidl::BytePart _request_buffer, |
| ::zx::channel c); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::TakeChildRequest TakeChildRequest(::zx::channel r); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::TakeChildRequest TakeChildRequest( |
| ::fidl::BytePart _request_buffer, ::zx::channel r); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::GetChild GetChild(::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::GetChild GetChild( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::GetChildRequest GetChildRequest( |
| ::zx::unowned_channel _client_end); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::GetChildRequest GetChildRequest( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::TakeChild TakeChild(::zx::unowned_channel _client_end, |
| ::zx::channel c); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::TakeChild TakeChild( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::zx::channel c); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::TakeChildRequest TakeChildRequest( |
| ::zx::unowned_channel _client_end, ::zx::channel r); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::TakeChildRequest TakeChildRequest( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart _request_buffer, |
| ::zx::channel r); |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| static ::fidl::DecodeResult<GetChildResponse> GetChild( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<GetChildRequestResponse> GetChildRequest( |
| ::zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| static ::fidl::internal::StatusAndError TakeChild( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<TakeChildRequest> params); |
| |
| static ::fidl::internal::StatusAndError TakeChild( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<TakeChildRequest> params); |
| |
| static ::fidl::internal::StatusAndError TakeChildRequest( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<TakeChildRequestRequest> params); |
| |
| static ::fidl::internal::StatusAndError TakeChildRequest( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<TakeChildRequestRequest> params); |
| }; |
| |
| struct AsyncEventHandlers; |
| class GetChildResponseContext; |
| class GetChildRequestResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = Parent; |
| using _Base = ::fidl::CompleterBase; |
| |
| class GetChildCompleterBase : public _Base { |
| public: |
| void Reply(::zx::channel c); |
| void Reply(::fidl::BytePart _buffer, ::zx::channel c); |
| void Reply(::fidl::DecodedMessage<GetChildResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using GetChildCompleter = ::fidl::Completer<GetChildCompleterBase>; |
| |
| virtual void GetChild(GetChildCompleter::Sync _completer) = 0; |
| |
| class GetChildRequestCompleterBase : public _Base { |
| public: |
| void Reply(::zx::channel r); |
| void Reply(::fidl::BytePart _buffer, ::zx::channel r); |
| void Reply(::fidl::DecodedMessage<GetChildRequestResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using GetChildRequestCompleter = |
| ::fidl::Completer<GetChildRequestCompleterBase>; |
| |
| virtual void GetChildRequest(GetChildRequestCompleter::Sync _completer) = 0; |
| |
| using TakeChildCompleter = ::fidl::Completer<>; |
| |
| virtual void TakeChild(::zx::channel c, |
| TakeChildCompleter::Sync _completer) = 0; |
| |
| using TakeChildRequestCompleter = ::fidl::Completer<>; |
| |
| virtual void TakeChildRequest( |
| ::zx::channel r, TakeChildRequestCompleter::Sync _completer) = 0; |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the |
| // server implementation. If there is no matching handler, it returns false, |
| // leaving the message and transaction intact. In all other cases, it consumes |
| // the message and returns true. It is possible to chain multiple TryDispatch |
| // functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the |
| // protocol. If there is no matching handler, it closes all the handles in |
| // |msg| and closes the channel with a |ZX_ERR_NOT_SUPPORTED| epitaph, before |
| // returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used |
| // with |fidl::Bind| to reduce template expansion. Do not call this method |
| // manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| class EventSender; |
| }; |
| |
| class Child final { |
| Child() = delete; |
| |
| public: |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| private: |
| public: |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| |
| private: |
| public: |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding |
| // setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL |
| // wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| |
| public: |
| }; |
| |
| struct AsyncEventHandlers; |
| class ClientImpl; |
| |
| class EventSender; |
| }; |
| |
| } // namespace name |
| } // namespace test |
| } // namespace llcpp |
| |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::GetChildRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::GetChildRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Parent::GetChildRequest) == |
| ::llcpp::test::name::Parent::GetChildRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::GetChildResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::GetChildResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Parent::GetChildResponse) == |
| ::llcpp::test::name::Parent::GetChildResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Parent::GetChildResponse, c) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::GetChildRequestRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::GetChildRequestRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Parent::GetChildRequestRequest) == |
| ::llcpp::test::name::Parent::GetChildRequestRequest::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::GetChildRequestResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::GetChildRequestResponse> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::Parent::GetChildRequestResponse) == |
| ::llcpp::test::name::Parent::GetChildRequestResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Parent::GetChildRequestResponse, |
| r) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::TakeChildRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::TakeChildRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::test::name::Parent::TakeChildRequest) == |
| ::llcpp::test::name::Parent::TakeChildRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Parent::TakeChildRequest, c) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::test::name::Parent::TakeChildRequestRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::test::name::Parent::TakeChildRequestRequest> |
| : public std::true_type {}; |
| static_assert( |
| sizeof(::llcpp::test::name::Parent::TakeChildRequestRequest) == |
| ::llcpp::test::name::Parent::TakeChildRequestRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::test::name::Parent::TakeChildRequestRequest, |
| r) == 16); |
| |
| } // namespace fidl |
| |
| namespace llcpp { |
| |
| namespace test { |
| namespace name { |
| |
| struct Parent::AsyncEventHandlers {}; |
| |
| class Parent::GetChildResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~GetChildResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<GetChildResponse> msg) = 0; |
| |
| protected: |
| GetChildResponseContext() = default; |
| }; |
| |
| class Parent::GetChildRequestResponseContext |
| : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~GetChildRequestResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<GetChildRequestResponse> msg) = 0; |
| |
| protected: |
| GetChildRequestResponseContext() = default; |
| }; |
| |
| class Parent::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Asynchronous variant of |Parent.GetChild()|. Allocates 16 bytes of request |
| // buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError GetChild(::fit::callback<void(::zx::channel c)> _cb); |
| |
| // Asynchronous variant of |Parent.GetChild()|. Caller provides the backing |
| // storage for FIDL message via request and response buffers. Ownership of |
| // _context is given unsafely to the binding until OnError() or OnReply() are |
| // called on it. |
| ::fidl::StatusAndError GetChild(GetChildResponseContext* _context); |
| // Synchronous variant of |Parent.GetChild()|. Allocates 40 bytes of message |
| // buffer on the stack. No heap allocation necessary. |
| ResultOf::GetChild GetChild_Sync(); |
| |
| // Synchronous variant of |Parent.GetChild()|. Caller provides the backing |
| // storage for FIDL message via request and response buffers. |
| UnownedResultOf::GetChild GetChild_Sync(::fidl::BytePart _response_buffer); |
| |
| // Asynchronous variant of |Parent.GetChildRequest()|. Allocates 16 bytes of |
| // request buffer on the stack. The callback is stored on the heap. |
| ::fidl::StatusAndError GetChildRequest( |
| ::fit::callback<void(::zx::channel r)> _cb); |
| |
| // Asynchronous variant of |Parent.GetChildRequest()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| // Ownership of _context is given unsafely to the binding until OnError() or |
| // OnReply() are called on it. |
| ::fidl::StatusAndError GetChildRequest( |
| GetChildRequestResponseContext* _context); |
| // Synchronous variant of |Parent.GetChildRequest()|. Allocates 40 bytes of |
| // message buffer on the stack. No heap allocation necessary. |
| ResultOf::GetChildRequest GetChildRequest_Sync(); |
| |
| // Synchronous variant of |Parent.GetChildRequest()|. Caller provides the |
| // backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::GetChildRequest GetChildRequest_Sync( |
| ::fidl::BytePart _response_buffer); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::StatusAndError TakeChild(::zx::channel c); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| ::fidl::StatusAndError TakeChild(::fidl::BytePart _request_buffer, |
| ::zx::channel c); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::StatusAndError TakeChildRequest(::zx::channel r); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| ::fidl::StatusAndError TakeChildRequest(::fidl::BytePart _request_buffer, |
| ::zx::channel r); |
| |
| private: |
| friend class ::fidl::Client<Parent>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class Parent::EventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<Parent>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| struct Child::AsyncEventHandlers {}; |
| |
| class Child::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| private: |
| friend class ::fidl::Client<Child>; |
| |
| ClientImpl(::zx::channel client_end, async_dispatcher_t* dispatcher, |
| ::fidl::internal::TypeErasedOnUnboundFn on_unbound, |
| AsyncEventHandlers handlers) |
| : ::fidl::internal::ClientBase(std::move(client_end), dispatcher, |
| std::move(on_unbound)), |
| handlers_(std::move(handlers)) {} |
| |
| zx_status_t Dispatch(fidl_msg_t* msg, |
| ::fidl::internal::ResponseContext* context) override; |
| |
| AsyncEventHandlers handlers_; |
| }; |
| |
| class Child::EventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<Child>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| } // namespace name |
| } // namespace test |
| } // namespace llcpp |