blob: 5332e9775a0d92fcad19c2dcaa0ab778da4f3a1e [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include <lib/fidl/internal.h>
#include <lib/fidl/cpp/vector_view.h>
#include <lib/fidl/cpp/string_view.h>
#include <lib/fidl/llcpp/array_wrapper.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/traits.h>
#include <lib/zx/channel.h>
#include <lib/zx/eventpair.h>
#include <zircon/fidl.h>
namespace fidl {
namespace test {
namespace llcpp {
namespace basictypes {
struct SimpleStruct;
struct SimpleUnion;
class TestInterface;
extern "C" const fidl_type_t fidl_test_llcpp_basictypes_SimpleStructTable;
struct SimpleStruct {
static constexpr const fidl_type_t* Type = &fidl_test_llcpp_basictypes_SimpleStructTable;
static constexpr uint32_t MaxNumHandles = 21;
static constexpr uint32_t PrimarySize = 88;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
int32_t field{};
::zx::eventpair ep{};
::fidl::ArrayWrapper<::fidl::ArrayWrapper<::zx::eventpair, 4>, 5> arr{};
};
extern "C" const fidl_type_t fidl_test_llcpp_basictypes_SimpleUnionTable;
struct SimpleUnion {
enum class Tag : fidl_union_tag_t {
kFieldA = 0,
kFieldB = 1,
Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(),
};
bool has_invalid_tag() const { return tag_ == Tag::Invalid; }
bool is_field_a() const { return tag_ == Tag::kFieldA; }
int32_t& mutable_field_a() {
tag_ = Tag::kFieldA;
return field_a_;
}
const int32_t& field_a() const { return field_a_; }
bool is_field_b() const { return tag_ == Tag::kFieldB; }
int32_t& mutable_field_b() {
tag_ = Tag::kFieldB;
return field_b_;
}
const int32_t& field_b() const { return field_b_; }
Tag which() const { return tag_; }
static constexpr const fidl_type_t* Type = &fidl_test_llcpp_basictypes_SimpleUnionTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 8;
[[maybe_unused]]
static constexpr uint32_t MaxOutOfLine = 0;
private:
void SizeAndOffsetAssertionHelper();
Tag tag_;
union {
int32_t field_a_;
int32_t field_b_;
};
};
extern "C" const fidl_type_t fidl_test_llcpp_basictypes_TestInterfaceConsumeSimpleStructRequestTable;
// Test interface implemented by both C and LLCPP
class TestInterface final {
public:
struct ConsumeSimpleStructResponse {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
int32_t status;
int32_t field;
static constexpr const fidl_type_t* Type = nullptr;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
};
struct ConsumeSimpleStructRequest {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
SimpleStruct arg;
static constexpr const fidl_type_t* Type = &fidl_test_llcpp_basictypes_TestInterfaceConsumeSimpleStructRequestTable;
static constexpr uint32_t MaxNumHandles = 21;
static constexpr uint32_t PrimarySize = 104;
static constexpr uint32_t MaxOutOfLine = 0;
using ResponseType = ConsumeSimpleStructResponse;
};
struct ConsumeSimpleUnionResponse {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
uint32_t index;
int32_t field;
static constexpr const fidl_type_t* Type = nullptr;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
};
struct ConsumeSimpleUnionRequest {
FIDL_ALIGNDECL
fidl_message_header_t _hdr;
SimpleUnion arg;
static constexpr const fidl_type_t* Type = nullptr;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
static constexpr uint32_t MaxOutOfLine = 0;
using ResponseType = ConsumeSimpleUnionResponse;
};
class SyncClient final {
public:
SyncClient(::zx::channel channel) : channel_(std::move(channel)) {}
~SyncClient() {}
// Verifies that all the handles are valid channels, then returns
// ZX_OK and loops back the field member. Otherwise, returns an error.
zx_status_t ConsumeSimpleStruct(SimpleStruct arg, int32_t* out_status, int32_t* out_field);
// Verifies that all the handles are valid channels, then returns
// ZX_OK and loops back the field member. Otherwise, returns an error.
// Caller provides the backing storage for FIDL message via request and response buffers.
zx_status_t ConsumeSimpleStruct(::fidl::BytePart _request_buffer, SimpleStruct arg, ::fidl::BytePart _response_buffer, int32_t* out_status, int32_t* out_field);
// Verifies that all the handles are valid channels, then returns
// ZX_OK and loops back the field member. Otherwise, returns an error.
// Messages are encoded and decoded in-place.
::fidl::DecodeResult<ConsumeSimpleStructResponse> ConsumeSimpleStruct(::fidl::DecodedMessage<ConsumeSimpleStructRequest> params, ::fidl::BytePart response_buffer);
// Loops back the field which is set, along with its index.
zx_status_t ConsumeSimpleUnion(SimpleUnion arg, uint32_t* out_index, int32_t* out_field);
// Loops back the field which is set, along with its index.
// Caller provides the backing storage for FIDL message via request and response buffers.
zx_status_t ConsumeSimpleUnion(::fidl::BytePart _request_buffer, SimpleUnion arg, ::fidl::BytePart _response_buffer, uint32_t* out_index, int32_t* out_field);
// Loops back the field which is set, along with its index.
// Messages are encoded and decoded in-place.
::fidl::DecodeResult<ConsumeSimpleUnionResponse> ConsumeSimpleUnion(::fidl::DecodedMessage<ConsumeSimpleUnionRequest> params, ::fidl::BytePart response_buffer);
private:
::zx::channel channel_;
};
};
} // namespace basictypes
} // namespace llcpp
} // namespace test
} // namespace fidl
namespace fidl {
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::SimpleStruct> : public std::true_type {};
static_assert(std::is_standard_layout_v<::fidl::test::llcpp::basictypes::SimpleStruct>);
static_assert(offsetof(::fidl::test::llcpp::basictypes::SimpleStruct, field) == 0);
static_assert(offsetof(::fidl::test::llcpp::basictypes::SimpleStruct, ep) == 4);
static_assert(offsetof(::fidl::test::llcpp::basictypes::SimpleStruct, arr) == 8);
static_assert(sizeof(::fidl::test::llcpp::basictypes::SimpleStruct) == ::fidl::test::llcpp::basictypes::SimpleStruct::PrimarySize);
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::SimpleUnion> : public std::true_type {};
static_assert(std::is_standard_layout_v<::fidl::test::llcpp::basictypes::SimpleUnion>);
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructRequest> : public std::true_type {};
static_assert(sizeof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructRequest)
== ::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructRequest::PrimarySize);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructRequest, arg) == 16);
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse> : public std::true_type {};
static_assert(sizeof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse)
== ::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse::PrimarySize);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse, status) == 16);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleStructResponse, field) == 20);
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionRequest> : public std::true_type {};
template <>
struct IsFidlMessage<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionRequest> : public std::true_type {};
static_assert(sizeof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionRequest)
== ::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionRequest::PrimarySize);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionRequest, arg) == 16);
template <>
struct IsFidlType<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse> : public std::true_type {};
template <>
struct IsFidlMessage<::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse> : public std::true_type {};
static_assert(sizeof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse)
== ::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse::PrimarySize);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse, index) == 16);
static_assert(offsetof(::fidl::test::llcpp::basictypes::TestInterface::ConsumeSimpleUnionResponse, field) == 20);
} // namespace fidl