| // 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/buffer_allocator.h> |
| #include <lib/fidl/llcpp/buffer_then_heap_allocator.h> |
| #include <lib/fidl/llcpp/coding.h> |
| #include <lib/fidl/llcpp/envelope.h> |
| #include <lib/fidl/llcpp/errors.h> |
| #include <lib/fidl/llcpp/memory.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/tracking_ptr.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/txn_header.h> |
| |
| #endif // __Fuchsia__ |
| #include <zircon/fidl.h> |
| |
| namespace llcpp { |
| namespace fidl { |
| namespace test { |
| namespace arrays { |
| namespace wire { |
| class UnionSmallArray; |
| } // namespace wire |
| using UnionSmallArray = ::llcpp::fidl::test::arrays::wire::UnionSmallArray; |
| namespace wire { |
| class UnionLargeArray; |
| } // namespace wire |
| using UnionLargeArray = ::llcpp::fidl::test::arrays::wire::UnionLargeArray; |
| namespace wire { |
| class TableSmallArray; |
| |
| class TableLargeArray; |
| |
| struct StructSmallArray; |
| } // namespace wire |
| using StructSmallArray = ::llcpp::fidl::test::arrays::wire::StructSmallArray; |
| namespace wire { |
| struct StructLargeArray; |
| } // namespace wire |
| using StructLargeArray = ::llcpp::fidl::test::arrays::wire::StructLargeArray; |
| namespace wire { |
| |
| extern "C" const fidl_type_t fidl_test_arrays_UnionSmallArrayTable; |
| |
| class UnionSmallArray { |
| public: |
| UnionSmallArray() : ordinal_(Ordinal::Invalid), envelope_{} {} |
| |
| UnionSmallArray(UnionSmallArray&&) = default; |
| UnionSmallArray& operator=(UnionSmallArray&&) = default; |
| |
| ~UnionSmallArray() { reset_ptr(nullptr); } |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kA = 1, // 0x1 |
| }; |
| |
| bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; } |
| |
| bool is_a() const { return ordinal_ == Ordinal::kA; } |
| |
| static UnionSmallArray WithA( |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>&& val) { |
| UnionSmallArray result; |
| result.set_a(std::move(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; |
| } |
| template <typename... Args> |
| static UnionSmallArray WithA(::fidl::Allocator& allocator, Args&&... args) { |
| UnionSmallArray result; |
| result.set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>( |
| allocator, std::forward<Args>(args)...)); |
| return result; |
| } |
| |
| void set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>&& elem) { |
| ordinal_ = Ordinal::kA; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| template <typename... Args> |
| void set_a(::fidl::AnyAllocator& allocator, Args&&... args) { |
| ordinal_ = Ordinal::kA; |
| set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>>( |
| allocator, std::forward<Args>(args)...)); |
| } |
| template <typename... Args> |
| void set_a(::fidl::Allocator& allocator, Args&&... args) { |
| ordinal_ = Ordinal::kA; |
| set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>( |
| allocator, std::forward<Args>(args)...)); |
| } |
| |
| ::fidl::Array<uint32_t, 2>& mutable_a() { |
| ZX_ASSERT(ordinal_ == Ordinal::kA); |
| return *static_cast<::fidl::Array<uint32_t, 2>*>(envelope_.data.get()); |
| } |
| const ::fidl::Array<uint32_t, 2>& a() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kA); |
| return *static_cast<::fidl::Array<uint32_t, 2>*>(envelope_.data.get()); |
| } |
| Tag which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<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 |
| }; |
| |
| void reset_ptr(::fidl::tracking_ptr<void>&& new_ptr) { |
| // To clear the existing value, std::move it and let it go out of scope. |
| switch (static_cast<fidl_xunion_tag_t>(ordinal_)) { |
| case 1: { |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>> to_destroy = |
| static_cast<::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| } |
| |
| envelope_.data = std::move(new_ptr); |
| } |
| |
| static void SizeAndOffsetAssertionHelper(); |
| Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::Envelope<void> envelope_; |
| }; |
| |
| extern "C" const fidl_type_t fidl_test_arrays_UnionLargeArrayTable; |
| |
| class UnionLargeArray { |
| public: |
| UnionLargeArray() : ordinal_(Ordinal::Invalid), envelope_{} {} |
| |
| UnionLargeArray(UnionLargeArray&&) = default; |
| UnionLargeArray& operator=(UnionLargeArray&&) = default; |
| |
| ~UnionLargeArray() { reset_ptr(nullptr); } |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kA = 1, // 0x1 |
| }; |
| |
| bool has_invalid_tag() const { return ordinal_ == Ordinal::Invalid; } |
| |
| bool is_a() const { return ordinal_ == Ordinal::kA; } |
| |
| static UnionLargeArray WithA( |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>&& val) { |
| UnionLargeArray result; |
| result.set_a(std::move(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; |
| } |
| template <typename... Args> |
| static UnionLargeArray WithA(::fidl::Allocator& allocator, Args&&... args) { |
| UnionLargeArray result; |
| result.set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>( |
| allocator, std::forward<Args>(args)...)); |
| return result; |
| } |
| |
| void set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>&& elem) { |
| ordinal_ = Ordinal::kA; |
| reset_ptr(static_cast<::fidl::tracking_ptr<void>>(std::move(elem))); |
| } |
| |
| template <typename... Args> |
| void set_a(::fidl::AnyAllocator& allocator, Args&&... args) { |
| ordinal_ = Ordinal::kA; |
| set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 100>>( |
| allocator, std::forward<Args>(args)...)); |
| } |
| template <typename... Args> |
| void set_a(::fidl::Allocator& allocator, Args&&... args) { |
| ordinal_ = Ordinal::kA; |
| set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>( |
| allocator, std::forward<Args>(args)...)); |
| } |
| |
| ::fidl::Array<uint32_t, 100>& mutable_a() { |
| ZX_ASSERT(ordinal_ == Ordinal::kA); |
| return *static_cast<::fidl::Array<uint32_t, 100>*>(envelope_.data.get()); |
| } |
| const ::fidl::Array<uint32_t, 100>& a() const { |
| ZX_ASSERT(ordinal_ == Ordinal::kA); |
| return *static_cast<::fidl::Array<uint32_t, 100>*>(envelope_.data.get()); |
| } |
| Tag which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<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 |
| }; |
| |
| void reset_ptr(::fidl::tracking_ptr<void>&& new_ptr) { |
| // To clear the existing value, std::move it and let it go out of scope. |
| switch (static_cast<fidl_xunion_tag_t>(ordinal_)) { |
| case 1: { |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>> to_destroy = |
| static_cast<::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>>( |
| std::move(envelope_.data)); |
| break; |
| } |
| } |
| |
| envelope_.data = std::move(new_ptr); |
| } |
| |
| static void SizeAndOffsetAssertionHelper(); |
| 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; |
| } |
| void set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 2>> elem) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = elem; |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| void set_a(std::nullptr_t) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = nullptr; |
| } |
| template <typename... Args> |
| void set_a(::fidl::AnyAllocator& allocator, Args&&... args) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != 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)); |
| } |
| template <typename... Args> |
| void set_a(::fidl::Allocator& allocator, Args&&... args) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = ::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>>( |
| allocator, std::forward<Args>(args)...); |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| void set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>> elem) { |
| frame_ptr_->a_.data = std::move(elem); |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| |
| TableSmallArray() = default; |
| explicit TableSmallArray(::fidl::AnyAllocator& allocator) |
| : frame_ptr_(::fidl::ObjectView<Frame>(allocator)) {} |
| explicit TableSmallArray(::fidl::Allocator& allocator) |
| : frame_ptr_(::fidl::tracking_ptr<Frame>(allocator)) {} |
| explicit TableSmallArray(::fidl::tracking_ptr<Frame>&& frame_ptr) |
| : frame_ptr_(std::move(frame_ptr)) {} |
| ~TableSmallArray() = 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 Allocate(::fidl::Allocator& allocator) { |
| max_ordinal_ = 0; |
| frame_ptr_ = ::fidl::tracking_ptr<Frame>(allocator); |
| } |
| void Init(::fidl::tracking_ptr<Frame>&& frame_ptr) { |
| max_ordinal_ = 0; |
| frame_ptr_ = std::move(frame_ptr); |
| } |
| |
| private: |
| class UnownedEncodedByteMessage final { |
| public: |
| UnownedEncodedByteMessage(uint8_t* bytes, uint32_t byte_size, |
| TableSmallArray* value) |
| : message_(bytes, byte_size, sizeof(TableSmallArray), nullptr, 0, 0) { |
| message_.Encode<TableSmallArray>(value); |
| } |
| UnownedEncodedByteMessage(const UnownedEncodedByteMessage&) = delete; |
| UnownedEncodedByteMessage(UnownedEncodedByteMessage&&) = delete; |
| UnownedEncodedByteMessage* operator=(const UnownedEncodedByteMessage&) = |
| delete; |
| UnownedEncodedByteMessage* operator=(UnownedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingByteMessage message_; |
| }; |
| |
| class UnownedEncodedIovecMessage final { |
| public: |
| UnownedEncodedIovecMessage(zx_channel_iovec_t* iovecs, uint32_t iovec_size, |
| fidl_iovec_substitution_t* substitutions, |
| uint32_t substitutions_size, |
| TableSmallArray* value) |
| : message_(::fidl::OutgoingIovecMessage::constructor_args{ |
| .iovecs = iovecs, |
| .iovecs_actual = 0, |
| .iovecs_capacity = iovec_size, |
| .substitutions = substitutions, |
| .substitutions_actual = 0, |
| .substitutions_capacity = substitutions_size, |
| .handles = nullptr, |
| .handle_actual = 0, |
| .handle_capacity = 0, |
| }) { |
| message_.Encode<TableSmallArray>(value); |
| } |
| UnownedEncodedIovecMessage(const UnownedEncodedIovecMessage&) = delete; |
| UnownedEncodedIovecMessage(UnownedEncodedIovecMessage&&) = delete; |
| UnownedEncodedIovecMessage* operator=(const UnownedEncodedIovecMessage&) = |
| delete; |
| UnownedEncodedIovecMessage* operator=(UnownedEncodedIovecMessage&&) = |
| delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingIovecMessage message_; |
| }; |
| |
| class OwnedEncodedByteMessage final { |
| public: |
| explicit OwnedEncodedByteMessage(TableSmallArray* value) |
| : message_(bytes_, sizeof(bytes_), value) {} |
| OwnedEncodedByteMessage(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage(OwnedEncodedByteMessage&&) = delete; |
| OwnedEncodedByteMessage* operator=(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage* operator=(OwnedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[FIDL_ALIGN(PrimarySize + MaxOutOfLine)]; |
| UnownedEncodedByteMessage message_; |
| }; |
| |
| class OwnedEncodedIovecMessage final { |
| public: |
| explicit OwnedEncodedIovecMessage(TableSmallArray* value) |
| : message_(iovecs_, ::fidl::internal::kIovecBufferSize, substitutions_, |
| ::fidl::internal::kIovecBufferSize, value) {} |
| OwnedEncodedIovecMessage(const OwnedEncodedIovecMessage&) = delete; |
| OwnedEncodedIovecMessage(OwnedEncodedIovecMessage&&) = delete; |
| OwnedEncodedIovecMessage* operator=(const OwnedEncodedIovecMessage&) = |
| delete; |
| OwnedEncodedIovecMessage* operator=(OwnedEncodedIovecMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| zx_channel_iovec_t iovecs_[::fidl::internal::kIovecBufferSize]; |
| fidl_iovec_substitution_t |
| substitutions_[::fidl::internal::kIovecBufferSize]; |
| UnownedEncodedIovecMessage message_; |
| }; |
| |
| public: |
| friend ::fidl::internal::EncodedMessageTypes<TableSmallArray>; |
| using OwnedEncodedMessage = OwnedEncodedByteMessage; |
| using UnownedEncodedMessage = UnownedEncodedByteMessage; |
| |
| 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(); } |
| }; |
| |
| class Builder; |
| class UnownedBuilder; |
| |
| class Frame final { |
| public: |
| Frame() = default; |
| // In its intended usage, Frame will be referenced by a tracking_ptr. If the |
| // tracking_ptr 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; |
| friend class TableSmallArray::Builder; |
| friend class TableSmallArray::UnownedBuilder; |
| }; |
| |
| private: |
| TableSmallArray(uint64_t max_ordinal, ::fidl::tracking_ptr<Frame>&& frame_ptr) |
| : max_ordinal_(max_ordinal), frame_ptr_(std::move(frame_ptr)) {} |
| uint64_t max_ordinal_ = 0; |
| ::fidl::tracking_ptr<Frame> frame_ptr_; |
| }; |
| |
| // TableSmallArray::Builder builds TableSmallArray. |
| // Usage: |
| // TableSmallArray val = |
| // TableSmallArray::Builder(std::make_unique<TableSmallArray::Frame>()) |
| // .set_a(ptr) |
| // .build(); |
| class TableSmallArray::Builder final { |
| public: |
| ~Builder() = default; |
| Builder() = delete; |
| Builder(::fidl::tracking_ptr<TableSmallArray::Frame>&& frame_ptr) |
| : max_ordinal_(0), frame_ptr_(std::move(frame_ptr)) {} |
| |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| Builder(const Builder& other) = delete; |
| Builder& operator=(const Builder& other) = delete; |
| |
| // Returns whether no field is set. |
| bool IsEmpty() const { return max_ordinal_ == 0; } |
| |
| Builder&& set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>> elem) { |
| frame_ptr_->a_.data = std::move(elem); |
| if (max_ordinal_ < 1) { |
| // Note: the table size is not currently reduced if nullptr is set. |
| // This is possible to reconsider in the future. |
| max_ordinal_ = 1; |
| } |
| return std::move(*this); |
| } |
| 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 build() { |
| return TableSmallArray(max_ordinal_, std::move(frame_ptr_)); |
| } |
| |
| private: |
| uint64_t max_ordinal_ = 0; |
| ::fidl::tracking_ptr<TableSmallArray::Frame> frame_ptr_; |
| }; |
| |
| // UnownedBuilder acts like Builder but directly owns its Frame, simplifying |
| // working with unowned data. |
| class TableSmallArray::UnownedBuilder final { |
| public: |
| ~UnownedBuilder() = default; |
| UnownedBuilder() noexcept = default; |
| UnownedBuilder(UnownedBuilder&& other) noexcept = default; |
| UnownedBuilder& operator=(UnownedBuilder&& other) noexcept = default; |
| |
| // Returns whether no field is set. |
| bool IsEmpty() const { return max_ordinal_ == 0; } |
| |
| UnownedBuilder&& set_a( |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 2>> elem) { |
| ZX_ASSERT(elem); |
| frame_.a_.data = std::move(elem); |
| if (max_ordinal_ < 1) { |
| max_ordinal_ = 1; |
| } |
| return std::move(*this); |
| } |
| const ::fidl::Array<uint32_t, 2>& a() const { |
| ZX_ASSERT(has_a()); |
| return *frame_.a_.data; |
| } |
| ::fidl::Array<uint32_t, 2>& a() { |
| ZX_ASSERT(has_a()); |
| return *frame_.a_.data; |
| } |
| bool has_a() const { return max_ordinal_ >= 1 && frame_.a_.data != nullptr; } |
| |
| TableSmallArray build() { |
| return TableSmallArray(max_ordinal_, ::fidl::unowned_ptr(&frame_)); |
| } |
| |
| private: |
| uint64_t max_ordinal_ = 0; |
| TableSmallArray::Frame frame_; |
| }; |
| } // namespace wire |
| using TableSmallArray = ::llcpp::fidl::test::arrays::wire::TableSmallArray; |
| namespace wire { |
| |
| 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; |
| } |
| void set_a(::fidl::ObjectView<::fidl::Array<uint32_t, 100>> elem) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = elem; |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| void set_a(std::nullptr_t) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = nullptr; |
| } |
| template <typename... Args> |
| void set_a(::fidl::AnyAllocator& allocator, Args&&... args) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != 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)); |
| } |
| template <typename... Args> |
| void set_a(::fidl::Allocator& allocator, Args&&... args) { |
| ZX_DEBUG_ASSERT(frame_ptr_.get() != nullptr); |
| frame_ptr_->a_.data = ::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>>( |
| allocator, std::forward<Args>(args)...); |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| void set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>> elem) { |
| frame_ptr_->a_.data = std::move(elem); |
| max_ordinal_ = std::max(max_ordinal_, static_cast<uint64_t>(1)); |
| } |
| |
| TableLargeArray() = default; |
| explicit TableLargeArray(::fidl::AnyAllocator& allocator) |
| : frame_ptr_(::fidl::ObjectView<Frame>(allocator)) {} |
| explicit TableLargeArray(::fidl::Allocator& allocator) |
| : frame_ptr_(::fidl::tracking_ptr<Frame>(allocator)) {} |
| explicit TableLargeArray(::fidl::tracking_ptr<Frame>&& frame_ptr) |
| : frame_ptr_(std::move(frame_ptr)) {} |
| ~TableLargeArray() = 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 Allocate(::fidl::Allocator& allocator) { |
| max_ordinal_ = 0; |
| frame_ptr_ = ::fidl::tracking_ptr<Frame>(allocator); |
| } |
| void Init(::fidl::tracking_ptr<Frame>&& frame_ptr) { |
| max_ordinal_ = 0; |
| frame_ptr_ = std::move(frame_ptr); |
| } |
| |
| private: |
| class UnownedEncodedByteMessage final { |
| public: |
| UnownedEncodedByteMessage(uint8_t* bytes, uint32_t byte_size, |
| TableLargeArray* value) |
| : message_(bytes, byte_size, sizeof(TableLargeArray), nullptr, 0, 0) { |
| message_.Encode<TableLargeArray>(value); |
| } |
| UnownedEncodedByteMessage(const UnownedEncodedByteMessage&) = delete; |
| UnownedEncodedByteMessage(UnownedEncodedByteMessage&&) = delete; |
| UnownedEncodedByteMessage* operator=(const UnownedEncodedByteMessage&) = |
| delete; |
| UnownedEncodedByteMessage* operator=(UnownedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingByteMessage message_; |
| }; |
| |
| class UnownedEncodedIovecMessage final { |
| public: |
| UnownedEncodedIovecMessage(zx_channel_iovec_t* iovecs, uint32_t iovec_size, |
| fidl_iovec_substitution_t* substitutions, |
| uint32_t substitutions_size, |
| TableLargeArray* value) |
| : message_(::fidl::OutgoingIovecMessage::constructor_args{ |
| .iovecs = iovecs, |
| .iovecs_actual = 0, |
| .iovecs_capacity = iovec_size, |
| .substitutions = substitutions, |
| .substitutions_actual = 0, |
| .substitutions_capacity = substitutions_size, |
| .handles = nullptr, |
| .handle_actual = 0, |
| .handle_capacity = 0, |
| }) { |
| message_.Encode<TableLargeArray>(value); |
| } |
| UnownedEncodedIovecMessage(const UnownedEncodedIovecMessage&) = delete; |
| UnownedEncodedIovecMessage(UnownedEncodedIovecMessage&&) = delete; |
| UnownedEncodedIovecMessage* operator=(const UnownedEncodedIovecMessage&) = |
| delete; |
| UnownedEncodedIovecMessage* operator=(UnownedEncodedIovecMessage&&) = |
| delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingIovecMessage message_; |
| }; |
| |
| class OwnedEncodedByteMessage final { |
| public: |
| explicit OwnedEncodedByteMessage(TableLargeArray* value) |
| : message_(bytes_, sizeof(bytes_), value) {} |
| OwnedEncodedByteMessage(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage(OwnedEncodedByteMessage&&) = delete; |
| OwnedEncodedByteMessage* operator=(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage* operator=(OwnedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[FIDL_ALIGN(PrimarySize + MaxOutOfLine)]; |
| UnownedEncodedByteMessage message_; |
| }; |
| |
| class OwnedEncodedIovecMessage final { |
| public: |
| explicit OwnedEncodedIovecMessage(TableLargeArray* value) |
| : message_(iovecs_, ::fidl::internal::kIovecBufferSize, substitutions_, |
| ::fidl::internal::kIovecBufferSize, value) {} |
| OwnedEncodedIovecMessage(const OwnedEncodedIovecMessage&) = delete; |
| OwnedEncodedIovecMessage(OwnedEncodedIovecMessage&&) = delete; |
| OwnedEncodedIovecMessage* operator=(const OwnedEncodedIovecMessage&) = |
| delete; |
| OwnedEncodedIovecMessage* operator=(OwnedEncodedIovecMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| zx_channel_iovec_t iovecs_[::fidl::internal::kIovecBufferSize]; |
| fidl_iovec_substitution_t |
| substitutions_[::fidl::internal::kIovecBufferSize]; |
| UnownedEncodedIovecMessage message_; |
| }; |
| |
| public: |
| friend ::fidl::internal::EncodedMessageTypes<TableLargeArray>; |
| using OwnedEncodedMessage = OwnedEncodedByteMessage; |
| using UnownedEncodedMessage = UnownedEncodedByteMessage; |
| |
| 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(); } |
| }; |
| |
| class Builder; |
| class UnownedBuilder; |
| |
| class Frame final { |
| public: |
| Frame() = default; |
| // In its intended usage, Frame will be referenced by a tracking_ptr. If the |
| // tracking_ptr 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; |
| friend class TableLargeArray::Builder; |
| friend class TableLargeArray::UnownedBuilder; |
| }; |
| |
| private: |
| TableLargeArray(uint64_t max_ordinal, ::fidl::tracking_ptr<Frame>&& frame_ptr) |
| : max_ordinal_(max_ordinal), frame_ptr_(std::move(frame_ptr)) {} |
| uint64_t max_ordinal_ = 0; |
| ::fidl::tracking_ptr<Frame> frame_ptr_; |
| }; |
| |
| // TableLargeArray::Builder builds TableLargeArray. |
| // Usage: |
| // TableLargeArray val = |
| // TableLargeArray::Builder(std::make_unique<TableLargeArray::Frame>()) |
| // .set_a(ptr) |
| // .build(); |
| class TableLargeArray::Builder final { |
| public: |
| ~Builder() = default; |
| Builder() = delete; |
| Builder(::fidl::tracking_ptr<TableLargeArray::Frame>&& frame_ptr) |
| : max_ordinal_(0), frame_ptr_(std::move(frame_ptr)) {} |
| |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| Builder(const Builder& other) = delete; |
| Builder& operator=(const Builder& other) = delete; |
| |
| // Returns whether no field is set. |
| bool IsEmpty() const { return max_ordinal_ == 0; } |
| |
| Builder&& set_a(::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>> elem) { |
| frame_ptr_->a_.data = std::move(elem); |
| if (max_ordinal_ < 1) { |
| // Note: the table size is not currently reduced if nullptr is set. |
| // This is possible to reconsider in the future. |
| max_ordinal_ = 1; |
| } |
| return std::move(*this); |
| } |
| 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 build() { |
| return TableLargeArray(max_ordinal_, std::move(frame_ptr_)); |
| } |
| |
| private: |
| uint64_t max_ordinal_ = 0; |
| ::fidl::tracking_ptr<TableLargeArray::Frame> frame_ptr_; |
| }; |
| |
| // UnownedBuilder acts like Builder but directly owns its Frame, simplifying |
| // working with unowned data. |
| class TableLargeArray::UnownedBuilder final { |
| public: |
| ~UnownedBuilder() = default; |
| UnownedBuilder() noexcept = default; |
| UnownedBuilder(UnownedBuilder&& other) noexcept = default; |
| UnownedBuilder& operator=(UnownedBuilder&& other) noexcept = default; |
| |
| // Returns whether no field is set. |
| bool IsEmpty() const { return max_ordinal_ == 0; } |
| |
| UnownedBuilder&& set_a( |
| ::fidl::tracking_ptr<::fidl::Array<uint32_t, 100>> elem) { |
| ZX_ASSERT(elem); |
| frame_.a_.data = std::move(elem); |
| if (max_ordinal_ < 1) { |
| max_ordinal_ = 1; |
| } |
| return std::move(*this); |
| } |
| const ::fidl::Array<uint32_t, 100>& a() const { |
| ZX_ASSERT(has_a()); |
| return *frame_.a_.data; |
| } |
| ::fidl::Array<uint32_t, 100>& a() { |
| ZX_ASSERT(has_a()); |
| return *frame_.a_.data; |
| } |
| bool has_a() const { return max_ordinal_ >= 1 && frame_.a_.data != nullptr; } |
| |
| TableLargeArray build() { |
| return TableLargeArray(max_ordinal_, ::fidl::unowned_ptr(&frame_)); |
| } |
| |
| private: |
| uint64_t max_ordinal_ = 0; |
| TableLargeArray::Frame frame_; |
| }; |
| } // namespace wire |
| using TableLargeArray = ::llcpp::fidl::test::arrays::wire::TableLargeArray; |
| namespace wire { |
| |
| 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 = {}; |
| |
| private: |
| class UnownedEncodedByteMessage final { |
| public: |
| UnownedEncodedByteMessage(uint8_t* bytes, uint32_t byte_size, |
| StructSmallArray* value) |
| : message_(bytes, byte_size, sizeof(StructSmallArray), nullptr, 0, 0) { |
| message_.Encode<StructSmallArray>(value); |
| } |
| UnownedEncodedByteMessage(const UnownedEncodedByteMessage&) = delete; |
| UnownedEncodedByteMessage(UnownedEncodedByteMessage&&) = delete; |
| UnownedEncodedByteMessage* operator=(const UnownedEncodedByteMessage&) = |
| delete; |
| UnownedEncodedByteMessage* operator=(UnownedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingByteMessage message_; |
| }; |
| |
| class UnownedEncodedIovecMessage final { |
| public: |
| UnownedEncodedIovecMessage(zx_channel_iovec_t* iovecs, uint32_t iovec_size, |
| fidl_iovec_substitution_t* substitutions, |
| uint32_t substitutions_size, |
| StructSmallArray* value) |
| : message_(::fidl::OutgoingIovecMessage::constructor_args{ |
| .iovecs = iovecs, |
| .iovecs_actual = 0, |
| .iovecs_capacity = iovec_size, |
| .substitutions = substitutions, |
| .substitutions_actual = 0, |
| .substitutions_capacity = substitutions_size, |
| .handles = nullptr, |
| .handle_actual = 0, |
| .handle_capacity = 0, |
| }) { |
| message_.Encode<StructSmallArray>(value); |
| } |
| UnownedEncodedIovecMessage(const UnownedEncodedIovecMessage&) = delete; |
| UnownedEncodedIovecMessage(UnownedEncodedIovecMessage&&) = delete; |
| UnownedEncodedIovecMessage* operator=(const UnownedEncodedIovecMessage&) = |
| delete; |
| UnownedEncodedIovecMessage* operator=(UnownedEncodedIovecMessage&&) = |
| delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingIovecMessage message_; |
| }; |
| |
| class OwnedEncodedByteMessage final { |
| public: |
| explicit OwnedEncodedByteMessage(StructSmallArray* value) |
| : message_(bytes_, sizeof(bytes_), value) {} |
| OwnedEncodedByteMessage(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage(OwnedEncodedByteMessage&&) = delete; |
| OwnedEncodedByteMessage* operator=(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage* operator=(OwnedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[FIDL_ALIGN(PrimarySize + MaxOutOfLine)]; |
| UnownedEncodedByteMessage message_; |
| }; |
| |
| class OwnedEncodedIovecMessage final { |
| public: |
| explicit OwnedEncodedIovecMessage(StructSmallArray* value) |
| : message_(iovecs_, ::fidl::internal::kIovecBufferSize, substitutions_, |
| ::fidl::internal::kIovecBufferSize, value) {} |
| OwnedEncodedIovecMessage(const OwnedEncodedIovecMessage&) = delete; |
| OwnedEncodedIovecMessage(OwnedEncodedIovecMessage&&) = delete; |
| OwnedEncodedIovecMessage* operator=(const OwnedEncodedIovecMessage&) = |
| delete; |
| OwnedEncodedIovecMessage* operator=(OwnedEncodedIovecMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| zx_channel_iovec_t iovecs_[::fidl::internal::kIovecBufferSize]; |
| fidl_iovec_substitution_t |
| substitutions_[::fidl::internal::kIovecBufferSize]; |
| UnownedEncodedIovecMessage message_; |
| }; |
| |
| public: |
| friend ::fidl::internal::EncodedMessageTypes<StructSmallArray>; |
| using OwnedEncodedMessage = OwnedEncodedByteMessage; |
| using UnownedEncodedMessage = UnownedEncodedByteMessage; |
| |
| 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 = {}; |
| |
| private: |
| class UnownedEncodedByteMessage final { |
| public: |
| UnownedEncodedByteMessage(uint8_t* bytes, uint32_t byte_size, |
| StructLargeArray* value) |
| : message_(bytes, byte_size, sizeof(StructLargeArray), nullptr, 0, 0) { |
| message_.Encode<StructLargeArray>(value); |
| } |
| UnownedEncodedByteMessage(const UnownedEncodedByteMessage&) = delete; |
| UnownedEncodedByteMessage(UnownedEncodedByteMessage&&) = delete; |
| UnownedEncodedByteMessage* operator=(const UnownedEncodedByteMessage&) = |
| delete; |
| UnownedEncodedByteMessage* operator=(UnownedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingByteMessage message_; |
| }; |
| |
| class UnownedEncodedIovecMessage final { |
| public: |
| UnownedEncodedIovecMessage(zx_channel_iovec_t* iovecs, uint32_t iovec_size, |
| fidl_iovec_substitution_t* substitutions, |
| uint32_t substitutions_size, |
| StructLargeArray* value) |
| : message_(::fidl::OutgoingIovecMessage::constructor_args{ |
| .iovecs = iovecs, |
| .iovecs_actual = 0, |
| .iovecs_capacity = iovec_size, |
| .substitutions = substitutions, |
| .substitutions_actual = 0, |
| .substitutions_capacity = substitutions_size, |
| .handles = nullptr, |
| .handle_actual = 0, |
| .handle_capacity = 0, |
| }) { |
| message_.Encode<StructLargeArray>(value); |
| } |
| UnownedEncodedIovecMessage(const UnownedEncodedIovecMessage&) = delete; |
| UnownedEncodedIovecMessage(UnownedEncodedIovecMessage&&) = delete; |
| UnownedEncodedIovecMessage* operator=(const UnownedEncodedIovecMessage&) = |
| delete; |
| UnownedEncodedIovecMessage* operator=(UnownedEncodedIovecMessage&&) = |
| delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.status() == ZX_OK; } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { return message_; } |
| |
| private: |
| ::fidl::OutgoingIovecMessage message_; |
| }; |
| |
| class OwnedEncodedByteMessage final { |
| public: |
| explicit OwnedEncodedByteMessage(StructLargeArray* value) |
| : message_(bytes_, sizeof(bytes_), value) {} |
| OwnedEncodedByteMessage(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage(OwnedEncodedByteMessage&&) = delete; |
| OwnedEncodedByteMessage* operator=(const OwnedEncodedByteMessage&) = delete; |
| OwnedEncodedByteMessage* operator=(OwnedEncodedByteMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingByteMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| FIDL_ALIGNDECL |
| uint8_t bytes_[FIDL_ALIGN(PrimarySize + MaxOutOfLine)]; |
| UnownedEncodedByteMessage message_; |
| }; |
| |
| class OwnedEncodedIovecMessage final { |
| public: |
| explicit OwnedEncodedIovecMessage(StructLargeArray* value) |
| : message_(iovecs_, ::fidl::internal::kIovecBufferSize, substitutions_, |
| ::fidl::internal::kIovecBufferSize, value) {} |
| OwnedEncodedIovecMessage(const OwnedEncodedIovecMessage&) = delete; |
| OwnedEncodedIovecMessage(OwnedEncodedIovecMessage&&) = delete; |
| OwnedEncodedIovecMessage* operator=(const OwnedEncodedIovecMessage&) = |
| delete; |
| OwnedEncodedIovecMessage* operator=(OwnedEncodedIovecMessage&&) = delete; |
| |
| zx_status_t status() const { return message_.status(); } |
| #ifdef __Fuchsia__ |
| const char* status_string() const { return message_.status_string(); } |
| #endif |
| bool ok() const { return message_.ok(); } |
| const char* error() const { return message_.error(); } |
| |
| ::fidl::OutgoingIovecMessage& GetOutgoingMessage() { |
| return message_.GetOutgoingMessage(); |
| } |
| |
| private: |
| zx_channel_iovec_t iovecs_[::fidl::internal::kIovecBufferSize]; |
| fidl_iovec_substitution_t |
| substitutions_[::fidl::internal::kIovecBufferSize]; |
| UnownedEncodedIovecMessage message_; |
| }; |
| |
| public: |
| friend ::fidl::internal::EncodedMessageTypes<StructLargeArray>; |
| using OwnedEncodedMessage = OwnedEncodedByteMessage; |
| using UnownedEncodedMessage = UnownedEncodedByteMessage; |
| |
| 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 arrays |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::UnionSmallArray> |
| : public std::true_type {}; |
| template <> |
| struct IsUnion<::llcpp::fidl::test::arrays::wire::UnionSmallArray> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::UnionSmallArray>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::UnionLargeArray> |
| : public std::true_type {}; |
| template <> |
| struct IsUnion<::llcpp::fidl::test::arrays::wire::UnionLargeArray> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::UnionLargeArray>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::TableSmallArray> |
| : public std::true_type {}; |
| template <> |
| struct IsTable<::llcpp::fidl::test::arrays::wire::TableSmallArray> |
| : public std::true_type {}; |
| template <> |
| struct IsTableBuilder< |
| ::llcpp::fidl::test::arrays::wire::TableSmallArray::Builder> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::TableSmallArray>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::TableLargeArray> |
| : public std::true_type {}; |
| template <> |
| struct IsTable<::llcpp::fidl::test::arrays::wire::TableLargeArray> |
| : public std::true_type {}; |
| template <> |
| struct IsTableBuilder< |
| ::llcpp::fidl::test::arrays::wire::TableLargeArray::Builder> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::TableLargeArray>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::StructSmallArray> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::llcpp::fidl::test::arrays::wire::StructSmallArray> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::StructSmallArray>); |
| static_assert(offsetof(::llcpp::fidl::test::arrays::wire::StructSmallArray, |
| a) == 0); |
| static_assert(sizeof(::llcpp::fidl::test::arrays::wire::StructSmallArray) == |
| ::llcpp::fidl::test::arrays::wire::StructSmallArray::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::fidl::test::arrays::wire::StructLargeArray> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::llcpp::fidl::test::arrays::wire::StructLargeArray> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::llcpp::fidl::test::arrays::wire::StructLargeArray>); |
| static_assert(offsetof(::llcpp::fidl::test::arrays::wire::StructLargeArray, |
| a) == 0); |
| static_assert(sizeof(::llcpp::fidl::test::arrays::wire::StructLargeArray) == |
| ::llcpp::fidl::test::arrays::wire::StructLargeArray::PrimarySize); |
| } // namespace fidl |
| namespace llcpp { |
| namespace fidl { |
| namespace test { |
| namespace arrays { |
| namespace wire {} // namespace wire |
| } // namespace arrays |
| } // namespace test |
| } // namespace fidl |
| } // namespace llcpp |