| // 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 fidl { |
| namespace test { |
| namespace json { |
| |
| class super; |
| class sub; |
| |
| extern "C" const fidl_type_t fidl_test_json_superfooRequestTable; |
| extern "C" const fidl_type_t fidl_test_json_superfooResponseTable; |
| |
| class super final { |
| super() = delete; |
| |
| public: |
| struct fooResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t y; |
| explicit fooResponse(int64_t y) : y(y) { _InitHeader(); } |
| fooResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_json_superfooResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| 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 = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct fooRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView s; |
| explicit fooRequest(zx_txid_t _txid, const ::fidl::StringView& s) |
| : s(::fidl::unowned_ptr_t<const char>(s.data()), s.size()) { |
| _InitHeader(_txid); |
| } |
| explicit fooRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_json_superfooRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = fooResponse; |
| |
| 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 foo_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| foo_Impl(::zx::unowned_channel _client_end, const ::fidl::StringView& s); |
| ~foo_Impl() = default; |
| foo_Impl(foo_Impl&& other) = default; |
| foo_Impl& operator=(foo_Impl&& other) = default; |
| foo_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*; |
| }; |
| |
| public: |
| using foo = foo_Impl<fooResponse>; |
| }; |
| |
| // 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 foo_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| foo_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| ~foo_Impl() = default; |
| foo_Impl(foo_Impl&& other) = default; |
| foo_Impl& operator=(foo_Impl&& other) = default; |
| foo_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*; |
| }; |
| |
| public: |
| using foo = foo_Impl<fooResponse>; |
| }; |
| |
| 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 24 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| ResultOf::foo foo(::fidl::StringView s); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::foo foo(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| |
| 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 24 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| static ResultOf::foo foo(::zx::unowned_channel _client_end, |
| ::fidl::StringView s); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::foo foo(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| }; |
| |
| // 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<fooResponse> foo( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<fooRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<fooResponse> foo( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<fooRequest> params, |
| ::fidl::BytePart response_buffer); |
| }; |
| |
| struct AsyncEventHandlers; |
| class fooResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = super; |
| using _Base = ::fidl::CompleterBase; |
| |
| class fooCompleterBase : public _Base { |
| public: |
| void Reply(int64_t y); |
| void Reply(::fidl::BytePart _buffer, int64_t y); |
| void Reply(::fidl::DecodedMessage<fooResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using fooCompleter = ::fidl::Completer<fooCompleterBase>; |
| |
| virtual void foo(::fidl::StringView s, fooCompleter::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; |
| }; |
| |
| extern "C" const fidl_type_t fidl_test_json_subfooRequestTable; |
| extern "C" const fidl_type_t fidl_test_json_subfooResponseTable; |
| |
| class sub final { |
| sub() = delete; |
| |
| public: |
| struct fooResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int64_t y; |
| explicit fooResponse(int64_t y) : y(y) { _InitHeader(); } |
| fooResponse() { _InitHeader(); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_json_subfooResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| 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 = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| |
| private: |
| void _InitHeader(); |
| }; |
| struct fooRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::StringView s; |
| explicit fooRequest(zx_txid_t _txid, const ::fidl::StringView& s) |
| : s(::fidl::unowned_ptr_t<const char>(s.data()), s.size()) { |
| _InitHeader(_txid); |
| } |
| explicit fooRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_json_subfooRequestTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 4294967295; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 4294967295; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool HasPointer = true; |
| static constexpr bool IsResource = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| using ResponseType = fooResponse; |
| |
| 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 foo_Impl final |
| : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| |
| public: |
| foo_Impl(::zx::unowned_channel _client_end, const ::fidl::StringView& s); |
| ~foo_Impl() = default; |
| foo_Impl(foo_Impl&& other) = default; |
| foo_Impl& operator=(foo_Impl&& other) = default; |
| foo_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*; |
| }; |
| |
| public: |
| using foo = foo_Impl<fooResponse>; |
| }; |
| |
| // 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 foo_Impl final |
| : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| |
| public: |
| foo_Impl(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| ~foo_Impl() = default; |
| foo_Impl(foo_Impl&& other) = default; |
| foo_Impl& operator=(foo_Impl&& other) = default; |
| foo_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*; |
| }; |
| |
| public: |
| using foo = foo_Impl<fooResponse>; |
| }; |
| |
| 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 24 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| ResultOf::foo foo(::fidl::StringView s); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::foo foo(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| |
| 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 24 bytes of response buffer on the stack. Request is |
| // heap-allocated. |
| static ResultOf::foo foo(::zx::unowned_channel _client_end, |
| ::fidl::StringView s); |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::foo foo(::zx::unowned_channel _client_end, |
| ::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| }; |
| |
| // 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<fooResponse> foo( |
| ::zx::unowned_channel _client_end, |
| ::fidl::DecodedMessage<fooRequest> params, |
| ::fidl::BytePart response_buffer); |
| |
| static ::fidl::DecodeResult<fooResponse> foo( |
| ::zx::unowned_channel _client_end, |
| ::fidl::EncodedMessage<fooRequest> params, |
| ::fidl::BytePart response_buffer); |
| }; |
| |
| struct AsyncEventHandlers; |
| class fooResponseContext; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = sub; |
| using _Base = ::fidl::CompleterBase; |
| |
| class fooCompleterBase : public _Base { |
| public: |
| void Reply(int64_t y); |
| void Reply(::fidl::BytePart _buffer, int64_t y); |
| void Reply(::fidl::DecodedMessage<fooResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using fooCompleter = ::fidl::Completer<fooCompleterBase>; |
| |
| virtual void foo(::fidl::StringView s, fooCompleter::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; |
| }; |
| |
| } // namespace json |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |
| |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::json::super::fooRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fidl::test::json::super::fooRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::json::super::fooRequest) == |
| ::llcpp::fidl::test::json::super::fooRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::fidl::test::json::super::fooRequest, s) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::json::super::fooResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fidl::test::json::super::fooResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::json::super::fooResponse) == |
| ::llcpp::fidl::test::json::super::fooResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::fidl::test::json::super::fooResponse, y) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::json::sub::fooRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fidl::test::json::sub::fooRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::json::sub::fooRequest) == |
| ::llcpp::fidl::test::json::sub::fooRequest::PrimarySize); |
| static_assert(offsetof(::llcpp::fidl::test::json::sub::fooRequest, s) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::json::sub::fooResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fidl::test::json::sub::fooResponse> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::json::sub::fooResponse) == |
| ::llcpp::fidl::test::json::sub::fooResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::fidl::test::json::sub::fooResponse, y) == 16); |
| |
| } // namespace fidl |
| |
| namespace llcpp { |
| |
| namespace fidl { |
| namespace test { |
| namespace json { |
| |
| struct super::AsyncEventHandlers {}; |
| |
| class super::fooResponseContext : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~fooResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<fooResponse> msg) = 0; |
| |
| protected: |
| fooResponseContext() = default; |
| }; |
| |
| class super::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Asynchronous variant of |super.foo()|. The request and callback are |
| // allocated on the heap. |
| ::fidl::StatusAndError foo(::fidl::StringView s, |
| ::fit::callback<void(int64_t y)> _cb); |
| |
| // Asynchronous variant of |super.foo()|. 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 foo(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| fooResponseContext* _context); |
| // Synchronous variant of |super.foo()|. Allocates 24 bytes of response buffer |
| // on the stack. Request is heap-allocated. |
| ResultOf::foo foo_Sync(::fidl::StringView s); |
| |
| // Synchronous variant of |super.foo()|. Caller provides the backing storage |
| // for FIDL message via request and response buffers. |
| UnownedResultOf::foo foo_Sync(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| |
| private: |
| friend class ::fidl::Client<super>; |
| |
| 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 super::EventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<super>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| struct sub::AsyncEventHandlers {}; |
| |
| class sub::fooResponseContext : public ::fidl::internal::ResponseContext { |
| public: |
| virtual ~fooResponseContext() = default; |
| virtual void OnReply(::fidl::DecodedMessage<fooResponse> msg) = 0; |
| |
| protected: |
| fooResponseContext() = default; |
| }; |
| |
| class sub::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Asynchronous variant of |sub.foo()|. The request and callback are allocated |
| // on the heap. |
| ::fidl::StatusAndError foo(::fidl::StringView s, |
| ::fit::callback<void(int64_t y)> _cb); |
| |
| // Asynchronous variant of |sub.foo()|. 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 foo(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| fooResponseContext* _context); |
| // Synchronous variant of |sub.foo()|. Allocates 24 bytes of response buffer |
| // on the stack. Request is heap-allocated. |
| ResultOf::foo foo_Sync(::fidl::StringView s); |
| |
| // Synchronous variant of |sub.foo()|. Caller provides the backing storage for |
| // FIDL message via request and response buffers. |
| UnownedResultOf::foo foo_Sync(::fidl::BytePart _request_buffer, |
| ::fidl::StringView s, |
| ::fidl::BytePart _response_buffer); |
| |
| private: |
| friend class ::fidl::Client<sub>; |
| |
| 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 sub::EventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<sub>; |
| |
| explicit EventSender(std::weak_ptr<::fidl::internal::AsyncBinding> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncBinding> binding_; |
| }; |
| |
| } // namespace json |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |