blob: 3910d47050c6ac6bfdc86a483852baba1e456040 [file] [log] [blame]
// 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/coding.h>
#include <lib/fidl/llcpp/envelope.h>
#include <lib/fidl/llcpp/errors.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/traits.h>
#include <lib/fidl/llcpp/vector_view.h>
#include <lib/fit/function.h>
#include <lib/stdcompat/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/llcpp/wire_messaging.h>
#include <lib/fidl/txn_header.h>
#include <lib/zx/channel.h>
#endif // __Fuchsia__
#include <zircon/fidl.h>
namespace fidl_test_service {
class SecondProtocol;
class FirstProtocol;
class SingleMemberService;
class MultiHomogeneousMemberService;
class MultiHeterogeneousMemberService;
class EmptyService;
extern "C" const fidl_type_t
fidl_test_service_SecondProtocolMethodOnSecondRequestTable;
extern "C" const fidl_type_t
fidl_test_service_SecondProtocolMethodOnSecondResponseTable;
class SecondProtocol final {
SecondProtocol() = delete;
public:
class MethodOnSecond final {
MethodOnSecond() = delete;
};
};
} // namespace fidl_test_service
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::ProtocolDetails<::fidl_test_service::SecondProtocol> {
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::WireDispatcher<::fidl_test_service::SecondProtocol>
final {
WireDispatcher() = delete;
static ::fidl::DispatchResult TryDispatch(
::fidl::WireInterface<::fidl_test_service::SecondProtocol>* impl,
fidl_incoming_msg_t* msg, ::fidl::Transaction* txn);
static ::fidl::DispatchResult Dispatch(
::fidl::WireInterface<::fidl_test_service::SecondProtocol>* impl,
fidl_incoming_msg_t* msg, ::fidl::Transaction* txn);
};
#endif // __Fuchsia__
template <>
struct ::fidl::WireRequest<::fidl_test_service::SecondProtocol::MethodOnSecond>
final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
explicit WireRequest(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 ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* _bytes, uint32_t _byte_size, zx_txid_t _txid)
: message_(_bytes, _byte_size, sizeof(WireRequest), nullptr, 0, 0) {
FIDL_ALIGNDECL WireRequest _request(_txid);
message_.Encode<WireRequest>(&_request);
}
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
WireRequest* request)
: message_(bytes, byte_size, sizeof(WireRequest), nullptr, 0, 0) {
message_.Encode<WireRequest>(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 // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
#ifdef __Fuchsia__
template <typename ChannelLike>
void Write(ChannelLike&& client) {
message_.Write(std::forward<ChannelLike>(client));
}
#endif // __Fuchsia__
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(zx_txid_t _txid)
: message_(bytes_.data(), bytes_.size(), _txid) {}
explicit OwnedEncodedMessage(WireRequest* request)
: message_(bytes_.data(), bytes_.size(), 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 // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
#ifdef __Fuchsia__
template <typename ChannelLike>
void Write(ChannelLike&& client) {
message_.Write(std::forward<ChannelLike>(client));
}
#endif // __Fuchsia__
private:
::fidl::internal::InlineMessageBuffer<16> bytes_;
UnownedEncodedMessage message_;
};
public:
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<WireRequest>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<WireRequest>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
WireRequest* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<WireRequest*>(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(); }
};
private:
void _InitHeader(zx_txid_t _txid);
};
template <>
class ::fidl::WireResult<::fidl_test_service::SecondProtocol::MethodOnSecond>
final : public ::fidl::Result {
public:
explicit WireResult(
::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol> _client);
explicit WireResult(const ::fidl::Result& result) : ::fidl::Result(result) {}
WireResult(WireResult&&) = delete;
WireResult(const WireResult&) = delete;
WireResult* operator=(WireResult&&) = delete;
WireResult* operator=(const WireResult&) = delete;
~WireResult() = default;
private:
};
template <>
class ::fidl::WireUnownedResult<
::fidl_test_service::SecondProtocol::MethodOnSecond>
final : public ::fidl::Result {
public:
explicit WireUnownedResult(
::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol> _client);
explicit WireUnownedResult(const ::fidl::Result& result)
: ::fidl::Result(result) {}
WireUnownedResult(WireUnownedResult&&) = delete;
WireUnownedResult(const WireUnownedResult&) = delete;
WireUnownedResult* operator=(WireUnownedResult&&) = delete;
WireUnownedResult* operator=(const WireUnownedResult&) = delete;
~WireUnownedResult() = default;
};
// Methods to make a sync FIDL call directly on an unowned channel or a
// const reference to a |fidl::ClientEnd<::fidl_test_service::SecondProtocol>|,
// avoiding setting up a client.
template <>
class ::fidl::internal::WireCaller<::fidl_test_service::SecondProtocol> final {
public:
explicit WireCaller(
::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol> client_end)
: client_end_(client_end) {}
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
static ::fidl::WireResult<::fidl_test_service::SecondProtocol::MethodOnSecond>
MethodOnSecond(::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol>
_client_end) {
return ::fidl::WireResult<
::fidl_test_service::SecondProtocol::MethodOnSecond>(_client_end);
}
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::WireResult<::fidl_test_service::SecondProtocol::MethodOnSecond>
MethodOnSecond() && {
return ::fidl::WireResult<
::fidl_test_service::SecondProtocol::MethodOnSecond>(client_end_);
}
private:
::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol> client_end_;
};
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::SecondProtocol> {
public:
WireEventHandlerInterface() = default;
virtual ~WireEventHandlerInterface() = default;
};
template <>
class ::fidl::WireAsyncEventHandler<::fidl_test_service::SecondProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::SecondProtocol> {
public:
WireAsyncEventHandler() = default;
virtual void Unbound(::fidl::UnbindInfo info) {}
};
template <>
class ::fidl::WireSyncEventHandler<::fidl_test_service::SecondProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::SecondProtocol> {
public:
WireSyncEventHandler() = default;
// Method called when an unknown event is found. This methods gives the status
// which, in this case, is returned by HandleOneEvent.
virtual zx_status_t Unknown() = 0;
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the
// corresponding virtual method.
::fidl::Result HandleOneEvent(
::fidl::UnownedClientEnd<::fidl_test_service::SecondProtocol> client_end);
};
#endif // __Fuchsia__
template <>
class ::fidl::WireSyncClient<::fidl_test_service::SecondProtocol> final {
public:
WireSyncClient() = default;
explicit WireSyncClient(
::fidl::ClientEnd<::fidl_test_service::SecondProtocol> client_end)
: client_end_(std::move(client_end)) {}
~WireSyncClient() = default;
WireSyncClient(WireSyncClient&&) = default;
WireSyncClient& operator=(WireSyncClient&&) = default;
const ::fidl::ClientEnd<::fidl_test_service::SecondProtocol>& client_end()
const {
return client_end_;
}
::fidl::ClientEnd<::fidl_test_service::SecondProtocol>& client_end() {
return client_end_;
}
const ::zx::channel& channel() const { return client_end_.channel(); }
::zx::channel* mutable_channel() { return &client_end_.channel(); }
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::WireResult<::fidl_test_service::SecondProtocol::MethodOnSecond>
MethodOnSecond() {
return ::fidl::WireResult<
::fidl_test_service::SecondProtocol::MethodOnSecond>(
this->client_end());
}
private:
::fidl::ClientEnd<::fidl_test_service::SecondProtocol> client_end_;
};
// Pure-virtual interface to be implemented by a server.
// This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>|
// and |fidl::ServerEnd<SomeProtocol>|).
template <>
class ::fidl::WireInterface<::fidl_test_service::SecondProtocol>
: public ::fidl::internal::IncomingMessageDispatcher {
public:
WireInterface() = default;
virtual ~WireInterface() = default;
// The marker protocol type within which this |WireInterface| class is
// defined.
using _EnclosingProtocol = ::fidl_test_service::SecondProtocol;
using MethodOnSecondCompleter = ::fidl::Completer<>;
virtual void MethodOnSecond(MethodOnSecondCompleter::Sync& _completer) = 0;
private:
::fidl::DispatchResult dispatch_message(fidl_incoming_msg_t* msg,
::fidl::Transaction* txn) final;
};
namespace fidl_test_service {
extern "C" const fidl_type_t
fidl_test_service_FirstProtocolMethodOnFirstRequestTable;
extern "C" const fidl_type_t
fidl_test_service_FirstProtocolMethodOnFirstResponseTable;
class FirstProtocol final {
FirstProtocol() = delete;
public:
class MethodOnFirst final {
MethodOnFirst() = delete;
};
};
} // namespace fidl_test_service
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::ProtocolDetails<::fidl_test_service::FirstProtocol> {};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
struct ::fidl::internal::WireDispatcher<::fidl_test_service::FirstProtocol>
final {
WireDispatcher() = delete;
static ::fidl::DispatchResult TryDispatch(
::fidl::WireInterface<::fidl_test_service::FirstProtocol>* impl,
fidl_incoming_msg_t* msg, ::fidl::Transaction* txn);
static ::fidl::DispatchResult Dispatch(
::fidl::WireInterface<::fidl_test_service::FirstProtocol>* impl,
fidl_incoming_msg_t* msg, ::fidl::Transaction* txn);
};
#endif // __Fuchsia__
template <>
struct ::fidl::WireRequest<::fidl_test_service::FirstProtocol::MethodOnFirst>
final {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
explicit WireRequest(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 ::fidl::internal::TransactionalMessageKind MessageKind =
::fidl::internal::TransactionalMessageKind::kRequest;
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* _bytes, uint32_t _byte_size, zx_txid_t _txid)
: message_(_bytes, _byte_size, sizeof(WireRequest), nullptr, 0, 0) {
FIDL_ALIGNDECL WireRequest _request(_txid);
message_.Encode<WireRequest>(&_request);
}
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
WireRequest* request)
: message_(bytes, byte_size, sizeof(WireRequest), nullptr, 0, 0) {
message_.Encode<WireRequest>(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 // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
#ifdef __Fuchsia__
template <typename ChannelLike>
void Write(ChannelLike&& client) {
message_.Write(std::forward<ChannelLike>(client));
}
#endif // __Fuchsia__
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(zx_txid_t _txid)
: message_(bytes_.data(), bytes_.size(), _txid) {}
explicit OwnedEncodedMessage(WireRequest* request)
: message_(bytes_.data(), bytes_.size(), 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 // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
#ifdef __Fuchsia__
template <typename ChannelLike>
void Write(ChannelLike&& client) {
message_.Write(std::forward<ChannelLike>(client));
}
#endif // __Fuchsia__
private:
::fidl::internal::InlineMessageBuffer<16> bytes_;
UnownedEncodedMessage message_;
};
public:
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<WireRequest>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<WireRequest>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
WireRequest* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<WireRequest*>(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(); }
};
private:
void _InitHeader(zx_txid_t _txid);
};
template <>
class ::fidl::WireResult<::fidl_test_service::FirstProtocol::MethodOnFirst>
final : public ::fidl::Result {
public:
explicit WireResult(
::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol> _client);
explicit WireResult(const ::fidl::Result& result) : ::fidl::Result(result) {}
WireResult(WireResult&&) = delete;
WireResult(const WireResult&) = delete;
WireResult* operator=(WireResult&&) = delete;
WireResult* operator=(const WireResult&) = delete;
~WireResult() = default;
private:
};
template <>
class ::fidl::WireUnownedResult<
::fidl_test_service::FirstProtocol::MethodOnFirst>
final : public ::fidl::Result {
public:
explicit WireUnownedResult(
::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol> _client);
explicit WireUnownedResult(const ::fidl::Result& result)
: ::fidl::Result(result) {}
WireUnownedResult(WireUnownedResult&&) = delete;
WireUnownedResult(const WireUnownedResult&) = delete;
WireUnownedResult* operator=(WireUnownedResult&&) = delete;
WireUnownedResult* operator=(const WireUnownedResult&) = delete;
~WireUnownedResult() = default;
};
// Methods to make a sync FIDL call directly on an unowned channel or a
// const reference to a |fidl::ClientEnd<::fidl_test_service::FirstProtocol>|,
// avoiding setting up a client.
template <>
class ::fidl::internal::WireCaller<::fidl_test_service::FirstProtocol> final {
public:
explicit WireCaller(
::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol> client_end)
: client_end_(client_end) {}
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
static ::fidl::WireResult<::fidl_test_service::FirstProtocol::MethodOnFirst>
MethodOnFirst(::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol>
_client_end) {
return ::fidl::WireResult<
::fidl_test_service::FirstProtocol::MethodOnFirst>(_client_end);
}
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::WireResult<::fidl_test_service::FirstProtocol::MethodOnFirst>
MethodOnFirst() && {
return ::fidl::WireResult<
::fidl_test_service::FirstProtocol::MethodOnFirst>(client_end_);
}
private:
::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol> client_end_;
};
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::FirstProtocol> {
public:
WireEventHandlerInterface() = default;
virtual ~WireEventHandlerInterface() = default;
};
template <>
class ::fidl::WireAsyncEventHandler<::fidl_test_service::FirstProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::FirstProtocol> {
public:
WireAsyncEventHandler() = default;
virtual void Unbound(::fidl::UnbindInfo info) {}
};
template <>
class ::fidl::WireSyncEventHandler<::fidl_test_service::FirstProtocol>
: public ::fidl::internal::WireEventHandlerInterface<
::fidl_test_service::FirstProtocol> {
public:
WireSyncEventHandler() = default;
// Method called when an unknown event is found. This methods gives the status
// which, in this case, is returned by HandleOneEvent.
virtual zx_status_t Unknown() = 0;
// Handle all possible events defined in this protocol.
// Blocks to consume exactly one message from the channel, then call the
// corresponding virtual method.
::fidl::Result HandleOneEvent(
::fidl::UnownedClientEnd<::fidl_test_service::FirstProtocol> client_end);
};
#endif // __Fuchsia__
template <>
class ::fidl::WireSyncClient<::fidl_test_service::FirstProtocol> final {
public:
WireSyncClient() = default;
explicit WireSyncClient(
::fidl::ClientEnd<::fidl_test_service::FirstProtocol> client_end)
: client_end_(std::move(client_end)) {}
~WireSyncClient() = default;
WireSyncClient(WireSyncClient&&) = default;
WireSyncClient& operator=(WireSyncClient&&) = default;
const ::fidl::ClientEnd<::fidl_test_service::FirstProtocol>& client_end()
const {
return client_end_;
}
::fidl::ClientEnd<::fidl_test_service::FirstProtocol>& client_end() {
return client_end_;
}
const ::zx::channel& channel() const { return client_end_.channel(); }
::zx::channel* mutable_channel() { return &client_end_.channel(); }
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::WireResult<::fidl_test_service::FirstProtocol::MethodOnFirst>
MethodOnFirst() {
return ::fidl::WireResult<
::fidl_test_service::FirstProtocol::MethodOnFirst>(this->client_end());
}
private:
::fidl::ClientEnd<::fidl_test_service::FirstProtocol> client_end_;
};
// Pure-virtual interface to be implemented by a server.
// This interface uses typed channels (i.e. |fidl::ClientEnd<SomeProtocol>|
// and |fidl::ServerEnd<SomeProtocol>|).
template <>
class ::fidl::WireInterface<::fidl_test_service::FirstProtocol>
: public ::fidl::internal::IncomingMessageDispatcher {
public:
WireInterface() = default;
virtual ~WireInterface() = default;
// The marker protocol type within which this |WireInterface| class is
// defined.
using _EnclosingProtocol = ::fidl_test_service::FirstProtocol;
using MethodOnFirstCompleter = ::fidl::Completer<>;
virtual void MethodOnFirst(MethodOnFirstCompleter::Sync& _completer) = 0;
private:
::fidl::DispatchResult dispatch_message(fidl_incoming_msg_t* msg,
::fidl::Transaction* txn) final;
};
namespace fidl_test_service {
class SingleMemberService final {
SingleMemberService() = default;
public:
static constexpr char Name[] = "fidl.test.service.SingleMemberService";
// Client protocol for connecting to member protocols of a service instance.
class ServiceClient final {
ServiceClient() = delete;
public:
ServiceClient(::zx::channel dir,
::fidl::internal::ConnectMemberFunc connect_func)
: dir_(std::move(dir)), connect_func_(connect_func) {}
// Connects to the member protocol "single_member".
// Returns a |fidl::ClientEnd<::fidl_test_service::FirstProtocol>| on
// success, which can be used with |fidl::BindSyncClient| to create a
// synchronous client, or |fidl::Client| to create a client that supports
// both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::fidl_test_service::FirstProtocol>>
connect_single_member() {
auto endpoints =
::fidl::CreateEndpoints<::fidl_test_service::FirstProtocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection = connect_func_(::zx::unowned_channel(dir_),
::fidl::StringView("single_member"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
private:
::zx::channel dir_;
::fidl::internal::ConnectMemberFunc connect_func_;
};
// Facilitates member protocol registration for servers.
class Handler final {
public:
// Constructs a FIDL Service-typed handler. Does not take ownership of
// |service_handler|.
explicit Handler(::fidl::ServiceHandlerInterface* service_handler)
: service_handler_(service_handler) {}
// Adds member "single_member" to the service instance. |handler| will be
// invoked on connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_single_member(
::fidl::ServiceHandlerInterface::MemberHandler<
::fidl_test_service::FirstProtocol>
handler) {
return service_handler_->AddMember("single_member", std::move(handler));
}
private:
::fidl::ServiceHandlerInterface* service_handler_; // Not owned.
};
};
class MultiHomogeneousMemberService final {
MultiHomogeneousMemberService() = default;
public:
static constexpr char Name[] =
"fidl.test.service.MultiHomogeneousMemberService";
// Client protocol for connecting to member protocols of a service instance.
class ServiceClient final {
ServiceClient() = delete;
public:
ServiceClient(::zx::channel dir,
::fidl::internal::ConnectMemberFunc connect_func)
: dir_(std::move(dir)), connect_func_(connect_func) {}
// Connects to the member protocol "first_member".
// Returns a |fidl::ClientEnd<::fidl_test_service::FirstProtocol>| on
// success, which can be used with |fidl::BindSyncClient| to create a
// synchronous client, or |fidl::Client| to create a client that supports
// both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::fidl_test_service::FirstProtocol>>
connect_first_member() {
auto endpoints =
::fidl::CreateEndpoints<::fidl_test_service::FirstProtocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection = connect_func_(::zx::unowned_channel(dir_),
::fidl::StringView("first_member"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
// Connects to the member protocol "second_member".
// Returns a |fidl::ClientEnd<::fidl_test_service::FirstProtocol>| on
// success, which can be used with |fidl::BindSyncClient| to create a
// synchronous client, or |fidl::Client| to create a client that supports
// both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::fidl_test_service::FirstProtocol>>
connect_second_member() {
auto endpoints =
::fidl::CreateEndpoints<::fidl_test_service::FirstProtocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection = connect_func_(::zx::unowned_channel(dir_),
::fidl::StringView("second_member"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
private:
::zx::channel dir_;
::fidl::internal::ConnectMemberFunc connect_func_;
};
// Facilitates member protocol registration for servers.
class Handler final {
public:
// Constructs a FIDL Service-typed handler. Does not take ownership of
// |service_handler|.
explicit Handler(::fidl::ServiceHandlerInterface* service_handler)
: service_handler_(service_handler) {}
// Adds member "first_member" to the service instance. |handler| will be
// invoked on connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_first_member(
::fidl::ServiceHandlerInterface::MemberHandler<
::fidl_test_service::FirstProtocol>
handler) {
return service_handler_->AddMember("first_member", std::move(handler));
}
// Adds member "second_member" to the service instance. |handler| will be
// invoked on connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_second_member(
::fidl::ServiceHandlerInterface::MemberHandler<
::fidl_test_service::FirstProtocol>
handler) {
return service_handler_->AddMember("second_member", std::move(handler));
}
private:
::fidl::ServiceHandlerInterface* service_handler_; // Not owned.
};
};
class MultiHeterogeneousMemberService final {
MultiHeterogeneousMemberService() = default;
public:
static constexpr char Name[] =
"fidl.test.service.MultiHeterogeneousMemberService";
// Client protocol for connecting to member protocols of a service instance.
class ServiceClient final {
ServiceClient() = delete;
public:
ServiceClient(::zx::channel dir,
::fidl::internal::ConnectMemberFunc connect_func)
: dir_(std::move(dir)), connect_func_(connect_func) {}
// Connects to the member protocol "first_member".
// Returns a |fidl::ClientEnd<::fidl_test_service::FirstProtocol>| on
// success, which can be used with |fidl::BindSyncClient| to create a
// synchronous client, or |fidl::Client| to create a client that supports
// both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::fidl_test_service::FirstProtocol>>
connect_first_member() {
auto endpoints =
::fidl::CreateEndpoints<::fidl_test_service::FirstProtocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection = connect_func_(::zx::unowned_channel(dir_),
::fidl::StringView("first_member"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
// Connects to the member protocol "second_member".
// Returns a |fidl::ClientEnd<::fidl_test_service::SecondProtocol>| on
// success, which can be used with |fidl::BindSyncClient| to create a
// synchronous client, or |fidl::Client| to create a client that supports
// both asynchronous and synchronous operations.
//
// # Errors
//
// On failure, returns a |zx::error| with status != ZX_OK.
// Failures can occur if channel creation failed, or if there was an issue
// making a |fuchsia.io.Directory/Open| call.
//
// Since the call to |Open| is asynchronous, an error sent by the remote end
// will not result in a failure of this method. Any errors sent by the
// remote will appear on the |ClientEnd| returned from this method.
::zx::status<::fidl::ClientEnd<::fidl_test_service::SecondProtocol>>
connect_second_member() {
auto endpoints =
::fidl::CreateEndpoints<::fidl_test_service::SecondProtocol>();
if (endpoints.is_error()) {
return endpoints.take_error();
}
auto connection = connect_func_(::zx::unowned_channel(dir_),
::fidl::StringView("second_member"),
endpoints->server.TakeChannel());
if (connection.is_error()) {
return connection.take_error();
}
return ::zx::ok(std::move(endpoints->client));
}
private:
::zx::channel dir_;
::fidl::internal::ConnectMemberFunc connect_func_;
};
// Facilitates member protocol registration for servers.
class Handler final {
public:
// Constructs a FIDL Service-typed handler. Does not take ownership of
// |service_handler|.
explicit Handler(::fidl::ServiceHandlerInterface* service_handler)
: service_handler_(service_handler) {}
// Adds member "first_member" to the service instance. |handler| will be
// invoked on connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_first_member(
::fidl::ServiceHandlerInterface::MemberHandler<
::fidl_test_service::FirstProtocol>
handler) {
return service_handler_->AddMember("first_member", std::move(handler));
}
// Adds member "second_member" to the service instance. |handler| will be
// invoked on connection attempts.
//
// # Errors
//
// Returns ZX_ERR_ALREADY_EXISTS if the member was already added.
::zx::status<> add_second_member(
::fidl::ServiceHandlerInterface::MemberHandler<
::fidl_test_service::SecondProtocol>
handler) {
return service_handler_->AddMember("second_member", std::move(handler));
}
private:
::fidl::ServiceHandlerInterface* service_handler_; // Not owned.
};
};
class EmptyService final {
EmptyService() = default;
public:
static constexpr char Name[] = "fidl.test.service.EmptyService";
// Client protocol for connecting to member protocols of a service instance.
class ServiceClient final {
ServiceClient() = delete;
public:
ServiceClient(::zx::channel dir,
::fidl::internal::ConnectMemberFunc connect_func) {
(void)dir;
(void)connect_func;
}
private:
};
// Facilitates member protocol registration for servers.
class Handler final {
public:
// Constructs a FIDL Service-typed handler. Does not take ownership of
// |service_handler|.
explicit Handler(::fidl::ServiceHandlerInterface* service_handler) {
(void)service_handler;
}
private:
};
};
} // namespace fidl_test_service
namespace fidl {
template <>
struct IsFidlType<
::fidl::WireRequest<::fidl_test_service::SecondProtocol::MethodOnSecond>>
: public std::true_type {};
template <>
struct IsFidlMessage<
::fidl::WireRequest<::fidl_test_service::SecondProtocol::MethodOnSecond>>
: public std::true_type {};
static_assert(
sizeof(::fidl::WireRequest<
::fidl_test_service::SecondProtocol::MethodOnSecond>) ==
::fidl::WireRequest<
::fidl_test_service::SecondProtocol::MethodOnSecond>::PrimarySize);
template <>
struct IsFidlType<
::fidl::WireRequest<::fidl_test_service::FirstProtocol::MethodOnFirst>>
: public std::true_type {};
template <>
struct IsFidlMessage<
::fidl::WireRequest<::fidl_test_service::FirstProtocol::MethodOnFirst>>
: public std::true_type {};
static_assert(
sizeof(::fidl::WireRequest<
::fidl_test_service::FirstProtocol::MethodOnFirst>) ==
::fidl::WireRequest<
::fidl_test_service::FirstProtocol::MethodOnFirst>::PrimarySize);
#ifdef __Fuchsia__
} // namespace fidl
template <>
class ::fidl::internal::WireClientImpl<::fidl_test_service::SecondProtocol>
final : private ::fidl::internal::ClientBase {
public:
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::Result MethodOnSecond();
::fidl::WireAsyncEventHandler<::fidl_test_service::SecondProtocol>*
event_handler() const {
return event_handler_.get();
}
private:
friend class ::fidl::Client<::fidl_test_service::SecondProtocol>;
friend class ::fidl::internal::ControlBlock<
::fidl_test_service::SecondProtocol>;
explicit WireClientImpl(
std::shared_ptr<
::fidl::WireAsyncEventHandler<::fidl_test_service::SecondProtocol>>
event_handler)
: event_handler_(std::move(event_handler)) {}
std::optional<::fidl::UnbindInfo> DispatchEvent(
fidl_incoming_msg_t* msg) override;
std::shared_ptr<
::fidl::WireAsyncEventHandler<::fidl_test_service::SecondProtocol>>
event_handler_;
};
namespace fidl {
#endif // __Fuchsia__
} // namespace fidl
#ifdef __Fuchsia__
// |EventSender| owns a server endpoint of a channel speaking
// the SecondProtocol protocol, and can send events in that protocol.
template <>
class ::fidl::WireEventSender<::fidl_test_service::SecondProtocol> {
public:
// Constructs an event sender with an invalid channel.
WireEventSender() = default;
explicit WireEventSender(
::fidl::ServerEnd<::fidl_test_service::SecondProtocol> server_end)
: server_end_(std::move(server_end)) {}
// The underlying server channel endpoint, which may be replaced at run-time.
const ::fidl::ServerEnd<::fidl_test_service::SecondProtocol>& server_end()
const {
return server_end_;
}
::fidl::ServerEnd<::fidl_test_service::SecondProtocol>& 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<::fidl_test_service::SecondProtocol> server_end_;
};
template <>
class ::fidl::internal::WireWeakEventSender<
::fidl_test_service::SecondProtocol> {
public:
private:
friend class ::fidl::ServerBindingRef<::fidl_test_service::SecondProtocol>;
explicit WireWeakEventSender(
std::weak_ptr<::fidl::internal::AsyncServerBinding<
::fidl_test_service::SecondProtocol>>
binding)
: binding_(std::move(binding)) {}
std::weak_ptr<
::fidl::internal::AsyncServerBinding<::fidl_test_service::SecondProtocol>>
binding_;
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
template <>
class ::fidl::internal::WireClientImpl<::fidl_test_service::FirstProtocol> final
: private ::fidl::internal::ClientBase {
public:
// Allocates 16 bytes of message buffer on the stack. No heap allocation
// necessary.
::fidl::Result MethodOnFirst();
::fidl::WireAsyncEventHandler<::fidl_test_service::FirstProtocol>*
event_handler() const {
return event_handler_.get();
}
private:
friend class ::fidl::Client<::fidl_test_service::FirstProtocol>;
friend class ::fidl::internal::ControlBlock<
::fidl_test_service::FirstProtocol>;
explicit WireClientImpl(
std::shared_ptr<
::fidl::WireAsyncEventHandler<::fidl_test_service::FirstProtocol>>
event_handler)
: event_handler_(std::move(event_handler)) {}
std::optional<::fidl::UnbindInfo> DispatchEvent(
fidl_incoming_msg_t* msg) override;
std::shared_ptr<
::fidl::WireAsyncEventHandler<::fidl_test_service::FirstProtocol>>
event_handler_;
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
// |EventSender| owns a server endpoint of a channel speaking
// the FirstProtocol protocol, and can send events in that protocol.
template <>
class ::fidl::WireEventSender<::fidl_test_service::FirstProtocol> {
public:
// Constructs an event sender with an invalid channel.
WireEventSender() = default;
explicit WireEventSender(
::fidl::ServerEnd<::fidl_test_service::FirstProtocol> server_end)
: server_end_(std::move(server_end)) {}
// The underlying server channel endpoint, which may be replaced at run-time.
const ::fidl::ServerEnd<::fidl_test_service::FirstProtocol>& server_end()
const {
return server_end_;
}
::fidl::ServerEnd<::fidl_test_service::FirstProtocol>& 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<::fidl_test_service::FirstProtocol> server_end_;
};
template <>
class ::fidl::internal::WireWeakEventSender<
::fidl_test_service::FirstProtocol> {
public:
private:
friend class ::fidl::ServerBindingRef<::fidl_test_service::FirstProtocol>;
explicit WireWeakEventSender(
std::weak_ptr<::fidl::internal::AsyncServerBinding<
::fidl_test_service::FirstProtocol>>
binding)
: binding_(std::move(binding)) {}
std::weak_ptr<
::fidl::internal::AsyncServerBinding<::fidl_test_service::FirstProtocol>>
binding_;
};
#endif // __Fuchsia__