blob: ca1a6a3b927fc950124bdfab49453e2a467f2e79 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include "lib/fidl/cpp/internal/natural_types_header.h"
//
// Domain objects declarations (i.e. "natural types" in unified bindings).
//
namespace fidl {
namespace test {
namespace protocols {
enum class obj_type : uint32_t {
NONE = 0u,
SOCKET = 14u,
};
inline zx_status_t Clone(::fidl::test::protocols::obj_type value,
::fidl::test::protocols::obj_type* result) {
*result = value;
return ZX_OK;
}
class WithErrorSyntax_ResponseAsStruct_Response;
class WithErrorSyntax_ResponseAsStruct_Result;
class WithErrorSyntax_ErrorAsPrimitive_Response;
class WithErrorSyntax_ErrorAsPrimitive_Result;
class WithErrorSyntax_ErrorAsEnum_Response;
#ifdef __Fuchsia__
class DiscoverableProtocol;
using DiscoverableProtocolHandle =
::fidl::InterfaceHandle<DiscoverableProtocol>;
#endif // __Fuchsia__
#ifdef __Fuchsia__
class Transitional;
using TransitionalHandle = ::fidl::InterfaceHandle<Transitional>;
#endif // __Fuchsia__
#ifdef __Fuchsia__
class ChannelProtocol;
using ChannelProtocolHandle = ::fidl::InterfaceHandle<ChannelProtocol>;
#endif // __Fuchsia__
#ifdef __Fuchsia__
class WithAndWithoutRequestResponse;
using WithAndWithoutRequestResponseHandle =
::fidl::InterfaceHandle<WithAndWithoutRequestResponse>;
#endif // __Fuchsia__
enum class ErrorEnun : uint32_t {
ERR_FOO = 1u,
ERR_BAR = 2u,
};
inline zx_status_t Clone(::fidl::test::protocols::ErrorEnun value,
::fidl::test::protocols::ErrorEnun* result) {
*result = value;
return ZX_OK;
}
class WithErrorSyntax_ErrorAsEnum_Result;
#ifdef __Fuchsia__
class WithErrorSyntax;
using WithErrorSyntaxHandle = ::fidl::InterfaceHandle<WithErrorSyntax>;
#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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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 ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response&
_value,
::fidl::test::protocols::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(
::fidl::test::protocols::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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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_ == ::fidl::test::protocols::
WithErrorSyntax_ResponseAsStruct_Result::Tag::kResponse;
}
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response&
response() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::Tag::
kResponse);
return response_;
}
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response&
response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ResponseAsStruct_Result& set_response(
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response value);
bool is_err() const {
return tag_ == ::fidl::test::protocols::
WithErrorSyntax_ResponseAsStruct_Result::Tag::kErr;
}
uint32_t& err() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::Tag::
kErr);
return err_;
}
const uint32_t& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ResponseAsStruct_Result& set_err(uint32_t value);
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::Tag Which()
const {
return ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::
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_; }
friend ::fidl::Equality<
::fidl::test::protocols::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(
::fidl::test::protocols::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>(
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::Tag::
Invalid);
union {
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response
response_;
uint32_t err_;
};
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result&
value,
::fidl::test::protocols::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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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 ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
_value,
::fidl::test::protocols::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(
::fidl::test::protocols::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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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_ == ::fidl::test::protocols::
WithErrorSyntax_ErrorAsPrimitive_Result::Tag::kResponse;
}
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
response() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::
kResponse);
return response_;
}
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ErrorAsPrimitive_Result& set_response(
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response value);
bool is_err() const {
return tag_ == ::fidl::test::protocols::
WithErrorSyntax_ErrorAsPrimitive_Result::Tag::kErr;
}
uint32_t& err() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::
kErr);
return err_;
}
const uint32_t& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ErrorAsPrimitive_Result& set_err(uint32_t value);
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::Tag Which()
const {
return ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::
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_; }
friend ::fidl::Equality<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result>;
WithErrorSyntax_ErrorAsPrimitive_Result(
fit::result<void, uint32_t>&& result) {
ZX_ASSERT(!result.is_pending());
if (result.is_ok()) {
set_response(
::fidl::test::protocols::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>(
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::Tag::
Invalid);
union {
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response
response_;
uint32_t err_;
};
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result&
value,
::fidl::test::protocols::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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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 ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response& _value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response* _result) {
return _value.Clone(_result);
}
using WithErrorSyntax_ErrorAsEnum_ResponsePtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Response>;
#ifdef __Fuchsia__
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_DiscoverableProtocolMethodRequestTable;
} // namespace _internal
class DiscoverableProtocol_RequestEncoder {
public:
static ::fidl::HLCPPOutgoingMessage Method(::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_DiscoverableProtocolMethodRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
class DiscoverableProtocol_ResponseEncoder {
public:
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_TransitionalRequestRequestTable;
extern "C" const fidl_type_t fidl_test_protocols_TransitionalOneWayRequestTable;
} // namespace _internal
class Transitional_RequestEncoder {
public:
static ::fidl::HLCPPOutgoingMessage Request(::fidl::Encoder* _encoder,
int64_t* x) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, x, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_TransitionalRequestRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage OneWay(::fidl::Encoder* _encoder,
int64_t* x) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, x, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_TransitionalOneWayRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_TransitionalRequestResponseTable;
extern "C" const fidl_type_t fidl_test_protocols_TransitionalEventEventTable;
} // namespace _internal
class Transitional_ResponseEncoder {
public:
static ::fidl::HLCPPOutgoingMessage Request(::fidl::Encoder* _encoder,
int64_t* y) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, y, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_TransitionalRequestResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage Event(::fidl::Encoder* _encoder,
int64_t* x) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, x, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_TransitionalEventEventTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolMethodARequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolMethodBRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolTakeHandleRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolMutateSocketRequestTable;
} // namespace _internal
class ChannelProtocol_RequestEncoder {
public:
static ::fidl::HLCPPOutgoingMessage MethodA(::fidl::Encoder* _encoder,
int64_t* a, int64_t* b) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolMethodARequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage MethodB(::fidl::Encoder* _encoder,
int64_t* a, int64_t* b) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolMethodBRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage TakeHandle(::fidl::Encoder* _encoder,
::zx::handle* h) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, h, 16,
::fidl::HandleInformation{
.object_type = ZX_OBJ_TYPE_NONE,
.rights = 0x80000000,
});
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolTakeHandleRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage MutateSocket(::fidl::Encoder* _encoder,
::zx::socket* a) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16,
::fidl::HandleInformation{
.object_type = ZX_OBJ_TYPE_SOCKET,
.rights = 0x80000000,
});
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolMutateSocketRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolEventAEventTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolMethodBResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolTakeHandleResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_ChannelProtocolMutateSocketResponseTable;
} // namespace _internal
class ChannelProtocol_ResponseEncoder {
public:
static ::fidl::HLCPPOutgoingMessage EventA(::fidl::Encoder* _encoder,
int64_t* a, int64_t* b) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, a, 16);
::fidl::Encode(_encoder, b, 24);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolEventAEventTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage MethodB(::fidl::Encoder* _encoder,
int64_t* result) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolMethodBResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage TakeHandle(::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolTakeHandleResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage MutateSocket(::fidl::Encoder* _encoder,
::zx::socket* b) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(24 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, b, 16,
::fidl::HandleInformation{
.object_type = ZX_OBJ_TYPE_SOCKET,
.rights = 0x80000000,
});
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_ChannelProtocolMutateSocketResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
#endif // __Fuchsia__
#ifdef __Fuchsia__
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestNoResponseRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestEmptyResponseRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestWithResponseRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestNoResponseRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestEmptyResponseRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestWithResponseRequestTable;
} // namespace _internal
class WithAndWithoutRequestResponse_RequestEncoder {
public:
static ::fidl::HLCPPOutgoingMessage NoRequestNoResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestNoResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage NoRequestEmptyResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestEmptyResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage NoRequestWithResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestWithResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage WithRequestNoResponse(
::fidl::Encoder* _encoder, ::std::string* arg) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestNoResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage WithRequestEmptyResponse(
::fidl::Encoder* _encoder, ::std::string* arg) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestEmptyResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage WithRequestWithResponse(
::fidl::Encoder* _encoder, ::std::string* arg) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, arg, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestWithResponseRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestEmptyResponseResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestWithResponseResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestEmptyResponseResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestWithResponseResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseOnEmptyResponseEventTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithAndWithoutRequestResponseOnWithResponseEventTable;
} // namespace _internal
class WithAndWithoutRequestResponse_ResponseEncoder {
public:
static ::fidl::HLCPPOutgoingMessage NoRequestEmptyResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestEmptyResponseResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage NoRequestWithResponse(
::fidl::Encoder* _encoder, ::std::string* ret) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseNoRequestWithResponseResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage WithRequestEmptyResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestEmptyResponseResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage WithRequestWithResponse(
::fidl::Encoder* _encoder, ::std::string* ret) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseWithRequestWithResponseResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage OnEmptyResponse(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseOnEmptyResponseEventTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage OnWithResponse(::fidl::Encoder* _encoder,
::std::string* ret) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(32 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, ret, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithAndWithoutRequestResponseOnWithResponseEventTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
#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(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response&&);
static WithErrorSyntax_ErrorAsEnum_Result WithErr(
::fidl::test::protocols::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,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info =
cpp17::nullopt);
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_ == ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::
Tag::kResponse;
}
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response& response() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::
kResponse);
return response_;
}
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response&
response() const {
ZX_ASSERT(is_response());
return response_;
}
WithErrorSyntax_ErrorAsEnum_Result& set_response(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response value);
bool is_err() const {
return tag_ == ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::
Tag::kErr;
}
::fidl::test::protocols::ErrorEnun& err() {
EnsureStorageInitialized(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::kErr);
return err_;
}
const ::fidl::test::protocols::ErrorEnun& err() const {
ZX_ASSERT(is_err());
return err_;
}
WithErrorSyntax_ErrorAsEnum_Result& set_err(
::fidl::test::protocols::ErrorEnun value);
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag Which()
const {
return ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::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_; }
friend ::fidl::Equality<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result>;
WithErrorSyntax_ErrorAsEnum_Result(
fit::result<void, ::fidl::test::protocols::ErrorEnun>&& result) {
ZX_ASSERT(!result.is_pending());
if (result.is_ok()) {
set_response(
::fidl::test::protocols::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, ::fidl::test::protocols::ErrorEnun>(
std::move(result))) {}
WithErrorSyntax_ErrorAsEnum_Result(
fit::error_result<::fidl::test::protocols::ErrorEnun>&& result)
: WithErrorSyntax_ErrorAsEnum_Result(
fit::result<void, ::fidl::test::protocols::ErrorEnun>(
std::move(result))) {}
operator fit::result<void, ::fidl::test::protocols::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>(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::
Invalid);
union {
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response response_;
::fidl::test::protocols::ErrorEnun err_;
};
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result& value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result* result) {
return value.Clone(result);
}
using WithErrorSyntax_ErrorAsEnum_ResultPtr =
::std::unique_ptr<WithErrorSyntax_ErrorAsEnum_Result>;
#ifdef __Fuchsia__
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxResponseAsStructRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxErrorAsPrimitiveRequestTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxErrorAsEnumRequestTable;
} // namespace _internal
class WithErrorSyntax_RequestEncoder {
public:
static ::fidl::HLCPPOutgoingMessage ResponseAsStruct(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxResponseAsStructRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage ErrorAsPrimitive(
::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxErrorAsPrimitiveRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage ErrorAsEnum(::fidl::Encoder* _encoder) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(16 - sizeof(fidl_message_header_t));
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxErrorAsEnumRequestTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
namespace _internal {
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxResponseAsStructResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxErrorAsPrimitiveResponseTable;
extern "C" const fidl_type_t
fidl_test_protocols_WithErrorSyntaxErrorAsEnumResponseTable;
} // namespace _internal
class WithErrorSyntax_ResponseEncoder {
public:
static ::fidl::HLCPPOutgoingMessage ResponseAsStruct(
::fidl::Encoder* _encoder,
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result*
result) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxResponseAsStructResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage ErrorAsPrimitive(
::fidl::Encoder* _encoder,
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result*
result) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
fidl_trace(
DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxErrorAsPrimitiveResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
static ::fidl::HLCPPOutgoingMessage ErrorAsEnum(
::fidl::Encoder* _encoder,
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result* result) {
fidl_trace(WillHLCPPEncode);
_encoder->Alloc(40 - sizeof(fidl_message_header_t));
::fidl::Encode(_encoder, result, 16);
fidl_trace(DidHLCPPEncode,
&::fidl::test::protocols::_internal::
fidl_test_protocols_WithErrorSyntaxErrorAsEnumResponseTable,
_encoder->GetPtr<const char>(0), _encoder->CurrentLength(),
_encoder->CurrentHandleCount());
return _encoder->GetMessage();
}
};
#endif // __Fuchsia__
} // namespace protocols
} // namespace test
template <>
struct CodingTraits<::fidl::test::protocols::obj_type> {
static constexpr size_t inline_size_old =
sizeof(::fidl::test::protocols::obj_type);
static constexpr size_t inline_size_v1_no_ee =
sizeof(::fidl::test::protocols::obj_type);
static void Encode(
Encoder* encoder, ::fidl::test::protocols::obj_type* value, size_t offset,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info) {
ZX_DEBUG_ASSERT(!maybe_handle_info);
uint32_t underlying = static_cast<uint32_t>(*value);
::fidl::Encode(encoder, &underlying, offset);
}
static void Decode(Decoder* decoder, ::fidl::test::protocols::obj_type* value,
size_t offset) {
uint32_t underlying = {};
::fidl::Decode(decoder, &underlying, offset);
*value = static_cast<::fidl::test::protocols::obj_type>(underlying);
}
};
inline zx_status_t Clone(::fidl::test::protocols::obj_type value,
::fidl::test::protocols::obj_type* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<::fidl::test::protocols::obj_type> {
bool operator()(const ::fidl::test::protocols::obj_type& _lhs,
const ::fidl::test::protocols::obj_type& _rhs) const {
return _lhs == _rhs;
}
};
template <>
struct CodingTraits<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response,
24> {};
template <>
struct IsMemcpyCompatible<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response>
: public internal::BoolConstant<
!HasPadding<::fidl::test::protocols::
WithErrorSyntax_ResponseAsStruct_Response>::value &&
IsMemcpyCompatible<int64_t>::value> {};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response&
value,
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response*
result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Response&
_lhs,
const ::fidl::test::protocols::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<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result>
: public std::true_type {};
template <>
struct CodingTraits<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result,
24> {};
template <>
struct CodingTraits<std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result>*
value,
size_t offset,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<
::fidl::test::protocols::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 ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result);
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result&
value,
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result&
_lhs,
const ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result&
_rhs) const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::
Tag::Invalid):
return true;
case ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::
Tag::kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::fidl::test::protocols::WithErrorSyntax_ResponseAsStruct_Result::
Tag::kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
template <>
struct CodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response,
1> {};
template <>
struct IsMemcpyCompatible<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response>
: public internal::BoolConstant<
!HasPadding<::fidl::test::protocols::
WithErrorSyntax_ErrorAsPrimitive_Response>::value &&
IsMemcpyCompatible<uint8_t>::value> {};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response*
result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
_lhs,
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Response&
_rhs) const {
if (!::fidl::Equals(_lhs.__reserved, _rhs.__reserved)) {
return false;
}
return true;
}
};
template <>
struct IsFidlXUnion<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result>
: public std::true_type {};
template <>
struct CodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result,
24> {};
template <>
struct CodingTraits<std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result>*
value,
size_t offset,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<
::fidl::test::protocols::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 ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result);
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result&
value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result&
_lhs,
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result&
_rhs) const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::
Tag::Invalid):
return true;
case ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::
Tag::kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::fidl::test::protocols::WithErrorSyntax_ErrorAsPrimitive_Result::
Tag::kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
template <>
struct CodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response, 1> {};
template <>
struct IsMemcpyCompatible<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response>
: public internal::BoolConstant<
!HasPadding<::fidl::test::protocols::
WithErrorSyntax_ErrorAsEnum_Response>::value &&
IsMemcpyCompatible<uint8_t>::value> {};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response& value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response& _lhs,
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Response& _rhs)
const {
if (!::fidl::Equals(_lhs.__reserved, _rhs.__reserved)) {
return false;
}
return true;
}
};
template <>
struct CodingTraits<::fidl::test::protocols::ErrorEnun> {
static constexpr size_t inline_size_old =
sizeof(::fidl::test::protocols::ErrorEnun);
static constexpr size_t inline_size_v1_no_ee =
sizeof(::fidl::test::protocols::ErrorEnun);
static void Encode(
Encoder* encoder, ::fidl::test::protocols::ErrorEnun* value,
size_t offset,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info) {
ZX_DEBUG_ASSERT(!maybe_handle_info);
uint32_t underlying = static_cast<uint32_t>(*value);
::fidl::Encode(encoder, &underlying, offset);
}
static void Decode(Decoder* decoder,
::fidl::test::protocols::ErrorEnun* value, size_t offset) {
uint32_t underlying = {};
::fidl::Decode(decoder, &underlying, offset);
*value = static_cast<::fidl::test::protocols::ErrorEnun>(underlying);
}
};
inline zx_status_t Clone(::fidl::test::protocols::ErrorEnun value,
::fidl::test::protocols::ErrorEnun* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<::fidl::test::protocols::ErrorEnun> {
bool operator()(const ::fidl::test::protocols::ErrorEnun& _lhs,
const ::fidl::test::protocols::ErrorEnun& _rhs) const {
return _lhs == _rhs;
}
};
template <>
struct IsFidlXUnion<::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result>
: public std::true_type {};
template <>
struct CodingTraits<::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result>
: public EncodableCodingTraits<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result, 24> {};
template <>
struct CodingTraits<std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result>> {
static constexpr size_t inline_size_v1_no_ee = 24;
static void Encode(
Encoder* encoder,
std::unique_ptr<
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result>* value,
size_t offset,
cpp17::optional<::fidl::HandleInformation> maybe_handle_info) {
auto&& p_xunion = *value;
if (p_xunion) {
p_xunion->Encode(encoder, offset);
}
}
static void Decode(
Decoder* decoder,
std::unique_ptr<
::fidl::test::protocols::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 ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result);
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Decode(
decoder, value->get(), offset);
}
};
inline zx_status_t Clone(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result& value,
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result* result) {
return ::fidl::test::protocols::Clone(value, result);
}
template <>
struct Equality<::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result> {
bool operator()(
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result& _lhs,
const ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result& _rhs)
const {
if (_lhs.Ordinal() != _rhs.Ordinal()) {
return false;
}
switch (_lhs.Ordinal()) {
case static_cast<fidl_xunion_tag_t>(
::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::
Invalid):
return true;
case ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::
kResponse:
return ::fidl::Equals(_lhs.response_, _rhs.response_);
case ::fidl::test::protocols::WithErrorSyntax_ErrorAsEnum_Result::Tag::
kErr:
return ::fidl::Equals(_lhs.err_, _rhs.err_);
default:
return false;
}
}
};
} // namespace fidl