blob: eb1ed887395955e7527057a74f4d6e3c4328dd8b [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include "lib/fidl/cpp/internal/header.h"
namespace test {
namespace name {
class WithErrorSyntax_ResponseAsStruct_Response;
class WithErrorSyntax_ResponseAsStruct_Result;
class WithErrorSyntax_ErrorAsPrimitive_Response;
class WithErrorSyntax_ErrorAsPrimitive_Result;
class WithErrorSyntax_ErrorAsEnum_Response;
#ifdef __Fuchsia__
class ChannelProtocol;
using ChannelProtocolPtr = ::fidl::InterfacePtr<ChannelProtocol>;
class ChannelProtocol_Proxy;
class ChannelProtocol_Stub;
class ChannelProtocol_EventSender;
class ChannelProtocol_Sync;
using ChannelProtocolSyncPtr = ::fidl::SynchronousInterfacePtr<ChannelProtocol>;
class ChannelProtocol_SyncProxy;
using ChannelProtocolHandle = ::fidl::InterfaceHandle<ChannelProtocol>;
namespace internal {
constexpr uint64_t kChannelProtocol_MethodA_Ordinal = 0x556693d200000000lu;
constexpr uint64_t kChannelProtocol_MethodA_GenOrdinal = 0x1b1e059b3f02bffclu;
constexpr uint64_t kChannelProtocol_EventA_Ordinal = 0x1c78c20200000000lu;
constexpr uint64_t kChannelProtocol_EventA_GenOrdinal = 0x2558b206a254d8a0lu;
constexpr uint64_t kChannelProtocol_MethodB_Ordinal = 0xac6551b00000000lu;
constexpr uint64_t kChannelProtocol_MethodB_GenOrdinal = 0x5db17a61464744a3lu;
constexpr uint64_t kChannelProtocol_MutateSocket_Ordinal = 0x4b02e28600000000lu;
constexpr uint64_t kChannelProtocol_MutateSocket_GenOrdinal =
0x36caa6fff7569577lu;
} // namespace internal
#endif // __Fuchsia__
#ifdef __Fuchsia__
class WithAndWithoutRequestResponse;
using WithAndWithoutRequestResponsePtr =
::fidl::InterfacePtr<WithAndWithoutRequestResponse>;
class WithAndWithoutRequestResponse_Proxy;
class WithAndWithoutRequestResponse_Stub;
class WithAndWithoutRequestResponse_EventSender;
class WithAndWithoutRequestResponse_Sync;
using WithAndWithoutRequestResponseSyncPtr =
::fidl::SynchronousInterfacePtr<WithAndWithoutRequestResponse>;
class WithAndWithoutRequestResponse_SyncProxy;
using WithAndWithoutRequestResponseHandle =
::fidl::InterfaceHandle<WithAndWithoutRequestResponse>;
namespace internal {
constexpr uint64_t kWithAndWithoutRequestResponse_NoRequestNoResponse_Ordinal =
0x1e03f87500000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_NoRequestNoResponse_GenOrdinal =
0x3931f96bc77fba8lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_Ordinal =
0x4df6dbd500000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_GenOrdinal =
0x706ec7bd335005f9lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_NoRequestWithResponse_Ordinal =
0x668d7f800000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_NoRequestWithResponse_GenOrdinal =
0x4625ad5934067a48lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestNoResponse_Ordinal =
0x19c2137100000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestNoResponse_GenOrdinal =
0x46e5095902913025lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_Ordinal =
0x76f2397300000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_GenOrdinal =
0x180c481d4a15967lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestWithResponse_Ordinal =
0x1973292000000000lu;
constexpr uint64_t
kWithAndWithoutRequestResponse_WithRequestWithResponse_GenOrdinal =
0x553860267eceec0lu;
constexpr uint64_t kWithAndWithoutRequestResponse_OnEmptyResponse_Ordinal =
0x697fd73200000000lu;
constexpr uint64_t kWithAndWithoutRequestResponse_OnEmptyResponse_GenOrdinal =
0x42e90e9a86944b3lu;
constexpr uint64_t kWithAndWithoutRequestResponse_OnWithResponse_Ordinal =
0x7a47120700000000lu;
constexpr uint64_t kWithAndWithoutRequestResponse_OnWithResponse_GenOrdinal =
0x2a9767b3ae6c2b09lu;
} // namespace internal
#endif // __Fuchsia__
enum class ErrorEnun : uint32_t {
ERR_FOO = 1u,
ERR_BAR = 2u,
};
inline zx_status_t Clone(::test::name::ErrorEnun value,
::test::name::ErrorEnun* result) {
*result = value;
return ZX_OK;
}
class WithErrorSyntax_ErrorAsEnum_Result;
#ifdef __Fuchsia__
class WithErrorSyntax;
using WithErrorSyntaxPtr = ::fidl::InterfacePtr<WithErrorSyntax>;
class WithErrorSyntax_Proxy;
class WithErrorSyntax_Stub;
class WithErrorSyntax_EventSender;
class WithErrorSyntax_Sync;
using WithErrorSyntaxSyncPtr = ::fidl::SynchronousInterfacePtr<WithErrorSyntax>;
class WithErrorSyntax_SyncProxy;
using WithErrorSyntaxHandle = ::fidl::InterfaceHandle<WithErrorSyntax>;
namespace internal {
constexpr uint64_t kWithErrorSyntax_ResponseAsStruct_Ordinal =
0x4f3c32be00000000lu;
constexpr uint64_t kWithErrorSyntax_ResponseAsStruct_GenOrdinal =
0x592157d505db2bcflu;
constexpr uint64_t kWithErrorSyntax_ErrorAsPrimitive_Ordinal =
0x7b58113900000000lu;
constexpr uint64_t kWithErrorSyntax_ErrorAsPrimitive_GenOrdinal =
0x20cf80ad7d9b60belu;
constexpr uint64_t kWithErrorSyntax_ErrorAsEnum_Ordinal = 0x4c95de1f00000000lu;
constexpr uint64_t kWithErrorSyntax_ErrorAsEnum_GenOrdinal =
0x3fcd36560f812e7flu;
} // namespace internal
#endif // __Fuchsia__
class WithErrorSyntax_ResponseAsStruct_Response final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ResponseAsStruct_Response() = default;
explicit WithErrorSyntax_ResponseAsStruct_Response(
std::tuple<int64_t, int64_t, int64_t> _value_tuple) {
std::tie(a, b, c) = std::move(_value_tuple);
}
operator std::tuple<int64_t, int64_t, int64_t>() && {
return std::make_tuple(std::move(a), std::move(b), std::move(c));
}
int64_t a{};
int64_t b{};
int64_t c{};
static inline ::std::unique_ptr<WithErrorSyntax_ResponseAsStruct_Response>
New() {
return ::std::make_unique<WithErrorSyntax_ResponseAsStruct_Response>();
}
void Encode(::fidl::Encoder* _encoder, size_t _offset);
static void Decode(::fidl::Decoder* _decoder,
WithErrorSyntax_ResponseAsStruct_Response* value,
size_t _offset);
zx_status_t Clone(WithErrorSyntax_ResponseAsStruct_Response* result) const;
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Response& _value,
::test::name::WithErrorSyntax_ResponseAsStruct_Response* _result) {
return _value.Clone(_result);
}
using WithErrorSyntax_ResponseAsStruct_ResponsePtr =
::std::unique_ptr<WithErrorSyntax_ResponseAsStruct_Response>;
class WithErrorSyntax_ResponseAsStruct_Result final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ResponseAsStruct_Result();
~WithErrorSyntax_ResponseAsStruct_Result();
WithErrorSyntax_ResponseAsStruct_Result(
WithErrorSyntax_ResponseAsStruct_Result&&);
WithErrorSyntax_ResponseAsStruct_Result& operator=(
WithErrorSyntax_ResponseAsStruct_Result&&);
static WithErrorSyntax_ResponseAsStruct_Result WithResponse(
class WithErrorSyntax_ResponseAsStruct_Response&&);
static WithErrorSyntax_ResponseAsStruct_Result WithErr(uint32_t&&);
enum __attribute__((enum_extensibility(closed))) Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
static inline ::std::unique_ptr<WithErrorSyntax_ResponseAsStruct_Result>
New() {
return ::std::make_unique<WithErrorSyntax_ResponseAsStruct_Result>();
}
void Encode(::fidl::Encoder* encoder, size_t offset);
static void Decode(::fidl::Decoder* decoder,
WithErrorSyntax_ResponseAsStruct_Result* value,
size_t offset);
zx_status_t Clone(WithErrorSyntax_ResponseAsStruct_Result* result) const;
bool has_invalid_tag() const { return tag_ == Invalid; }
bool is_response() const { return tag_ == Tag::kResponse; }
class WithErrorSyntax_ResponseAsStruct_Response& response() {
EnsureStorageInitialized(Tag::kResponse);
return response_;
}
const class WithErrorSyntax_ResponseAsStruct_Response& response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ResponseAsStruct_Result& set_response(
class WithErrorSyntax_ResponseAsStruct_Response value);
bool is_err() const { return tag_ == Tag::kErr; }
uint32_t& err() {
EnsureStorageInitialized(Tag::kErr);
return err_;
}
const uint32_t& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ResponseAsStruct_Result& set_err(uint32_t value);
Tag Which() const { return Tag(tag_); }
// You probably want to use Which() method instead of Ordinal(). Use Ordinal()
// only when you need access to the raw integral ordinal value.
fidl_xunion_tag_t Ordinal() const { return tag_; }
const std::vector<uint8_t>* UnknownData() const { return nullptr; }
friend ::fidl::Equality<
::test::name::WithErrorSyntax_ResponseAsStruct_Result>;
WithErrorSyntax_ResponseAsStruct_Result(
fit::result<std::tuple<int64_t, int64_t, int64_t>, uint32_t>&& result) {
ZX_ASSERT(!result.is_pending());
if (result.is_ok()) {
set_response(
WithErrorSyntax_ResponseAsStruct_Response{result.take_value()});
} else {
set_err(std::move(result.take_error()));
}
}
WithErrorSyntax_ResponseAsStruct_Result(
fit::ok_result<std::tuple<int64_t, int64_t, int64_t>>&& result)
: WithErrorSyntax_ResponseAsStruct_Result(
fit::result<std::tuple<int64_t, int64_t, int64_t>, uint32_t>(
std::move(result))) {}
WithErrorSyntax_ResponseAsStruct_Result(fit::error_result<uint32_t>&& result)
: WithErrorSyntax_ResponseAsStruct_Result(
fit::result<std::tuple<int64_t, int64_t, int64_t>, uint32_t>(
std::move(result))) {}
operator fit::result<std::tuple<int64_t, int64_t, int64_t>, uint32_t>() && {
if (is_err()) {
return fit::error(err());
}
return fit::ok(std::move(response()));
}
private:
void Destroy();
void EnsureStorageInitialized(::fidl_xunion_tag_t tag);
::fidl_xunion_tag_t tag_ = static_cast<fidl_xunion_tag_t>(Tag::Invalid);
union {
class WithErrorSyntax_ResponseAsStruct_Response response_;
uint32_t err_;
};
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Result& value,
::test::name::WithErrorSyntax_ResponseAsStruct_Result* result) {
return value.Clone(result);
}
using WithErrorSyntax_ResponseAsStruct_ResultPtr =
::std::unique_ptr<WithErrorSyntax_ResponseAsStruct_Result>;
class WithErrorSyntax_ErrorAsPrimitive_Response final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ErrorAsPrimitive_Response() = default;
explicit WithErrorSyntax_ErrorAsPrimitive_Response(uint8_t v)
: __reserved(std::move(v)) {}
uint8_t ResultValue_() { return std::move(__reserved); }
explicit WithErrorSyntax_ErrorAsPrimitive_Response(
std::tuple<> _value_tuple) {}
operator std::tuple<>() && { return std::make_tuple(); }
uint8_t __reserved = 0u;
static inline ::std::unique_ptr<WithErrorSyntax_ErrorAsPrimitive_Response>
New() {
return ::std::make_unique<WithErrorSyntax_ErrorAsPrimitive_Response>();
}
void Encode(::fidl::Encoder* _encoder, size_t _offset);
static void Decode(::fidl::Decoder* _decoder,
WithErrorSyntax_ErrorAsPrimitive_Response* value,
size_t _offset);
zx_status_t Clone(WithErrorSyntax_ErrorAsPrimitive_Response* result) const;
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& _value,
::test::name::WithErrorSyntax_ErrorAsPrimitive_Response* _result) {
return _value.Clone(_result);
}
using WithErrorSyntax_ErrorAsPrimitive_ResponsePtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsPrimitive_Response>;
class WithErrorSyntax_ErrorAsPrimitive_Result final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ErrorAsPrimitive_Result();
~WithErrorSyntax_ErrorAsPrimitive_Result();
WithErrorSyntax_ErrorAsPrimitive_Result(
WithErrorSyntax_ErrorAsPrimitive_Result&&);
WithErrorSyntax_ErrorAsPrimitive_Result& operator=(
WithErrorSyntax_ErrorAsPrimitive_Result&&);
static WithErrorSyntax_ErrorAsPrimitive_Result WithResponse(
class WithErrorSyntax_ErrorAsPrimitive_Response&&);
static WithErrorSyntax_ErrorAsPrimitive_Result WithErr(uint32_t&&);
enum __attribute__((enum_extensibility(closed))) Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
static inline ::std::unique_ptr<WithErrorSyntax_ErrorAsPrimitive_Result>
New() {
return ::std::make_unique<WithErrorSyntax_ErrorAsPrimitive_Result>();
}
void Encode(::fidl::Encoder* encoder, size_t offset);
static void Decode(::fidl::Decoder* decoder,
WithErrorSyntax_ErrorAsPrimitive_Result* value,
size_t offset);
zx_status_t Clone(WithErrorSyntax_ErrorAsPrimitive_Result* result) const;
bool has_invalid_tag() const { return tag_ == Invalid; }
bool is_response() const { return tag_ == Tag::kResponse; }
class WithErrorSyntax_ErrorAsPrimitive_Response& response() {
EnsureStorageInitialized(Tag::kResponse);
return response_;
}
const class WithErrorSyntax_ErrorAsPrimitive_Response& response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ErrorAsPrimitive_Result& set_response(
class WithErrorSyntax_ErrorAsPrimitive_Response value);
bool is_err() const { return tag_ == Tag::kErr; }
uint32_t& err() {
EnsureStorageInitialized(Tag::kErr);
return err_;
}
const uint32_t& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ErrorAsPrimitive_Result& set_err(uint32_t value);
Tag Which() const { return Tag(tag_); }
// You probably want to use Which() method instead of Ordinal(). Use Ordinal()
// only when you need access to the raw integral ordinal value.
fidl_xunion_tag_t Ordinal() const { return tag_; }
const std::vector<uint8_t>* UnknownData() const { return nullptr; }
friend ::fidl::Equality<
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>;
WithErrorSyntax_ErrorAsPrimitive_Result(
fit::result<void, uint32_t>&& result) {
ZX_ASSERT(!result.is_pending());
if (result.is_ok()) {
set_response(WithErrorSyntax_ErrorAsPrimitive_Response{});
} else {
set_err(std::move(result.take_error()));
}
}
WithErrorSyntax_ErrorAsPrimitive_Result(fit::ok_result<void>&& result)
: WithErrorSyntax_ErrorAsPrimitive_Result(
fit::result<void, uint32_t>(std::move(result))) {}
WithErrorSyntax_ErrorAsPrimitive_Result(fit::error_result<uint32_t>&& result)
: WithErrorSyntax_ErrorAsPrimitive_Result(
fit::result<void, uint32_t>(std::move(result))) {}
operator fit::result<void, uint32_t>() && {
if (is_err()) {
return fit::error(err());
}
return fit::ok();
}
private:
void Destroy();
void EnsureStorageInitialized(::fidl_xunion_tag_t tag);
::fidl_xunion_tag_t tag_ = static_cast<fidl_xunion_tag_t>(Tag::Invalid);
union {
class WithErrorSyntax_ErrorAsPrimitive_Response response_;
uint32_t err_;
};
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result& value,
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result* result) {
return value.Clone(result);
}
using WithErrorSyntax_ErrorAsPrimitive_ResultPtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsPrimitive_Result>;
class WithErrorSyntax_ErrorAsEnum_Response final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ErrorAsEnum_Response() = default;
explicit WithErrorSyntax_ErrorAsEnum_Response(uint8_t v)
: __reserved(std::move(v)) {}
uint8_t ResultValue_() { return std::move(__reserved); }
explicit WithErrorSyntax_ErrorAsEnum_Response(std::tuple<> _value_tuple) {}
operator std::tuple<>() && { return std::make_tuple(); }
uint8_t __reserved = 0u;
static inline ::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Response> New() {
return ::std::make_unique<WithErrorSyntax_ErrorAsEnum_Response>();
}
void Encode(::fidl::Encoder* _encoder, size_t _offset);
static void Decode(::fidl::Decoder* _decoder,
WithErrorSyntax_ErrorAsEnum_Response* value,
size_t _offset);
zx_status_t Clone(WithErrorSyntax_ErrorAsEnum_Response* result) const;
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Response& _value,
::test::name::WithErrorSyntax_ErrorAsEnum_Response* _result) {
return _value.Clone(_result);
}
using WithErrorSyntax_ErrorAsEnum_ResponsePtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Response>;
#ifdef __Fuchsia__
class ChannelProtocol {
public:
using Proxy_ = ChannelProtocol_Proxy;
using Stub_ = ChannelProtocol_Stub;
using EventSender_ = ChannelProtocol_EventSender;
using Sync_ = ChannelProtocol_Sync;
virtual ~ChannelProtocol();
virtual void MethodA(int64_t a, int64_t b) = 0;
using EventACallback = fit::function<void(int64_t, int64_t)>;
using MethodBCallback = fit::function<void(int64_t)>;
virtual void MethodB(int64_t a, int64_t b, MethodBCallback callback) = 0;
using MutateSocketCallback = fit::function<void(::zx::socket)>;
virtual void MutateSocket(::zx::socket a, MutateSocketCallback callback) = 0;
};
class ChannelProtocol_RequestEncoder {
public:
static ::fidl::Message MethodA(::fidl::Encoder* _encoder, int64_t* a,
int64_t* b) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
return _encoder->GetMessage();
}
static ::fidl::Message MethodB(::fidl::Encoder* _encoder, int64_t* a,
int64_t* b) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
return _encoder->GetMessage();
}
static ::fidl::Message MutateSocket(::fidl::Encoder* _encoder,
::zx::socket* a) {
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
return _encoder->GetMessage();
}
};
class ChannelProtocol_RequestDecoder {
public:
ChannelProtocol_RequestDecoder() = default;
virtual ~ChannelProtocol_RequestDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal, bool* out_needs_response);
zx_status_t Decode_(::fidl::Message request) {
bool needs_response;
const fidl_type_t* request_type =
GetType(request.ordinal(), &needs_response);
if (request_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = request.Decode(request_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(request, request_type, error_msg);
return status;
}
::fidl::Decoder request_decoder(std::move(request));
switch (request.ordinal()) {
case internal::kChannelProtocol_MethodA_Ordinal:
case internal::kChannelProtocol_MethodA_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<int64_t>(&request_decoder, 16);
auto arg1 = ::fidl::DecodeAs<int64_t>(&request_decoder, 24);
MethodA(std::move(arg0), std::move(arg1));
break;
}
case internal::kChannelProtocol_MethodB_Ordinal:
case internal::kChannelProtocol_MethodB_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<int64_t>(&request_decoder, 16);
auto arg1 = ::fidl::DecodeAs<int64_t>(&request_decoder, 24);
MethodB(std::move(arg0), std::move(arg1));
break;
}
case internal::kChannelProtocol_MutateSocket_Ordinal:
case internal::kChannelProtocol_MutateSocket_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::zx::socket>(&request_decoder, 16);
MutateSocket(std::move(arg0));
break;
}
default: {
status = ZX_ERR_NOT_SUPPORTED;
break;
}
}
return status;
}
virtual void MethodA(int64_t a, int64_t b) = 0;
virtual void MethodB(int64_t a, int64_t b) = 0;
virtual void MutateSocket(::zx::socket a) = 0;
};
class ChannelProtocol_ResponseEncoder {
public:
static ::fidl::Message EventA(::fidl::Encoder* _encoder, int64_t* a,
int64_t* b) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
return _encoder->GetMessage();
}
static ::fidl::Message MethodB(::fidl::Encoder* _encoder, int64_t* result) {
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
return _encoder->GetMessage();
}
static ::fidl::Message MutateSocket(::fidl::Encoder* _encoder,
::zx::socket* b) {
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, b, 16);
return _encoder->GetMessage();
}
};
class ChannelProtocol_ResponseDecoder {
public:
ChannelProtocol_ResponseDecoder() = default;
virtual ~ChannelProtocol_ResponseDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal);
zx_status_t Decode_(::fidl::Message response) {
const fidl_type_t* response_type = GetType(response.ordinal());
if (response_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = response.Decode(response_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(response, response_type, error_msg);
return status;
}
::fidl::Decoder response_decoder(std::move(response));
switch (response.ordinal()) {
case internal::kChannelProtocol_EventA_Ordinal:
case internal::kChannelProtocol_EventA_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<int64_t>(&response_decoder, 16);
auto arg1 = ::fidl::DecodeAs<int64_t>(&response_decoder, 24);
EventA(std::move(arg0), std::move(arg1));
break;
}
case internal::kChannelProtocol_MethodB_Ordinal:
case internal::kChannelProtocol_MethodB_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<int64_t>(&response_decoder, 16);
MethodB(std::move(arg0));
break;
}
case internal::kChannelProtocol_MutateSocket_Ordinal:
case internal::kChannelProtocol_MutateSocket_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::zx::socket>(&response_decoder, 16);
MutateSocket(std::move(arg0));
break;
}
default: {
break;
}
}
return ZX_OK;
}
virtual void EventA(int64_t a, int64_t b) = 0;
virtual void MethodB(int64_t result) = 0;
virtual void MutateSocket(::zx::socket b) = 0;
};
class ChannelProtocol_EventSender {
public:
virtual ~ChannelProtocol_EventSender();
virtual void EventA(int64_t a, int64_t b) = 0;
};
class ChannelProtocol_Sync {
public:
using Proxy_ = ChannelProtocol_SyncProxy;
virtual ~ChannelProtocol_Sync();
virtual zx_status_t MethodA(int64_t a, int64_t b) = 0;
virtual zx_status_t MethodB(int64_t a, int64_t b, int64_t* out_result) = 0;
virtual zx_status_t MutateSocket(::zx::socket a, ::zx::socket* out_b) = 0;
};
class ChannelProtocol_Proxy final : public ::fidl::internal::Proxy,
public ChannelProtocol {
public:
explicit ChannelProtocol_Proxy(::fidl::internal::ProxyController* controller);
~ChannelProtocol_Proxy() override;
zx_status_t Dispatch_(::fidl::Message message) override;
void MethodA(int64_t a, int64_t b) override;
EventACallback EventA;
void MethodB(int64_t a, int64_t b, MethodBCallback callback) override;
void MutateSocket(::zx::socket a, MutateSocketCallback callback) override;
private:
ChannelProtocol_Proxy(const ChannelProtocol_Proxy&) = delete;
ChannelProtocol_Proxy& operator=(const ChannelProtocol_Proxy&) = delete;
::fidl::internal::ProxyController* controller_;
};
class ChannelProtocol_Stub final : public ::fidl::internal::Stub,
public ChannelProtocol_EventSender {
public:
typedef class ::test::name::ChannelProtocol ChannelProtocol_clazz;
explicit ChannelProtocol_Stub(ChannelProtocol_clazz* impl);
~ChannelProtocol_Stub() override;
zx_status_t Dispatch_(::fidl::Message message,
::fidl::internal::PendingResponse response) override;
void EventA(int64_t a, int64_t b) override;
private:
ChannelProtocol_clazz* impl_;
};
class ChannelProtocol_SyncProxy : public ChannelProtocol_Sync {
public:
explicit ChannelProtocol_SyncProxy(::zx::channel channel);
~ChannelProtocol_SyncProxy() override;
zx_status_t MethodA(int64_t a, int64_t b) override;
zx_status_t MethodB(int64_t a, int64_t b, int64_t* out_result) override;
zx_status_t MutateSocket(::zx::socket a, ::zx::socket* out_b) override;
private:
::fidl::internal::SynchronousProxy proxy_;
friend class ::fidl::SynchronousInterfacePtr<ChannelProtocol>;
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
class WithAndWithoutRequestResponse {
public:
using Proxy_ = WithAndWithoutRequestResponse_Proxy;
using Stub_ = WithAndWithoutRequestResponse_Stub;
using EventSender_ = WithAndWithoutRequestResponse_EventSender;
using Sync_ = WithAndWithoutRequestResponse_Sync;
virtual ~WithAndWithoutRequestResponse();
virtual void NoRequestNoResponse() = 0;
using NoRequestEmptyResponseCallback = fit::function<void()>;
virtual void NoRequestEmptyResponse(
NoRequestEmptyResponseCallback callback) = 0;
using NoRequestWithResponseCallback = fit::function<void(::std::string)>;
virtual void NoRequestWithResponse(
NoRequestWithResponseCallback callback) = 0;
virtual void WithRequestNoResponse(::std::string arg) = 0;
using WithRequestEmptyResponseCallback = fit::function<void()>;
virtual void WithRequestEmptyResponse(
::std::string arg, WithRequestEmptyResponseCallback callback) = 0;
using WithRequestWithResponseCallback = fit::function<void(::std::string)>;
virtual void WithRequestWithResponse(
::std::string arg, WithRequestWithResponseCallback callback) = 0;
using OnEmptyResponseCallback = fit::function<void()>;
using OnWithResponseCallback = fit::function<void(::std::string)>;
};
class WithAndWithoutRequestResponse_RequestEncoder {
public:
static ::fidl::Message NoRequestNoResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message NoRequestEmptyResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message NoRequestWithResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message WithRequestNoResponse(::fidl::Encoder* _encoder,
::std::string* arg) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
return _encoder->GetMessage();
}
static ::fidl::Message WithRequestEmptyResponse(::fidl::Encoder* _encoder,
::std::string* arg) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
return _encoder->GetMessage();
}
static ::fidl::Message WithRequestWithResponse(::fidl::Encoder* _encoder,
::std::string* arg) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
return _encoder->GetMessage();
}
};
class WithAndWithoutRequestResponse_RequestDecoder {
public:
WithAndWithoutRequestResponse_RequestDecoder() = default;
virtual ~WithAndWithoutRequestResponse_RequestDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal, bool* out_needs_response);
zx_status_t Decode_(::fidl::Message request) {
bool needs_response;
const fidl_type_t* request_type =
GetType(request.ordinal(), &needs_response);
if (request_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = request.Decode(request_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(request, request_type, error_msg);
return status;
}
::fidl::Decoder request_decoder(std::move(request));
switch (request.ordinal()) {
case internal::kWithAndWithoutRequestResponse_NoRequestNoResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_NoRequestNoResponse_GenOrdinal: {
NoRequestNoResponse();
break;
}
case internal::
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_GenOrdinal: {
NoRequestEmptyResponse();
break;
}
case internal::
kWithAndWithoutRequestResponse_NoRequestWithResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_NoRequestWithResponse_GenOrdinal: {
NoRequestWithResponse();
break;
}
case internal::
kWithAndWithoutRequestResponse_WithRequestNoResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_WithRequestNoResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&request_decoder, 16);
WithRequestNoResponse(std::move(arg0));
break;
}
case internal::
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&request_decoder, 16);
WithRequestEmptyResponse(std::move(arg0));
break;
}
case internal::
kWithAndWithoutRequestResponse_WithRequestWithResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_WithRequestWithResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&request_decoder, 16);
WithRequestWithResponse(std::move(arg0));
break;
}
default: {
status = ZX_ERR_NOT_SUPPORTED;
break;
}
}
return status;
}
virtual void NoRequestNoResponse() = 0;
virtual void NoRequestEmptyResponse() = 0;
virtual void NoRequestWithResponse() = 0;
virtual void WithRequestNoResponse(::std::string arg) = 0;
virtual void WithRequestEmptyResponse(::std::string arg) = 0;
virtual void WithRequestWithResponse(::std::string arg) = 0;
};
class WithAndWithoutRequestResponse_ResponseEncoder {
public:
static ::fidl::Message NoRequestEmptyResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message NoRequestWithResponse(::fidl::Encoder* _encoder,
::std::string* ret) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
return _encoder->GetMessage();
}
static ::fidl::Message WithRequestEmptyResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message WithRequestWithResponse(::fidl::Encoder* _encoder,
::std::string* ret) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
return _encoder->GetMessage();
}
static ::fidl::Message OnEmptyResponse(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message OnWithResponse(::fidl::Encoder* _encoder,
::std::string* ret) {
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
return _encoder->GetMessage();
}
};
class WithAndWithoutRequestResponse_ResponseDecoder {
public:
WithAndWithoutRequestResponse_ResponseDecoder() = default;
virtual ~WithAndWithoutRequestResponse_ResponseDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal);
zx_status_t Decode_(::fidl::Message response) {
const fidl_type_t* response_type = GetType(response.ordinal());
if (response_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = response.Decode(response_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(response, response_type, error_msg);
return status;
}
::fidl::Decoder response_decoder(std::move(response));
switch (response.ordinal()) {
case internal::
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_NoRequestEmptyResponse_GenOrdinal: {
NoRequestEmptyResponse();
break;
}
case internal::
kWithAndWithoutRequestResponse_NoRequestWithResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_NoRequestWithResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&response_decoder, 16);
NoRequestWithResponse(std::move(arg0));
break;
}
case internal::
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_WithRequestEmptyResponse_GenOrdinal: {
WithRequestEmptyResponse();
break;
}
case internal::
kWithAndWithoutRequestResponse_WithRequestWithResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_WithRequestWithResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&response_decoder, 16);
WithRequestWithResponse(std::move(arg0));
break;
}
case internal::kWithAndWithoutRequestResponse_OnEmptyResponse_Ordinal:
case internal::
kWithAndWithoutRequestResponse_OnEmptyResponse_GenOrdinal: {
OnEmptyResponse();
break;
}
case internal::kWithAndWithoutRequestResponse_OnWithResponse_Ordinal:
case internal::kWithAndWithoutRequestResponse_OnWithResponse_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<::std::string>(&response_decoder, 16);
OnWithResponse(std::move(arg0));
break;
}
default: {
break;
}
}
return ZX_OK;
}
virtual void NoRequestEmptyResponse() = 0;
virtual void NoRequestWithResponse(::std::string ret) = 0;
virtual void WithRequestEmptyResponse() = 0;
virtual void WithRequestWithResponse(::std::string ret) = 0;
virtual void OnEmptyResponse() = 0;
virtual void OnWithResponse(::std::string ret) = 0;
};
class WithAndWithoutRequestResponse_EventSender {
public:
virtual ~WithAndWithoutRequestResponse_EventSender();
virtual void OnEmptyResponse() = 0;
virtual void OnWithResponse(::std::string ret) = 0;
};
class WithAndWithoutRequestResponse_Sync {
public:
using Proxy_ = WithAndWithoutRequestResponse_SyncProxy;
virtual ~WithAndWithoutRequestResponse_Sync();
virtual zx_status_t NoRequestNoResponse() = 0;
virtual zx_status_t NoRequestEmptyResponse() = 0;
virtual zx_status_t NoRequestWithResponse(::std::string* out_ret) = 0;
virtual zx_status_t WithRequestNoResponse(::std::string arg) = 0;
virtual zx_status_t WithRequestEmptyResponse(::std::string arg) = 0;
virtual zx_status_t WithRequestWithResponse(::std::string arg,
::std::string* out_ret) = 0;
};
class WithAndWithoutRequestResponse_Proxy final
: public ::fidl::internal::Proxy,
public WithAndWithoutRequestResponse {
public:
explicit WithAndWithoutRequestResponse_Proxy(
::fidl::internal::ProxyController* controller);
~WithAndWithoutRequestResponse_Proxy() override;
zx_status_t Dispatch_(::fidl::Message message) override;
void NoRequestNoResponse() override;
void NoRequestEmptyResponse(NoRequestEmptyResponseCallback callback) override;
void NoRequestWithResponse(NoRequestWithResponseCallback callback) override;
void WithRequestNoResponse(::std::string arg) override;
void WithRequestEmptyResponse(
::std::string arg, WithRequestEmptyResponseCallback callback) override;
void WithRequestWithResponse(
::std::string arg, WithRequestWithResponseCallback callback) override;
OnEmptyResponseCallback OnEmptyResponse;
OnWithResponseCallback OnWithResponse;
private:
WithAndWithoutRequestResponse_Proxy(
const WithAndWithoutRequestResponse_Proxy&) = delete;
WithAndWithoutRequestResponse_Proxy& operator=(
const WithAndWithoutRequestResponse_Proxy&) = delete;
::fidl::internal::ProxyController* controller_;
};
class WithAndWithoutRequestResponse_Stub final
: public ::fidl::internal::Stub,
public WithAndWithoutRequestResponse_EventSender {
public:
typedef class ::test::name::WithAndWithoutRequestResponse
WithAndWithoutRequestResponse_clazz;
explicit WithAndWithoutRequestResponse_Stub(
WithAndWithoutRequestResponse_clazz* impl);
~WithAndWithoutRequestResponse_Stub() override;
zx_status_t Dispatch_(::fidl::Message message,
::fidl::internal::PendingResponse response) override;
void OnEmptyResponse() override;
void OnWithResponse(::std::string ret) override;
private:
WithAndWithoutRequestResponse_clazz* impl_;
};
class WithAndWithoutRequestResponse_SyncProxy
: public WithAndWithoutRequestResponse_Sync {
public:
explicit WithAndWithoutRequestResponse_SyncProxy(::zx::channel channel);
~WithAndWithoutRequestResponse_SyncProxy() override;
zx_status_t NoRequestNoResponse() override;
zx_status_t NoRequestEmptyResponse() override;
zx_status_t NoRequestWithResponse(::std::string* out_ret) override;
zx_status_t WithRequestNoResponse(::std::string arg) override;
zx_status_t WithRequestEmptyResponse(::std::string arg) override;
zx_status_t WithRequestWithResponse(::std::string arg,
::std::string* out_ret) override;
private:
::fidl::internal::SynchronousProxy proxy_;
friend class ::fidl::SynchronousInterfacePtr<WithAndWithoutRequestResponse>;
};
#endif // __Fuchsia__
class WithErrorSyntax_ErrorAsEnum_Result final {
public:
static const fidl_type_t* FidlType;
WithErrorSyntax_ErrorAsEnum_Result();
~WithErrorSyntax_ErrorAsEnum_Result();
WithErrorSyntax_ErrorAsEnum_Result(WithErrorSyntax_ErrorAsEnum_Result&&);
WithErrorSyntax_ErrorAsEnum_Result& operator=(
WithErrorSyntax_ErrorAsEnum_Result&&);
static WithErrorSyntax_ErrorAsEnum_Result WithResponse(
class WithErrorSyntax_ErrorAsEnum_Response&&);
static WithErrorSyntax_ErrorAsEnum_Result WithErr(ErrorEnun&&);
enum __attribute__((enum_extensibility(closed))) Tag : fidl_xunion_tag_t {
kResponse = 1, // 0x1
kErr = 2, // 0x2
Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
static inline ::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Result> New() {
return ::std::make_unique<WithErrorSyntax_ErrorAsEnum_Result>();
}
void Encode(::fidl::Encoder* encoder, size_t offset);
static void Decode(::fidl::Decoder* decoder,
WithErrorSyntax_ErrorAsEnum_Result* value, size_t offset);
zx_status_t Clone(WithErrorSyntax_ErrorAsEnum_Result* result) const;
bool has_invalid_tag() const { return tag_ == Invalid; }
bool is_response() const { return tag_ == Tag::kResponse; }
class WithErrorSyntax_ErrorAsEnum_Response& response() {
EnsureStorageInitialized(Tag::kResponse);
return response_;
}
const class WithErrorSyntax_ErrorAsEnum_Response& response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ErrorAsEnum_Result& set_response(
class WithErrorSyntax_ErrorAsEnum_Response value);
bool is_err() const { return tag_ == Tag::kErr; }
ErrorEnun& err() {
EnsureStorageInitialized(Tag::kErr);
return err_;
}
const ErrorEnun& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ErrorAsEnum_Result& set_err(ErrorEnun value);
Tag Which() const { return Tag(tag_); }
// You probably want to use Which() method instead of Ordinal(). Use Ordinal()
// only when you need access to the raw integral ordinal value.
fidl_xunion_tag_t Ordinal() const { return tag_; }
const std::vector<uint8_t>* UnknownData() const { return nullptr; }
friend ::fidl::Equality<::test::name::WithErrorSyntax_ErrorAsEnum_Result>;
WithErrorSyntax_ErrorAsEnum_Result(fit::result<void, ErrorEnun>&& result) {
ZX_ASSERT(!result.is_pending());
if (result.is_ok()) {
set_response(WithErrorSyntax_ErrorAsEnum_Response{});
} else {
set_err(std::move(result.take_error()));
}
}
WithErrorSyntax_ErrorAsEnum_Result(fit::ok_result<void>&& result)
: WithErrorSyntax_ErrorAsEnum_Result(
fit::result<void, ErrorEnun>(std::move(result))) {}
WithErrorSyntax_ErrorAsEnum_Result(fit::error_result<ErrorEnun>&& result)
: WithErrorSyntax_ErrorAsEnum_Result(
fit::result<void, ErrorEnun>(std::move(result))) {}
operator fit::result<void, ErrorEnun>() && {
if (is_err()) {
return fit::error(err());
}
return fit::ok();
}
private:
void Destroy();
void EnsureStorageInitialized(::fidl_xunion_tag_t tag);
::fidl_xunion_tag_t tag_ = static_cast<fidl_xunion_tag_t>(Tag::Invalid);
union {
class WithErrorSyntax_ErrorAsEnum_Response response_;
ErrorEnun err_;
};
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Result& value,
::test::name::WithErrorSyntax_ErrorAsEnum_Result* result) {
return value.Clone(result);
}
using WithErrorSyntax_ErrorAsEnum_ResultPtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Result>;
#ifdef __Fuchsia__
class WithErrorSyntax {
public:
using Proxy_ = WithErrorSyntax_Proxy;
using Stub_ = WithErrorSyntax_Stub;
using EventSender_ = WithErrorSyntax_EventSender;
using Sync_ = WithErrorSyntax_Sync;
virtual ~WithErrorSyntax();
using ResponseAsStructCallback =
fit::function<void(WithErrorSyntax_ResponseAsStruct_Result)>;
virtual void ResponseAsStruct(ResponseAsStructCallback callback) = 0;
using ErrorAsPrimitiveCallback =
fit::function<void(WithErrorSyntax_ErrorAsPrimitive_Result)>;
virtual void ErrorAsPrimitive(ErrorAsPrimitiveCallback callback) = 0;
using ErrorAsEnumCallback =
fit::function<void(WithErrorSyntax_ErrorAsEnum_Result)>;
virtual void ErrorAsEnum(ErrorAsEnumCallback callback) = 0;
};
class WithErrorSyntax_RequestEncoder {
public:
static ::fidl::Message ResponseAsStruct(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message ErrorAsPrimitive(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
static ::fidl::Message ErrorAsEnum(::fidl::Encoder* _encoder) {
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
return _encoder->GetMessage();
}
};
class WithErrorSyntax_RequestDecoder {
public:
WithErrorSyntax_RequestDecoder() = default;
virtual ~WithErrorSyntax_RequestDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal, bool* out_needs_response);
zx_status_t Decode_(::fidl::Message request) {
bool needs_response;
const fidl_type_t* request_type =
GetType(request.ordinal(), &needs_response);
if (request_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = request.Decode(request_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(request, request_type, error_msg);
return status;
}
::fidl::Decoder request_decoder(std::move(request));
switch (request.ordinal()) {
case internal::kWithErrorSyntax_ResponseAsStruct_Ordinal:
case internal::kWithErrorSyntax_ResponseAsStruct_GenOrdinal: {
ResponseAsStruct();
break;
}
case internal::kWithErrorSyntax_ErrorAsPrimitive_Ordinal:
case internal::kWithErrorSyntax_ErrorAsPrimitive_GenOrdinal: {
ErrorAsPrimitive();
break;
}
case internal::kWithErrorSyntax_ErrorAsEnum_Ordinal:
case internal::kWithErrorSyntax_ErrorAsEnum_GenOrdinal: {
ErrorAsEnum();
break;
}
default: {
status = ZX_ERR_NOT_SUPPORTED;
break;
}
}
return status;
}
virtual void ResponseAsStruct() = 0;
virtual void ErrorAsPrimitive() = 0;
virtual void ErrorAsEnum() = 0;
};
class WithErrorSyntax_ResponseEncoder {
public:
static ::fidl::Message ResponseAsStruct(
::fidl::Encoder* _encoder,
WithErrorSyntax_ResponseAsStruct_Result* result) {
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
return _encoder->GetMessage();
}
static ::fidl::Message ErrorAsPrimitive(
::fidl::Encoder* _encoder,
WithErrorSyntax_ErrorAsPrimitive_Result* result) {
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
return _encoder->GetMessage();
}
static ::fidl::Message ErrorAsEnum(
::fidl::Encoder* _encoder, WithErrorSyntax_ErrorAsEnum_Result* result) {
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
return _encoder->GetMessage();
}
};
class WithErrorSyntax_ResponseDecoder {
public:
WithErrorSyntax_ResponseDecoder() = default;
virtual ~WithErrorSyntax_ResponseDecoder() = default;
static const fidl_type_t* GetType(uint64_t ordinal);
zx_status_t Decode_(::fidl::Message response) {
const fidl_type_t* response_type = GetType(response.ordinal());
if (response_type == nullptr) {
return ZX_ERR_NOT_SUPPORTED;
}
const char* error_msg = nullptr;
zx_status_t status = response.Decode(response_type, &error_msg);
if (status != ZX_OK) {
FIDL_REPORT_DECODING_ERROR(response, response_type, error_msg);
return status;
}
::fidl::Decoder response_decoder(std::move(response));
switch (response.ordinal()) {
case internal::kWithErrorSyntax_ResponseAsStruct_Ordinal:
case internal::kWithErrorSyntax_ResponseAsStruct_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<WithErrorSyntax_ResponseAsStruct_Result>(
&response_decoder, 16);
ResponseAsStruct(std::move(arg0));
break;
}
case internal::kWithErrorSyntax_ErrorAsPrimitive_Ordinal:
case internal::kWithErrorSyntax_ErrorAsPrimitive_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<WithErrorSyntax_ErrorAsPrimitive_Result>(
&response_decoder, 16);
ErrorAsPrimitive(std::move(arg0));
break;
}
case internal::kWithErrorSyntax_ErrorAsEnum_Ordinal:
case internal::kWithErrorSyntax_ErrorAsEnum_GenOrdinal: {
auto arg0 = ::fidl::DecodeAs<WithErrorSyntax_ErrorAsEnum_Result>(
&response_decoder, 16);
ErrorAsEnum(std::move(arg0));
break;
}
default: {
break;
}
}
return ZX_OK;
}
virtual void ResponseAsStruct(
WithErrorSyntax_ResponseAsStruct_Result result) = 0;
virtual void ErrorAsPrimitive(
WithErrorSyntax_ErrorAsPrimitive_Result result) = 0;
virtual void ErrorAsEnum(WithErrorSyntax_ErrorAsEnum_Result result) = 0;
};
class WithErrorSyntax_EventSender {
public:
virtual ~WithErrorSyntax_EventSender();
};
class WithErrorSyntax_Sync {
public:
using Proxy_ = WithErrorSyntax_SyncProxy;
virtual ~WithErrorSyntax_Sync();
virtual zx_status_t ResponseAsStruct(
WithErrorSyntax_ResponseAsStruct_Result* out_result) = 0;
virtual zx_status_t ErrorAsPrimitive(
WithErrorSyntax_ErrorAsPrimitive_Result* out_result) = 0;
virtual zx_status_t ErrorAsEnum(
WithErrorSyntax_ErrorAsEnum_Result* out_result) = 0;
};
class WithErrorSyntax_Proxy final : public ::fidl::internal::Proxy,
public WithErrorSyntax {
public:
explicit WithErrorSyntax_Proxy(::fidl::internal::ProxyController* controller);
~WithErrorSyntax_Proxy() override;
zx_status_t Dispatch_(::fidl::Message message) override;
void ResponseAsStruct(ResponseAsStructCallback callback) override;
void ErrorAsPrimitive(ErrorAsPrimitiveCallback callback) override;
void ErrorAsEnum(ErrorAsEnumCallback callback) override;
private:
WithErrorSyntax_Proxy(const WithErrorSyntax_Proxy&) = delete;
WithErrorSyntax_Proxy& operator=(const WithErrorSyntax_Proxy&) = delete;
::fidl::internal::ProxyController* controller_;
};
class WithErrorSyntax_Stub final : public ::fidl::internal::Stub,
public WithErrorSyntax_EventSender {
public:
typedef class ::test::name::WithErrorSyntax WithErrorSyntax_clazz;
explicit WithErrorSyntax_Stub(WithErrorSyntax_clazz* impl);
~WithErrorSyntax_Stub() override;
zx_status_t Dispatch_(::fidl::Message message,
::fidl::internal::PendingResponse response) override;
private:
WithErrorSyntax_clazz* impl_;
};
class WithErrorSyntax_SyncProxy : public WithErrorSyntax_Sync {
public:
explicit WithErrorSyntax_SyncProxy(::zx::channel channel);
~WithErrorSyntax_SyncProxy() override;
zx_status_t ResponseAsStruct(
WithErrorSyntax_ResponseAsStruct_Result* out_result) override;
zx_status_t ErrorAsPrimitive(
WithErrorSyntax_ErrorAsPrimitive_Result* out_result) override;
zx_status_t ErrorAsEnum(
WithErrorSyntax_ErrorAsEnum_Result* out_result) override;
private:
::fidl::internal::SynchronousProxy proxy_;
friend class ::fidl::SynchronousInterfacePtr<WithErrorSyntax>;
};
#endif // __Fuchsia__
} // namespace name
} // namespace test
namespace fidl {
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ResponseAsStruct_Response>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ResponseAsStruct_Response, 24> {};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Response& value,
::test::name::WithErrorSyntax_ResponseAsStruct_Response* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ResponseAsStruct_Response> {
bool operator()(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Response& _lhs,
const ::test::name::WithErrorSyntax_ResponseAsStruct_Response& _rhs)
const {
if (!::fidl::Equals(_lhs.a, _rhs.a)) {
return false;
}
if (!::fidl::Equals(_lhs.b, _rhs.b)) {
return false;
}
if (!::fidl::Equals(_lhs.c, _rhs.c)) {
return false;
}
return true;
}
};
template <>
struct IsFidlXUnion<::test::name::WithErrorSyntax_ResponseAsStruct_Result>
: public std::true_type {};
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ResponseAsStruct_Result>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ResponseAsStruct_Result, 24> {};
template <>
struct CodingTraits<
std::unique_ptr<::test::name::WithErrorSyntax_ResponseAsStruct_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<::test::name::WithErrorSyntax_ResponseAsStruct_Result>*
value,
size_t offset) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<::test::name::WithErrorSyntax_ResponseAsStruct_Result>*
value,
size_t offset) {
fidl_xunion_t* encoded = decoder->GetPtr<fidl_xunion_t>(offset);
if (encoded->tag == 0) {
value->reset(nullptr);
return;
}
value->reset(new ::test::name::WithErrorSyntax_ResponseAsStruct_Result);
::test::name::WithErrorSyntax_ResponseAsStruct_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Result& value,
::test::name::WithErrorSyntax_ResponseAsStruct_Result* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ResponseAsStruct_Result> {
bool operator()(
const ::test::name::WithErrorSyntax_ResponseAsStruct_Result& _lhs,
const ::test::name::WithErrorSyntax_ResponseAsStruct_Result& _rhs) const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::test::name::WithErrorSyntax_ResponseAsStruct_Result::Tag::Invalid):
return true;
case ::test::name::WithErrorSyntax_ResponseAsStruct_Result::Tag::
kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::test::name::WithErrorSyntax_ResponseAsStruct_Result::Tag::kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ErrorAsPrimitive_Response>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ErrorAsPrimitive_Response, 1> {};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& value,
::test::name::WithErrorSyntax_ErrorAsPrimitive_Response* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ErrorAsPrimitive_Response> {
bool operator()(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& _lhs,
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Response& _rhs)
const {
if (!::fidl::Equals(_lhs.__reserved, _rhs.__reserved)) {
return false;
}
return true;
}
};
template <>
struct IsFidlXUnion<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>
: public std::true_type {};
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result, 24> {};
template <>
struct CodingTraits<
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>*
value,
size_t offset) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result>*
value,
size_t offset) {
fidl_xunion_t* encoded = decoder->GetPtr<fidl_xunion_t>(offset);
if (encoded->tag == 0) {
value->reset(nullptr);
return;
}
value->reset(new ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result);
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result& value,
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ErrorAsPrimitive_Result> {
bool operator()(
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result& _lhs,
const ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result& _rhs) const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::test::name::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::Invalid):
return true;
case ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::
kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::test::name::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ErrorAsEnum_Response>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ErrorAsEnum_Response, 1> {};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Response& value,
::test::name::WithErrorSyntax_ErrorAsEnum_Response* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ErrorAsEnum_Response> {
bool operator()(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Response& _lhs,
const ::test::name::WithErrorSyntax_ErrorAsEnum_Response& _rhs) const {
if (!::fidl::Equals(_lhs.__reserved, _rhs.__reserved)) {
return false;
}
return true;
}
};
template <>
struct CodingTraits<::test::name::ErrorEnun> {
static constexpr size_t inline_size_old = sizeof(::test::name::ErrorEnun);
static constexpr size_t inline_size_v1_no_ee =
sizeof(::test::name::ErrorEnun);
static void Encode(Encoder* encoder, ::test::name::ErrorEnun* value,
size_t offset) {
uint32_t underlying = static_cast<uint32_t>(*value);
::fidl::Encode(encoder, &underlying, offset);
}
static void Decode(Decoder* decoder, ::test::name::ErrorEnun* value,
size_t offset) {
uint32_t underlying = {};
::fidl::Decode(decoder, &underlying, offset);
*value = static_cast<::test::name::ErrorEnun>(underlying);
}
};
inline zx_status_t Clone(::test::name::ErrorEnun value,
::test::name::ErrorEnun* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::ErrorEnun> {
bool operator()(const ::test::name::ErrorEnun& _lhs,
const ::test::name::ErrorEnun& _rhs) const {
return _lhs == _rhs;
}
};
template <>
struct IsFidlXUnion<::test::name::WithErrorSyntax_ErrorAsEnum_Result>
: public std::true_type {};
template <>
struct CodingTraits<::test::name::WithErrorSyntax_ErrorAsEnum_Result>
: public EncodableCodingTraits<
::test::name::WithErrorSyntax_ErrorAsEnum_Result, 24> {};
template <>
struct CodingTraits<
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsEnum_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsEnum_Result>* value,
size_t offset) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<::test::name::WithErrorSyntax_ErrorAsEnum_Result>* value,
size_t offset) {
fidl_xunion_t* encoded = decoder->GetPtr<fidl_xunion_t>(offset);
if (encoded->tag == 0) {
value->reset(nullptr);
return;
}
value->reset(new ::test::name::WithErrorSyntax_ErrorAsEnum_Result);
::test::name::WithErrorSyntax_ErrorAsEnum_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Result& value,
::test::name::WithErrorSyntax_ErrorAsEnum_Result* result) {
return ::test::name::Clone(value, result);
}
template <>
struct Equality<::test::name::WithErrorSyntax_ErrorAsEnum_Result> {
bool operator()(
const ::test::name::WithErrorSyntax_ErrorAsEnum_Result& _lhs,
const ::test::name::WithErrorSyntax_ErrorAsEnum_Result& _rhs) const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::test::name::WithErrorSyntax_ErrorAsEnum_Result::Tag::Invalid):
return true;
case ::test::name::WithErrorSyntax_ErrorAsEnum_Result::Tag::kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::test::name::WithErrorSyntax_ErrorAsEnum_Result::Tag::kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
} // namespace fidl