| // 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/coding.h> |
| #include <lib/fidl/llcpp/envelope.h> |
| #include <lib/fidl/llcpp/errors.h> |
| #include <lib/fidl/llcpp/memory.h> |
| #include <lib/fidl/llcpp/message.h> |
| #include <lib/fidl/llcpp/message_storage.h> |
| #include <lib/fidl/llcpp/object_view.h> |
| #include <lib/fidl/llcpp/string_view.h> |
| #include <lib/fidl/llcpp/tracking_ptr.h> |
| #include <lib/fidl/llcpp/traits.h> |
| #include <lib/fidl/llcpp/vector_view.h> |
| #include <lib/fit/function.h> |
| #include <lib/fit/optional.h> |
| |
| #include <algorithm> |
| #include <cstddef> |
| #include <variant> |
| #ifdef __Fuchsia__ |
| #include <lib/fidl/llcpp/client.h> |
| #include <lib/fidl/llcpp/client_end.h> |
| #include <lib/fidl/llcpp/connect_service.h> |
| #include <lib/fidl/llcpp/result.h> |
| #include <lib/fidl/llcpp/server.h> |
| #include <lib/fidl/llcpp/server_end.h> |
| #include <lib/fidl/llcpp/service_handler_interface.h> |
| #include <lib/fidl/llcpp/sync_call.h> |
| #include <lib/fidl/llcpp/transaction.h> |
| #include <lib/fidl/txn_header.h> |
| #include <lib/zx/channel.h> |
| #endif // __Fuchsia__ |
| #include <zircon/fidl.h> |
| |
| namespace llcpp { |
| |
| namespace fidl { |
| namespace test { |
| namespace inheritancewithrecursivedecl { |
| |
| class Parent; |
| class Child; |
| |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ParentFirstRequestTable; |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ParentFirstResponseTable; |
| |
| class Parent final { |
| Parent() = delete; |
| |
| public: |
| struct FirstRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::ServerEnd<::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request; |
| explicit FirstRequest( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& request) |
| : request(std::move(request)) { |
| _InitHeader(_txid); |
| } |
| explicit FirstRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_inheritancewithrecursivedecl_ParentFirstRequestTable; |
| 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 ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| void _CloseHandles(); |
| |
| class UnownedEncodedMessage final { |
| public: |
| UnownedEncodedMessage( |
| uint8_t* _bytes, uint32_t _byte_size, zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(_bytes, _byte_size, sizeof(FirstRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| FIDL_ALIGNDECL FirstRequest _request(_txid, request); |
| message_.LinearizeAndEncode<FirstRequest>(&_request); |
| } |
| UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size, |
| FirstRequest* request) |
| : message_(bytes, byte_size, sizeof(FirstRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| message_.LinearizeAndEncode<FirstRequest>(request); |
| } |
| UnownedEncodedMessage(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage(UnownedEncodedMessage&&) = delete; |
| UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| FirstRequest& Message() { |
| return *reinterpret_cast<FirstRequest*>(message_.bytes()); |
| } |
| zx_handle_disposition_t |
| handles_[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| ::fidl::OutgoingMessage message_; |
| }; |
| |
| class OwnedEncodedMessage final { |
| public: |
| explicit OwnedEncodedMessage( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(bytes_, sizeof(bytes_), _txid, request) {} |
| explicit OwnedEncodedMessage(FirstRequest* request) |
| : message_(bytes_, sizeof(bytes_), request) {} |
| OwnedEncodedMessage(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage(OwnedEncodedMessage&&) = delete; |
| OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[PrimarySize + MaxOutOfLine]; |
| UnownedEncodedMessage message_; |
| }; |
| |
| class DecodedMessage final : public ::fidl::internal::IncomingMessage { |
| public: |
| DecodedMessage(uint8_t* bytes, uint32_t byte_actual, |
| zx_handle_info_t* handles = nullptr, |
| uint32_t handle_actual = 0) |
| : ::fidl::internal::IncomingMessage(bytes, byte_actual, handles, |
| handle_actual) { |
| Decode<FirstRequest>(); |
| } |
| DecodedMessage(fidl_incoming_msg_t* msg) |
| : ::fidl::internal::IncomingMessage(msg) { |
| Decode<FirstRequest>(); |
| } |
| DecodedMessage(const DecodedMessage&) = delete; |
| DecodedMessage(DecodedMessage&&) = delete; |
| DecodedMessage* operator=(const DecodedMessage&) = delete; |
| DecodedMessage* operator=(DecodedMessage&&) = delete; |
| ~DecodedMessage() { |
| if (ok() && (PrimaryObject() != nullptr)) { |
| PrimaryObject()->_CloseHandles(); |
| } |
| } |
| |
| FirstRequest* PrimaryObject() { |
| ZX_DEBUG_ASSERT(ok()); |
| return reinterpret_cast<FirstRequest*>(bytes()); |
| } |
| |
| // Release the ownership of the decoded message. That means that the |
| // handles won't be closed When the object is destroyed. After calling |
| // this method, the DecodedMessage object should not be used anymore. |
| void ReleasePrimaryObject() { ResetBytes(); } |
| |
| // These methods should only be used for testing purpose. |
| // They create an DecodedMessage using the bytes of an outgoing message |
| // and copying the handles. |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| UnownedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| OwnedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| |
| private: |
| DecodedMessage(::fidl::OutgoingMessage& outgoing_message) { |
| zx_handle_info_t |
| handles[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| Init(outgoing_message, handles, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)); |
| if (ok()) { |
| Decode<FirstRequest>(); |
| } |
| } |
| }; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| class EventHandlerInterface { |
| public: |
| EventHandlerInterface() = default; |
| virtual ~EventHandlerInterface() = default; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| public: |
| class First final : public ::fidl::Result { |
| public: |
| explicit First( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| _client, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit First(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| First(First&&) = delete; |
| First(const First&) = delete; |
| First* operator=(First&&) = delete; |
| First* operator=(const First&) = delete; |
| ~First() = default; |
| |
| private: |
| }; |
| }; |
| |
| // 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; |
| |
| public: |
| class First final : public ::fidl::Result { |
| public: |
| explicit First( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| _client, |
| uint8_t* _request_bytes, uint32_t _request_byte_capacity, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit First(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| First(First&&) = delete; |
| First(const First&) = delete; |
| First* operator=(First&&) = delete; |
| First* operator=(const First&) = delete; |
| ~First() = default; |
| }; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel or a |
| // const reference to a |
| // |fidl::ClientEnd<::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>|, |
| // avoiding setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::First First( |
| ::fidl::UnownedClientEnd<Parent> _client_end, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::First(_client_end, request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::First First( |
| ::fidl::UnownedClientEnd<Parent> _client_end, |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::First(_client_end, _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| |
| explicit SyncClient(::fidl::ClientEnd<Parent> client_end) |
| : client_end_(std::move(client_end)) {} |
| |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::fidl::ClientEnd<Parent>& client_end() const { return client_end_; } |
| ::fidl::ClientEnd<Parent>& client_end() { return client_end_; } |
| |
| const ::zx::channel& channel() const { return client_end_.channel(); } |
| ::zx::channel* mutable_channel() { return &client_end_.channel(); } |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::First First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::First(this->client_end(), request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::First First( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::First(this->client_end(), _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| |
| private: |
| ::fidl::ClientEnd<Parent> client_end_; |
| }; |
| |
| class AsyncEventHandler; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| // This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>| |
| // and |fidl::ServerEnd<SomeProtocol>|). |
| // TODO(fxbug.dev/65212): Rename this to |Interface| after all users have |
| // migrated to the typed channels API. |
| class TypedChannelInterface |
| : public ::fidl::internal::IncomingMessageDispatcher { |
| public: |
| TypedChannelInterface() = default; |
| virtual ~TypedChannelInterface() = default; |
| |
| // The marker protocol type within which this |TypedChannelInterface| class |
| // is defined. |
| using _EnclosingProtocol = Parent; |
| |
| using FirstCompleter = ::fidl::Completer<>; |
| |
| virtual void First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| FirstCompleter::Sync& _completer) = 0; |
| |
| private: |
| ::fidl::DispatchResult dispatch_message(fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn) final; |
| }; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface : public TypedChannelInterface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| |
| // The marker protocol type within which this |Interface| class is defined. |
| using TypedChannelInterface::_EnclosingProtocol; |
| using TypedChannelInterface::FirstCompleter; |
| |
| virtual void First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| FirstCompleter::Sync& _completer) final { |
| First(std::move(request.channel()), _completer); |
| } |
| |
| // TODO(fxbug.dev/65212): Overriding this method is discouraged since it |
| // uses raw channels instead of |fidl::ClientEnd| and |fidl::ServerEnd|. |
| // Please move to overriding the typed channel overload above instead. |
| virtual void First(::zx::channel request, |
| FirstCompleter::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 ::fidl::DispatchResult TryDispatch(TypedChannelInterface* impl, |
| fidl_incoming_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 ::fidl::DispatchResult Dispatch(TypedChannelInterface* impl, |
| fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |
| // |TypedChannelInterface*|. Only used with |fidl::BindServer| to reduce |
| // template expansion. Do not call this method manually. Use |Dispatch| |
| // instead. |
| static ::fidl::DispatchResult TypeErasedDispatch(void* impl, |
| fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<TypedChannelInterface*>(impl), msg, txn); |
| } |
| |
| class EventSender; |
| class WeakEventSender; |
| }; |
| |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ChildFirstRequestTable; |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ChildFirstResponseTable; |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ChildSecondRequestTable; |
| extern "C" const fidl_type_t |
| fidl_test_inheritancewithrecursivedecl_ChildSecondResponseTable; |
| |
| class Child final { |
| Child() = delete; |
| |
| public: |
| struct FirstRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::ServerEnd<::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request; |
| explicit FirstRequest( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& request) |
| : request(std::move(request)) { |
| _InitHeader(_txid); |
| } |
| explicit FirstRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_inheritancewithrecursivedecl_ChildFirstRequestTable; |
| 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 ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| void _CloseHandles(); |
| |
| class UnownedEncodedMessage final { |
| public: |
| UnownedEncodedMessage( |
| uint8_t* _bytes, uint32_t _byte_size, zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(_bytes, _byte_size, sizeof(FirstRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| FIDL_ALIGNDECL FirstRequest _request(_txid, request); |
| message_.LinearizeAndEncode<FirstRequest>(&_request); |
| } |
| UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size, |
| FirstRequest* request) |
| : message_(bytes, byte_size, sizeof(FirstRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| message_.LinearizeAndEncode<FirstRequest>(request); |
| } |
| UnownedEncodedMessage(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage(UnownedEncodedMessage&&) = delete; |
| UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| FirstRequest& Message() { |
| return *reinterpret_cast<FirstRequest*>(message_.bytes()); |
| } |
| zx_handle_disposition_t |
| handles_[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| ::fidl::OutgoingMessage message_; |
| }; |
| |
| class OwnedEncodedMessage final { |
| public: |
| explicit OwnedEncodedMessage( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(bytes_, sizeof(bytes_), _txid, request) {} |
| explicit OwnedEncodedMessage(FirstRequest* request) |
| : message_(bytes_, sizeof(bytes_), request) {} |
| OwnedEncodedMessage(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage(OwnedEncodedMessage&&) = delete; |
| OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[PrimarySize + MaxOutOfLine]; |
| UnownedEncodedMessage message_; |
| }; |
| |
| class DecodedMessage final : public ::fidl::internal::IncomingMessage { |
| public: |
| DecodedMessage(uint8_t* bytes, uint32_t byte_actual, |
| zx_handle_info_t* handles = nullptr, |
| uint32_t handle_actual = 0) |
| : ::fidl::internal::IncomingMessage(bytes, byte_actual, handles, |
| handle_actual) { |
| Decode<FirstRequest>(); |
| } |
| DecodedMessage(fidl_incoming_msg_t* msg) |
| : ::fidl::internal::IncomingMessage(msg) { |
| Decode<FirstRequest>(); |
| } |
| DecodedMessage(const DecodedMessage&) = delete; |
| DecodedMessage(DecodedMessage&&) = delete; |
| DecodedMessage* operator=(const DecodedMessage&) = delete; |
| DecodedMessage* operator=(DecodedMessage&&) = delete; |
| ~DecodedMessage() { |
| if (ok() && (PrimaryObject() != nullptr)) { |
| PrimaryObject()->_CloseHandles(); |
| } |
| } |
| |
| FirstRequest* PrimaryObject() { |
| ZX_DEBUG_ASSERT(ok()); |
| return reinterpret_cast<FirstRequest*>(bytes()); |
| } |
| |
| // Release the ownership of the decoded message. That means that the |
| // handles won't be closed When the object is destroyed. After calling |
| // this method, the DecodedMessage object should not be used anymore. |
| void ReleasePrimaryObject() { ResetBytes(); } |
| |
| // These methods should only be used for testing purpose. |
| // They create an DecodedMessage using the bytes of an outgoing message |
| // and copying the handles. |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| UnownedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| OwnedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| |
| private: |
| DecodedMessage(::fidl::OutgoingMessage& outgoing_message) { |
| zx_handle_info_t |
| handles[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| Init(outgoing_message, handles, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)); |
| if (ok()) { |
| Decode<FirstRequest>(); |
| } |
| } |
| }; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| struct SecondRequest final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::ServerEnd<::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request; |
| explicit SecondRequest( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& request) |
| : request(std::move(request)) { |
| _InitHeader(_txid); |
| } |
| explicit SecondRequest(zx_txid_t _txid) { _InitHeader(_txid); } |
| |
| static constexpr const fidl_type_t* Type = |
| &fidl_test_inheritancewithrecursivedecl_ChildSecondRequestTable; |
| 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 ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kRequest; |
| void _CloseHandles(); |
| |
| class UnownedEncodedMessage final { |
| public: |
| UnownedEncodedMessage( |
| uint8_t* _bytes, uint32_t _byte_size, zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(_bytes, _byte_size, sizeof(SecondRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| FIDL_ALIGNDECL SecondRequest _request(_txid, request); |
| message_.LinearizeAndEncode<SecondRequest>(&_request); |
| } |
| UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size, |
| SecondRequest* request) |
| : message_(bytes, byte_size, sizeof(SecondRequest), handles_, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles), 0) { |
| message_.LinearizeAndEncode<SecondRequest>(request); |
| } |
| UnownedEncodedMessage(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage(UnownedEncodedMessage&&) = delete; |
| UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete; |
| UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| SecondRequest& Message() { |
| return *reinterpret_cast<SecondRequest*>(message_.bytes()); |
| } |
| zx_handle_disposition_t |
| handles_[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| ::fidl::OutgoingMessage message_; |
| }; |
| |
| class OwnedEncodedMessage final { |
| public: |
| explicit OwnedEncodedMessage( |
| zx_txid_t _txid, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request) |
| : message_(bytes_, sizeof(bytes_), _txid, request) {} |
| explicit OwnedEncodedMessage(SecondRequest* request) |
| : message_(bytes_, sizeof(bytes_), request) {} |
| OwnedEncodedMessage(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage(OwnedEncodedMessage&&) = delete; |
| OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete; |
| OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| template <typename ChannelLike> |
| void Write(ChannelLike&& client) { |
| message_.Write(std::forward<ChannelLike>(client)); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[PrimarySize + MaxOutOfLine]; |
| UnownedEncodedMessage message_; |
| }; |
| |
| class DecodedMessage final : public ::fidl::internal::IncomingMessage { |
| public: |
| DecodedMessage(uint8_t* bytes, uint32_t byte_actual, |
| zx_handle_info_t* handles = nullptr, |
| uint32_t handle_actual = 0) |
| : ::fidl::internal::IncomingMessage(bytes, byte_actual, handles, |
| handle_actual) { |
| Decode<SecondRequest>(); |
| } |
| DecodedMessage(fidl_incoming_msg_t* msg) |
| : ::fidl::internal::IncomingMessage(msg) { |
| Decode<SecondRequest>(); |
| } |
| DecodedMessage(const DecodedMessage&) = delete; |
| DecodedMessage(DecodedMessage&&) = delete; |
| DecodedMessage* operator=(const DecodedMessage&) = delete; |
| DecodedMessage* operator=(DecodedMessage&&) = delete; |
| ~DecodedMessage() { |
| if (ok() && (PrimaryObject() != nullptr)) { |
| PrimaryObject()->_CloseHandles(); |
| } |
| } |
| |
| SecondRequest* PrimaryObject() { |
| ZX_DEBUG_ASSERT(ok()); |
| return reinterpret_cast<SecondRequest*>(bytes()); |
| } |
| |
| // Release the ownership of the decoded message. That means that the |
| // handles won't be closed When the object is destroyed. After calling |
| // this method, the DecodedMessage object should not be used anymore. |
| void ReleasePrimaryObject() { ResetBytes(); } |
| |
| // These methods should only be used for testing purpose. |
| // They create an DecodedMessage using the bytes of an outgoing message |
| // and copying the handles. |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| UnownedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| static DecodedMessage FromOutgoingWithRawHandleCopy( |
| OwnedEncodedMessage* encoded_message) { |
| return DecodedMessage(encoded_message->GetOutgoingMessage()); |
| } |
| |
| private: |
| DecodedMessage(::fidl::OutgoingMessage& outgoing_message) { |
| zx_handle_info_t |
| handles[std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)]; |
| Init(outgoing_message, handles, |
| std::min(ZX_CHANNEL_MAX_MSG_HANDLES, MaxNumHandles)); |
| if (ok()) { |
| Decode<SecondRequest>(); |
| } |
| } |
| }; |
| |
| private: |
| void _InitHeader(zx_txid_t _txid); |
| }; |
| |
| class EventHandlerInterface { |
| public: |
| EventHandlerInterface() = default; |
| virtual ~EventHandlerInterface() = default; |
| }; |
| |
| // Collection of return types of FIDL calls in this protocol. |
| class ResultOf final { |
| ResultOf() = delete; |
| |
| public: |
| class First final : public ::fidl::Result { |
| public: |
| explicit First( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child> |
| _client, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit First(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| First(First&&) = delete; |
| First(const First&) = delete; |
| First* operator=(First&&) = delete; |
| First* operator=(const First&) = delete; |
| ~First() = default; |
| |
| private: |
| }; |
| class Second final : public ::fidl::Result { |
| public: |
| explicit Second( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child> |
| _client, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit Second(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| Second(Second&&) = delete; |
| Second(const Second&) = delete; |
| Second* operator=(Second&&) = delete; |
| Second* operator=(const Second&) = delete; |
| ~Second() = default; |
| |
| private: |
| }; |
| }; |
| |
| // 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; |
| |
| public: |
| class First final : public ::fidl::Result { |
| public: |
| explicit First( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child> |
| _client, |
| uint8_t* _request_bytes, uint32_t _request_byte_capacity, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit First(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| First(First&&) = delete; |
| First(const First&) = delete; |
| First* operator=(First&&) = delete; |
| First* operator=(const First&) = delete; |
| ~First() = default; |
| }; |
| class Second final : public ::fidl::Result { |
| public: |
| explicit Second( |
| ::fidl::UnownedClientEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child> |
| _client, |
| uint8_t* _request_bytes, uint32_t _request_byte_capacity, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent>& |
| request); |
| explicit Second(const ::fidl::Result& result) : ::fidl::Result(result) {} |
| Second(Second&&) = delete; |
| Second(const Second&) = delete; |
| Second* operator=(Second&&) = delete; |
| Second* operator=(const Second&) = delete; |
| ~Second() = default; |
| }; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel or a |
| // const reference to a |
| // |fidl::ClientEnd<::llcpp::fidl::test::inheritancewithrecursivedecl::Child>|, |
| // avoiding setting up a client. |
| class Call final { |
| Call() = delete; |
| |
| public: |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::First First( |
| ::fidl::UnownedClientEnd<Child> _client_end, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::First(_client_end, request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::First First( |
| ::fidl::UnownedClientEnd<Child> _client_end, |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::First(_client_end, _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| static ResultOf::Second Second( |
| ::fidl::UnownedClientEnd<Child> _client_end, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::Second(_client_end, request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| static UnownedResultOf::Second Second( |
| ::fidl::UnownedClientEnd<Child> _client_end, |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::Second(_client_end, _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| }; |
| |
| class SyncClient final { |
| public: |
| SyncClient() = default; |
| |
| explicit SyncClient(::fidl::ClientEnd<Child> client_end) |
| : client_end_(std::move(client_end)) {} |
| |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::fidl::ClientEnd<Child>& client_end() const { return client_end_; } |
| ::fidl::ClientEnd<Child>& client_end() { return client_end_; } |
| |
| const ::zx::channel& channel() const { return client_end_.channel(); } |
| ::zx::channel* mutable_channel() { return &client_end_.channel(); } |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::First First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::First(this->client_end(), request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::First First( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::First(this->client_end(), _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ResultOf::Second Second( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return ResultOf::Second(this->client_end(), request); |
| } |
| |
| // Caller provides the backing storage for FIDL message via request and |
| // response buffers. |
| UnownedResultOf::Second Second( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request) { |
| return UnownedResultOf::Second(this->client_end(), _request_buffer.data, |
| _request_buffer.capacity, request); |
| } |
| |
| private: |
| ::fidl::ClientEnd<Child> client_end_; |
| }; |
| |
| class AsyncEventHandler; |
| class ClientImpl; |
| |
| // Pure-virtual interface to be implemented by a server. |
| // This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>| |
| // and |fidl::ServerEnd<SomeProtocol>|). |
| // TODO(fxbug.dev/65212): Rename this to |Interface| after all users have |
| // migrated to the typed channels API. |
| class TypedChannelInterface |
| : public ::fidl::internal::IncomingMessageDispatcher { |
| public: |
| TypedChannelInterface() = default; |
| virtual ~TypedChannelInterface() = default; |
| |
| // The marker protocol type within which this |TypedChannelInterface| class |
| // is defined. |
| using _EnclosingProtocol = Child; |
| |
| using FirstCompleter = ::fidl::Completer<>; |
| |
| virtual void First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| FirstCompleter::Sync& _completer) = 0; |
| |
| using SecondCompleter = ::fidl::Completer<>; |
| |
| virtual void Second( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| SecondCompleter::Sync& _completer) = 0; |
| |
| private: |
| ::fidl::DispatchResult dispatch_message(fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn) final; |
| }; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface : public TypedChannelInterface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| |
| // The marker protocol type within which this |Interface| class is defined. |
| using TypedChannelInterface::_EnclosingProtocol; |
| using TypedChannelInterface::FirstCompleter; |
| |
| virtual void First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| FirstCompleter::Sync& _completer) final { |
| First(std::move(request.channel()), _completer); |
| } |
| |
| // TODO(fxbug.dev/65212): Overriding this method is discouraged since it |
| // uses raw channels instead of |fidl::ClientEnd| and |fidl::ServerEnd|. |
| // Please move to overriding the typed channel overload above instead. |
| virtual void First(::zx::channel request, |
| FirstCompleter::Sync& _completer) = 0; |
| |
| using TypedChannelInterface::SecondCompleter; |
| |
| virtual void Second( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request, |
| SecondCompleter::Sync& _completer) final { |
| Second(std::move(request.channel()), _completer); |
| } |
| |
| // TODO(fxbug.dev/65212): Overriding this method is discouraged since it |
| // uses raw channels instead of |fidl::ClientEnd| and |fidl::ServerEnd|. |
| // Please move to overriding the typed channel overload above instead. |
| virtual void Second(::zx::channel request, |
| SecondCompleter::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 ::fidl::DispatchResult TryDispatch(TypedChannelInterface* impl, |
| fidl_incoming_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 ::fidl::DispatchResult Dispatch(TypedChannelInterface* impl, |
| fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |
| // |TypedChannelInterface*|. Only used with |fidl::BindServer| to reduce |
| // template expansion. Do not call this method manually. Use |Dispatch| |
| // instead. |
| static ::fidl::DispatchResult TypeErasedDispatch(void* impl, |
| fidl_incoming_msg_t* msg, |
| ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<TypedChannelInterface*>(impl), msg, txn); |
| } |
| |
| class EventSender; |
| class WeakEventSender; |
| }; |
| |
| } // namespace inheritancewithrecursivedecl |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |
| |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent::FirstRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent::FirstRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::inheritancewithrecursivedecl::Parent:: |
| FirstRequest) == |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent:: |
| FirstRequest::PrimarySize); |
| static_assert( |
| offsetof( |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent::FirstRequest, |
| request) == 16); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::FirstRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::FirstRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::inheritancewithrecursivedecl::Child:: |
| FirstRequest) == |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child:: |
| FirstRequest::PrimarySize); |
| static_assert( |
| offsetof( |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::FirstRequest, |
| request) == 16); |
| |
| template <> |
| struct IsFidlType< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::SecondRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsFidlMessage< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::SecondRequest> |
| : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fidl::test::inheritancewithrecursivedecl::Child:: |
| SecondRequest) == |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child:: |
| SecondRequest::PrimarySize); |
| static_assert( |
| offsetof( |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child::SecondRequest, |
| request) == 16); |
| |
| } // namespace fidl |
| |
| namespace llcpp { |
| |
| namespace fidl { |
| namespace test { |
| namespace inheritancewithrecursivedecl { |
| |
| class Parent::AsyncEventHandler : public Parent::EventHandlerInterface { |
| public: |
| AsyncEventHandler() = default; |
| |
| virtual void Unbound(::fidl::UnbindInfo info) {} |
| }; |
| |
| class Parent::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::Result First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| // Caller provides the backing storage for FIDL message via request buffer. |
| ::fidl::Result First( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| AsyncEventHandler* event_handler() const { return event_handler_.get(); } |
| |
| private: |
| friend class ::fidl::Client<Parent>; |
| |
| explicit ClientImpl(std::shared_ptr<AsyncEventHandler> event_handler) |
| : event_handler_(std::move(event_handler)) {} |
| |
| std::optional<::fidl::UnbindInfo> DispatchEvent( |
| fidl_incoming_msg_t* msg) override; |
| |
| std::shared_ptr<AsyncEventHandler> event_handler_; |
| }; |
| |
| // |EventSender| owns a server endpoint of a channel speaking |
| // the Parent protocol, and can send events in that protocol. |
| class Parent::EventSender { |
| public: |
| // Constructs an event sender with an invalid channel. |
| EventSender() = default; |
| |
| explicit EventSender( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| server_end) |
| : server_end_(std::move(server_end)) {} |
| |
| // The underlying server channel endpoint, which may be replaced at run-time. |
| const ::fidl::ServerEnd<Parent>& server_end() const { return server_end_; } |
| ::fidl::ServerEnd<Parent>& server_end() { return server_end_; } |
| |
| const ::zx::channel& channel() const { return server_end_.channel(); } |
| ::zx::channel& channel() { return server_end_.channel(); } |
| |
| // Whether the underlying channel is valid. |
| bool is_valid() const { return server_end_.is_valid(); } |
| |
| private: |
| ::fidl::ServerEnd<Parent> server_end_; |
| }; |
| |
| class Parent::WeakEventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<Parent>; |
| |
| explicit WeakEventSender( |
| std::weak_ptr<::fidl::internal::AsyncServerBinding<Parent>> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncServerBinding<Parent>> binding_; |
| }; |
| |
| class Child::AsyncEventHandler : public Child::EventHandlerInterface { |
| public: |
| AsyncEventHandler() = default; |
| |
| virtual void Unbound(::fidl::UnbindInfo info) {} |
| }; |
| |
| class Child::ClientImpl final : private ::fidl::internal::ClientBase { |
| public: |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::Result First( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| // Caller provides the backing storage for FIDL message via request buffer. |
| ::fidl::Result First( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| // Allocates 24 bytes of message buffer on the stack. No heap allocation |
| // necessary. |
| ::fidl::Result Second( |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| // Caller provides the backing storage for FIDL message via request buffer. |
| ::fidl::Result Second( |
| ::fidl::BufferSpan _request_buffer, |
| ::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Parent> |
| request); |
| |
| AsyncEventHandler* event_handler() const { return event_handler_.get(); } |
| |
| private: |
| friend class ::fidl::Client<Child>; |
| |
| explicit ClientImpl(std::shared_ptr<AsyncEventHandler> event_handler) |
| : event_handler_(std::move(event_handler)) {} |
| |
| std::optional<::fidl::UnbindInfo> DispatchEvent( |
| fidl_incoming_msg_t* msg) override; |
| |
| std::shared_ptr<AsyncEventHandler> event_handler_; |
| }; |
| |
| // |EventSender| owns a server endpoint of a channel speaking |
| // the Child protocol, and can send events in that protocol. |
| class Child::EventSender { |
| public: |
| // Constructs an event sender with an invalid channel. |
| EventSender() = default; |
| |
| explicit EventSender(::fidl::ServerEnd< |
| ::llcpp::fidl::test::inheritancewithrecursivedecl::Child> |
| server_end) |
| : server_end_(std::move(server_end)) {} |
| |
| // The underlying server channel endpoint, which may be replaced at run-time. |
| const ::fidl::ServerEnd<Child>& server_end() const { return server_end_; } |
| ::fidl::ServerEnd<Child>& server_end() { return server_end_; } |
| |
| const ::zx::channel& channel() const { return server_end_.channel(); } |
| ::zx::channel& channel() { return server_end_.channel(); } |
| |
| // Whether the underlying channel is valid. |
| bool is_valid() const { return server_end_.is_valid(); } |
| |
| private: |
| ::fidl::ServerEnd<Child> server_end_; |
| }; |
| |
| class Child::WeakEventSender { |
| public: |
| private: |
| friend class ::fidl::ServerBindingRef<Child>; |
| |
| explicit WeakEventSender( |
| std::weak_ptr<::fidl::internal::AsyncServerBinding<Child>> binding) |
| : binding_(std::move(binding)) {} |
| |
| std::weak_ptr<::fidl::internal::AsyncServerBinding<Child>> binding_; |
| }; |
| |
| } // namespace inheritancewithrecursivedecl |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |