blob: 73723c64f7cb05f16663124d5e94522b00eb401a [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include <lib/fidl/internal.h>
#include <lib/fidl/llcpp/array.h>
#include <lib/fidl/llcpp/coding.h>
#include <lib/fidl/llcpp/envelope.h>
#include <lib/fidl/llcpp/errors.h>
#include <lib/fidl/llcpp/message.h>
#include <lib/fidl/llcpp/message_storage.h>
#include <lib/fidl/llcpp/object_view.h>
#include <lib/fidl/llcpp/string_view.h>
#include <lib/fidl/llcpp/traits.h>
#include <lib/fidl/llcpp/vector_view.h>
#include <lib/fit/function.h>
#include <lib/stdcompat/optional.h>
#include <algorithm>
#include <cstddef>
#include <variant>
#ifdef __Fuchsia__
#include <lib/fidl/llcpp/client.h>
#include <lib/fidl/llcpp/client_end.h>
#include <lib/fidl/llcpp/connect_service.h>
#include <lib/fidl/llcpp/result.h>
#include <lib/fidl/llcpp/server.h>
#include <lib/fidl/llcpp/server_end.h>
#include <lib/fidl/llcpp/service_handler_interface.h>
#include <lib/fidl/llcpp/sync_call.h>
#include <lib/fidl/llcpp/transaction.h>
#include <lib/fidl/llcpp/wire_messaging.h>
#include <lib/fidl/txn_header.h>
#endif // __Fuchsia__
#include <zircon/fidl.h>
namespace fidl_test_arrays {
namespace wire {
class UnionSmallArray;
class UnionLargeArray;
class TableSmallArray;
class TableLargeArray;
struct StructSmallArray;
struct StructLargeArray;
extern "C" const fidl_type_t fidl_test_arrays_UnionSmallArrayTable;
class UnionSmallArray {
public:
UnionSmallArray()
: ordinal_(::fidl_test_arrays::wire::UnionSmallArray::Ordinal::Invalid),
envelope_{} {}
UnionSmallArray(const UnionSmallArray&) = default;
UnionSmallArray& operator=(const UnionSmallArray&) = default;
UnionSmallArray(UnionSmallArray&&) = default;
UnionSmallArray& operator=(UnionSmallArray&&) = default;
enum class Tag : fidl_xunion_tag_t {
kA = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_arrays::wire::UnionSmallArray::Ordinal::Invalid;
}
bool is_a() const {
return ordinal_ == ::fidl_test_arrays::wire::UnionSmallArray::Ordinal::kA;
}
static UnionSmallArray WithA(
::fidl::ObjectView<::fidl::Array<uint32_t, 2>> val) {
UnionSmallArray result;
result.set_a(val);
return result;
}
template <typename... Args>
static UnionSmallArray WithA(::fidl::AnyAllocator& allocator,
Args&&... args) {
UnionSmallArray result;
result.set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>> elem) {
ordinal_ = ::fidl_test_arrays::wire::UnionSmallArray::Ordinal::kA;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_a(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_arrays::wire::UnionSmallArray::Ordinal::kA;
set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>>(
allocator, std::forward<Args>(args)...));
}
::fidl::Array<uint32_t, 2>& mutable_a() {
ZX_ASSERT(ordinal_ ==
::fidl_test_arrays::wire::UnionSmallArray::Ordinal::kA);
return *static_cast<::fidl::Array<uint32_t, 2>*>(envelope_.data.get());
}
const ::fidl::Array<uint32_t, 2>& a() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_arrays::wire::UnionSmallArray::Ordinal::kA);
return *static_cast<::fidl::Array<uint32_t, 2>*>(envelope_.data.get());
}
::fidl_test_arrays::wire::UnionSmallArray::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_arrays::wire::UnionSmallArray::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_UnionSmallArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 8;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kA = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_arrays::wire::UnionSmallArray::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_arrays_UnionLargeArrayTable;
class UnionLargeArray {
public:
UnionLargeArray()
: ordinal_(::fidl_test_arrays::wire::UnionLargeArray::Ordinal::Invalid),
envelope_{} {}
UnionLargeArray(const UnionLargeArray&) = default;
UnionLargeArray& operator=(const UnionLargeArray&) = default;
UnionLargeArray(UnionLargeArray&&) = default;
UnionLargeArray& operator=(UnionLargeArray&&) = default;
enum class Tag : fidl_xunion_tag_t {
kA = 1, // 0x1
};
bool has_invalid_tag() const {
return ordinal_ ==
::fidl_test_arrays::wire::UnionLargeArray::Ordinal::Invalid;
}
bool is_a() const {
return ordinal_ == ::fidl_test_arrays::wire::UnionLargeArray::Ordinal::kA;
}
static UnionLargeArray WithA(
::fidl::ObjectView<::fidl::Array<uint32_t, 100>> val) {
UnionLargeArray result;
result.set_a(val);
return result;
}
template <typename... Args>
static UnionLargeArray WithA(::fidl::AnyAllocator& allocator,
Args&&... args) {
UnionLargeArray result;
result.set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 100>>(
allocator, std::forward<Args>(args)...));
return result;
}
void set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 100>> elem) {
ordinal_ = ::fidl_test_arrays::wire::UnionLargeArray::Ordinal::kA;
envelope_.data =
::fidl::ObjectView<void>::FromExternal(static_cast<void*>(elem.get()));
}
template <typename... Args>
void set_a(::fidl::AnyAllocator& allocator, Args&&... args) {
ordinal_ = ::fidl_test_arrays::wire::UnionLargeArray::Ordinal::kA;
set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 100>>(
allocator, std::forward<Args>(args)...));
}
::fidl::Array<uint32_t, 100>& mutable_a() {
ZX_ASSERT(ordinal_ ==
::fidl_test_arrays::wire::UnionLargeArray::Ordinal::kA);
return *static_cast<::fidl::Array<uint32_t, 100>*>(envelope_.data.get());
}
const ::fidl::Array<uint32_t, 100>& a() const {
ZX_ASSERT(ordinal_ ==
::fidl_test_arrays::wire::UnionLargeArray::Ordinal::kA);
return *static_cast<::fidl::Array<uint32_t, 100>*>(envelope_.data.get());
}
::fidl_test_arrays::wire::UnionLargeArray::Tag which() const {
ZX_ASSERT(!has_invalid_tag());
return static_cast<::fidl_test_arrays::wire::UnionLargeArray::Tag>(
ordinal_);
}
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_UnionLargeArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 24;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 400;
static constexpr bool HasPointer = true;
private:
enum class Ordinal : fidl_xunion_tag_t {
Invalid = 0,
kA = 1, // 0x1
};
static void SizeAndOffsetAssertionHelper();
::fidl_test_arrays::wire::UnionLargeArray::Ordinal ordinal_;
FIDL_ALIGNDECL
::fidl::Envelope<void> envelope_;
};
extern "C" const fidl_type_t fidl_test_arrays_TableSmallArrayTable;
class TableSmallArray final {
public:
// Returns whether no field is set.
bool IsEmpty() const { return max_ordinal_ == 0; }
class Frame;
const ::fidl::Array<uint32_t, 2>& a() const {
ZX_ASSERT(has_a());
return *frame_ptr_->a_.data;
}
::fidl::Array<uint32_t, 2>& a() {
ZX_ASSERT(has_a());
return *frame_ptr_->a_.data;
}
bool has_a() const {
return max_ordinal_ >= 1 && frame_ptr_->a_.data != nullptr;
}
TableSmallArray& set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>> elem) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = elem;
max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1));
return *this;
}
TableSmallArray& set_a(std::nullptr_t) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = nullptr;
return *this;
}
template <typename... Args>
TableSmallArray& set_a(::fidl::AnyAllocator& allocator, Args&&... args) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = ::fidl::ObjectView<::fidl::Array<uint32_t, 2>>(
allocator, std::forward<Args>(args)...);
max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1));
return *this;
}
TableSmallArray() = default;
explicit TableSmallArray(::fidl::AnyAllocator& allocator)
: frame_ptr_(::fidl::ObjectView<Frame>(allocator)) {}
// This constructor allows a user controlled allocation (not using a
// FidlAllocator). It should only be used when performance is key. As soon as
// the frame is given to the table, it must not be used directly or for
// another table.
explicit TableSmallArray(::fidl::ObjectView<Frame>&& frame)
: frame_ptr_(std::move(frame)) {}
~TableSmallArray() = default;
TableSmallArray(const TableSmallArray& other) noexcept = default;
TableSmallArray& operator=(const TableSmallArray& other) noexcept = default;
TableSmallArray(TableSmallArray&& other) noexcept = default;
TableSmallArray& operator=(TableSmallArray&& other) noexcept = default;
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_TableSmallArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 16;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 24;
static constexpr bool HasPointer = true;
void Allocate(::fidl::AnyAllocator& allocator) {
max_ordinal_ = 0;
frame_ptr_ = ::fidl::ObjectView<Frame>(allocator);
}
void Init(::fidl::ObjectView<Frame>&& frame_ptr) {
max_ordinal_ = 0;
frame_ptr_ = std::move(frame_ptr);
}
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
TableSmallArray* value)
: message_(bytes, byte_size, sizeof(TableSmallArray), nullptr, 0, 0) {
message_.Encode<TableSmallArray>(value);
}
UnownedEncodedMessage(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage(UnownedEncodedMessage&&) = delete;
UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(TableSmallArray* value)
: message_(bytes_.data(), bytes_.size(), value) {}
OwnedEncodedMessage(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage(OwnedEncodedMessage&&) = delete;
OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
private:
::fidl::internal::InlineMessageBuffer<40> bytes_;
UnownedEncodedMessage message_;
};
class DecodedMessage final : public ::fidl::internal::IncomingMessage {
public:
DecodedMessage(uint8_t* bytes, uint32_t byte_actual,
zx_handle_info_t* handles = nullptr,
uint32_t handle_actual = 0)
: ::fidl::internal::IncomingMessage(bytes, byte_actual, handles,
handle_actual) {
Decode<TableSmallArray>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<TableSmallArray>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
TableSmallArray* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<TableSmallArray*>(bytes());
}
// Release the ownership of the decoded message. That means that the handles
// won't be closed When the object is destroyed. After calling this method,
// the DecodedMessage object should not be used anymore.
void ReleasePrimaryObject() { ResetBytes(); }
};
// Frames are managed automatically by the FidlAllocator class.
// The only direct usage is when performance is key and a frame needs to be
// allocated outside a FidlAllocator. Once created, a frame can only be used
// for one single table.
class Frame final {
public:
Frame() = default;
// In its intended usage, Frame will be referenced by an ObjectView. If the
// ObjectView is assigned before a move or copy, then it will reference the
// old invalid object. Because this is unsafe, copies are disallowed and
// moves are only allowed by friend classes that operate safely.
Frame(const Frame&) = delete;
Frame& operator=(const Frame&) = delete;
private:
Frame(Frame&&) noexcept = default;
Frame& operator=(Frame&&) noexcept = default;
::fidl::Envelope<::fidl::Array<uint32_t, 2>> a_;
friend class TableSmallArray;
};
private:
uint64_t max_ordinal_ = 0;
::fidl::ObjectView<Frame> frame_ptr_;
};
extern "C" const fidl_type_t fidl_test_arrays_TableLargeArrayTable;
class TableLargeArray final {
public:
// Returns whether no field is set.
bool IsEmpty() const { return max_ordinal_ == 0; }
class Frame;
const ::fidl::Array<uint32_t, 100>& a() const {
ZX_ASSERT(has_a());
return *frame_ptr_->a_.data;
}
::fidl::Array<uint32_t, 100>& a() {
ZX_ASSERT(has_a());
return *frame_ptr_->a_.data;
}
bool has_a() const {
return max_ordinal_ >= 1 && frame_ptr_->a_.data != nullptr;
}
TableLargeArray& set_a(
::fidl::ObjectView<::fidl::Array<uint32_t, 100>> elem) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = elem;
max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1));
return *this;
}
TableLargeArray& set_a(std::nullptr_t) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = nullptr;
return *this;
}
template <typename... Args>
TableLargeArray& set_a(::fidl::AnyAllocator& allocator, Args&&... args) {
ZX_DEBUG_ASSERT(frame_ptr_ != nullptr);
frame_ptr_->a_.data = ::fidl::ObjectView<::fidl::Array<uint32_t, 100>>(
allocator, std::forward<Args>(args)...);
max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1));
return *this;
}
TableLargeArray() = default;
explicit TableLargeArray(::fidl::AnyAllocator& allocator)
: frame_ptr_(::fidl::ObjectView<Frame>(allocator)) {}
// This constructor allows a user controlled allocation (not using a
// FidlAllocator). It should only be used when performance is key. As soon as
// the frame is given to the table, it must not be used directly or for
// another table.
explicit TableLargeArray(::fidl::ObjectView<Frame>&& frame)
: frame_ptr_(std::move(frame)) {}
~TableLargeArray() = default;
TableLargeArray(const TableLargeArray& other) noexcept = default;
TableLargeArray& operator=(const TableLargeArray& other) noexcept = default;
TableLargeArray(TableLargeArray&& other) noexcept = default;
TableLargeArray& operator=(TableLargeArray&& other) noexcept = default;
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_TableLargeArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 16;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 416;
static constexpr bool HasPointer = true;
void Allocate(::fidl::AnyAllocator& allocator) {
max_ordinal_ = 0;
frame_ptr_ = ::fidl::ObjectView<Frame>(allocator);
}
void Init(::fidl::ObjectView<Frame>&& frame_ptr) {
max_ordinal_ = 0;
frame_ptr_ = std::move(frame_ptr);
}
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
TableLargeArray* value)
: message_(bytes, byte_size, sizeof(TableLargeArray), nullptr, 0, 0) {
message_.Encode<TableLargeArray>(value);
}
UnownedEncodedMessage(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage(UnownedEncodedMessage&&) = delete;
UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(TableLargeArray* value)
: message_(bytes_.data(), bytes_.size(), value) {}
OwnedEncodedMessage(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage(OwnedEncodedMessage&&) = delete;
OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
private:
::fidl::internal::InlineMessageBuffer<432> bytes_;
UnownedEncodedMessage message_;
};
class DecodedMessage final : public ::fidl::internal::IncomingMessage {
public:
DecodedMessage(uint8_t* bytes, uint32_t byte_actual,
zx_handle_info_t* handles = nullptr,
uint32_t handle_actual = 0)
: ::fidl::internal::IncomingMessage(bytes, byte_actual, handles,
handle_actual) {
Decode<TableLargeArray>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<TableLargeArray>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
TableLargeArray* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<TableLargeArray*>(bytes());
}
// Release the ownership of the decoded message. That means that the handles
// won't be closed When the object is destroyed. After calling this method,
// the DecodedMessage object should not be used anymore.
void ReleasePrimaryObject() { ResetBytes(); }
};
// Frames are managed automatically by the FidlAllocator class.
// The only direct usage is when performance is key and a frame needs to be
// allocated outside a FidlAllocator. Once created, a frame can only be used
// for one single table.
class Frame final {
public:
Frame() = default;
// In its intended usage, Frame will be referenced by an ObjectView. If the
// ObjectView is assigned before a move or copy, then it will reference the
// old invalid object. Because this is unsafe, copies are disallowed and
// moves are only allowed by friend classes that operate safely.
Frame(const Frame&) = delete;
Frame& operator=(const Frame&) = delete;
private:
Frame(Frame&&) noexcept = default;
Frame& operator=(Frame&&) noexcept = default;
::fidl::Envelope<::fidl::Array<uint32_t, 100>> a_;
friend class TableLargeArray;
};
private:
uint64_t max_ordinal_ = 0;
::fidl::ObjectView<Frame> frame_ptr_;
};
extern "C" const fidl_type_t fidl_test_arrays_StructSmallArrayTable;
struct StructSmallArray {
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_StructSmallArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 8;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 0;
static constexpr bool HasPointer = false;
::fidl::Array<uint32_t, 2> a = {};
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
StructSmallArray* value)
: message_(bytes, byte_size, sizeof(StructSmallArray), nullptr, 0, 0) {
message_.Encode<StructSmallArray>(value);
}
UnownedEncodedMessage(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage(UnownedEncodedMessage&&) = delete;
UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(StructSmallArray* value)
: message_(bytes_.data(), bytes_.size(), value) {}
OwnedEncodedMessage(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage(OwnedEncodedMessage&&) = delete;
OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
private:
::fidl::internal::InlineMessageBuffer<8> bytes_;
UnownedEncodedMessage message_;
};
class DecodedMessage final : public ::fidl::internal::IncomingMessage {
public:
DecodedMessage(uint8_t* bytes, uint32_t byte_actual,
zx_handle_info_t* handles = nullptr,
uint32_t handle_actual = 0)
: ::fidl::internal::IncomingMessage(bytes, byte_actual, handles,
handle_actual) {
Decode<struct StructSmallArray>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<struct StructSmallArray>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
struct StructSmallArray* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<struct StructSmallArray*>(bytes());
}
// Release the ownership of the decoded message. That means that the handles
// won't be closed When the object is destroyed. After calling this method,
// the DecodedMessage object should not be used anymore.
void ReleasePrimaryObject() { ResetBytes(); }
};
};
extern "C" const fidl_type_t fidl_test_arrays_StructLargeArrayTable;
struct StructLargeArray {
static constexpr const fidl_type_t* Type =
&fidl_test_arrays_StructLargeArrayTable;
static constexpr uint32_t MaxNumHandles = 0;
static constexpr uint32_t PrimarySize = 400;
[[maybe_unused]] static constexpr uint32_t MaxOutOfLine = 0;
static constexpr bool HasPointer = false;
::fidl::Array<uint32_t, 100> a = {};
class UnownedEncodedMessage final {
public:
UnownedEncodedMessage(uint8_t* bytes, uint32_t byte_size,
StructLargeArray* value)
: message_(bytes, byte_size, sizeof(StructLargeArray), nullptr, 0, 0) {
message_.Encode<StructLargeArray>(value);
}
UnownedEncodedMessage(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage(UnownedEncodedMessage&&) = delete;
UnownedEncodedMessage* operator=(const UnownedEncodedMessage&) = delete;
UnownedEncodedMessage* operator=(UnownedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.status() == ZX_OK; }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() { return message_; }
private:
::fidl::OutgoingMessage message_;
};
class OwnedEncodedMessage final {
public:
explicit OwnedEncodedMessage(StructLargeArray* value)
: message_(bytes_.data(), bytes_.size(), value) {}
OwnedEncodedMessage(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage(OwnedEncodedMessage&&) = delete;
OwnedEncodedMessage* operator=(const OwnedEncodedMessage&) = delete;
OwnedEncodedMessage* operator=(OwnedEncodedMessage&&) = delete;
zx_status_t status() const { return message_.status(); }
#ifdef __Fuchsia__
const char* status_string() const { return message_.status_string(); }
#endif // __Fuchsia__
bool ok() const { return message_.ok(); }
const char* error() const { return message_.error(); }
::fidl::OutgoingMessage& GetOutgoingMessage() {
return message_.GetOutgoingMessage();
}
private:
::fidl::internal::InlineMessageBuffer<400> bytes_;
UnownedEncodedMessage message_;
};
class DecodedMessage final : public ::fidl::internal::IncomingMessage {
public:
DecodedMessage(uint8_t* bytes, uint32_t byte_actual,
zx_handle_info_t* handles = nullptr,
uint32_t handle_actual = 0)
: ::fidl::internal::IncomingMessage(bytes, byte_actual, handles,
handle_actual) {
Decode<struct StructLargeArray>();
}
DecodedMessage(fidl_incoming_msg_t* msg)
: ::fidl::internal::IncomingMessage(msg) {
Decode<struct StructLargeArray>();
}
DecodedMessage(const DecodedMessage&) = delete;
DecodedMessage(DecodedMessage&&) = delete;
DecodedMessage* operator=(const DecodedMessage&) = delete;
DecodedMessage* operator=(DecodedMessage&&) = delete;
struct StructLargeArray* PrimaryObject() {
ZX_DEBUG_ASSERT(ok());
return reinterpret_cast<struct StructLargeArray*>(bytes());
}
// Release the ownership of the decoded message. That means that the handles
// won't be closed When the object is destroyed. After calling this method,
// the DecodedMessage object should not be used anymore.
void ReleasePrimaryObject() { ResetBytes(); }
};
};
} // namespace wire
} // namespace fidl_test_arrays
namespace fidl {
template <>
struct IsFidlType<::fidl_test_arrays::wire::UnionSmallArray>
: public std::true_type {};
template <>
struct IsUnion<::fidl_test_arrays::wire::UnionSmallArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::UnionSmallArray>);
template <>
struct IsFidlType<::fidl_test_arrays::wire::UnionLargeArray>
: public std::true_type {};
template <>
struct IsUnion<::fidl_test_arrays::wire::UnionLargeArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::UnionLargeArray>);
template <>
struct IsFidlType<::fidl_test_arrays::wire::TableSmallArray>
: public std::true_type {};
template <>
struct IsTable<::fidl_test_arrays::wire::TableSmallArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::TableSmallArray>);
template <>
struct IsFidlType<::fidl_test_arrays::wire::TableLargeArray>
: public std::true_type {};
template <>
struct IsTable<::fidl_test_arrays::wire::TableLargeArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::TableLargeArray>);
template <>
struct IsFidlType<::fidl_test_arrays::wire::StructSmallArray>
: public std::true_type {};
template <>
struct IsStruct<::fidl_test_arrays::wire::StructSmallArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::StructSmallArray>);
static_assert(offsetof(::fidl_test_arrays::wire::StructSmallArray, a) == 0);
static_assert(sizeof(::fidl_test_arrays::wire::StructSmallArray) ==
::fidl_test_arrays::wire::StructSmallArray::PrimarySize);
template <>
struct IsFidlType<::fidl_test_arrays::wire::StructLargeArray>
: public std::true_type {};
template <>
struct IsStruct<::fidl_test_arrays::wire::StructLargeArray>
: public std::true_type {};
static_assert(
std::is_standard_layout_v<::fidl_test_arrays::wire::StructLargeArray>);
static_assert(offsetof(::fidl_test_arrays::wire::StructLargeArray, a) == 0);
static_assert(sizeof(::fidl_test_arrays::wire::StructLargeArray) ==
::fidl_test_arrays::wire::StructLargeArray::PrimarySize);
} // namespace fidl