| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <fidl/test.handlesintypes/cpp/common_types.h> |
| #include <fidl/test.handlesintypes/cpp/markers.h> |
| #include <lib/fidl/cpp/natural_coding_traits.h> |
| #include <lib/fidl/cpp/natural_types.h> |
| |
| #include <cinttypes> |
| #include <string> |
| |
| #ifdef __Fuchsia__ |
| |
| #include <lib/zx/vmo.h> |
| |
| #endif // __Fuchsia__ |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wshadow" |
| |
| namespace test_handlesintypes { |
| |
| class HandlesInTypes; |
| |
| class EmptyResourceStruct; |
| |
| class TableWithHandle; |
| |
| class EmptyResourceTable; |
| |
| class UnionWithHandle; |
| |
| class EmptyResourceUnion; |
| |
| #ifdef __Fuchsia__ |
| |
| class TableWithHandle { |
| private: |
| struct Storage_; |
| |
| public: |
| TableWithHandle(Storage_ storage) noexcept; |
| TableWithHandle() noexcept = default; |
| TableWithHandle(TableWithHandle&&) noexcept = default; |
| TableWithHandle& operator=(TableWithHandle&&) noexcept = default; |
| |
| bool IsEmpty() const { |
| return !(storage_.h.has_value()); |
| } |
| |
| const std::optional<::zx::vmo>& h() const { return storage_.h; } |
| ::std::optional<::zx::vmo>& h() { return storage_.h; } |
| |
| // Setter for h. |
| // |
| |
| TableWithHandle& h(std::optional<::zx::vmo> value); |
| |
| TableWithHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| ::std::optional<::zx::vmo> h; |
| }; |
| |
| // TODO(https://fxbug.dev/42172795): Box the storage. |
| Storage_ storage_; |
| friend struct ::fidl::internal::NaturalTableCodingTraits<::test_handlesintypes::TableWithHandle>; |
| friend struct ::fidl::internal::MemberVisitor<::test_handlesintypes::TableWithHandle>; |
| static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalTableMember<Storage_, ::zx::vmo, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>{ |
| 1, &Storage_::h}); |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class UnionWithHandle { |
| private: |
| using Storage_ = |
| std::variant< |
| std::monostate, ::zx::vmo>; |
| |
| public: |
| // TODO: share union tag types between wire & natural. |
| enum class Tag : fidl_xunion_tag_t { |
| kH = 1, // 0x1 |
| _do_not_handle_this__write_a_default_case_instead = ::std::numeric_limits<::fidl_union_tag_t>::max(), |
| }; |
| |
| UnionWithHandle(UnionWithHandle&& other) noexcept |
| : UnionWithHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}) { |
| *storage_ = std::move(*other.storage_); |
| } |
| UnionWithHandle& operator=(UnionWithHandle&& other) noexcept { |
| if (this != &other) { |
| *storage_ = std::move(*other.storage_); |
| } |
| return *this; |
| } |
| constexpr bool IsUnknown() const { |
| return Which() == ::test_handlesintypes::UnionWithHandle::Tag::_do_not_handle_this__write_a_default_case_instead; |
| } |
| |
| constexpr ::test_handlesintypes::UnionWithHandle::Tag Which() const { |
| return UnionWithHandle::IndexToTag(storage_->index()).value(); |
| } |
| static UnionWithHandle WithH(::zx::vmo val) { |
| return UnionWithHandle(std::make_shared<Storage_>( |
| std::in_place_index_t<1>{}, |
| std::move(val))); |
| } |
| |
| const ::fidl::internal::UnionMemberView<1, Storage_> h() const { |
| return ::fidl::internal::UnionMemberView<1, Storage_>(storage_); |
| } |
| |
| ::fidl::internal::UnionMemberView<1, Storage_> h() { |
| return ::fidl::internal::UnionMemberView<1, Storage_>(storage_); |
| } |
| |
| // Sets the union to hold the h member. |
| // |
| |
| UnionWithHandle& h(::zx::vmo value) { |
| storage_->emplace<1>(std::move(value)); |
| return *this; |
| } |
| |
| UnionWithHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : storage_(std::make_shared<Storage_>()) {} |
| |
| private: |
| std::shared_ptr<Storage_> storage_; |
| friend struct ::fidl::internal::NaturalUnionCodingTraits<::test_handlesintypes::UnionWithHandle>; |
| static constexpr auto kMembers = std::make_tuple( |
| ::fidl::internal::NaturalUnionMember<::fidl::internal::NaturalCodingConstraintEmpty>(), ::fidl::internal::NaturalUnionMember<fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>()); |
| |
| explicit UnionWithHandle(std::shared_ptr<Storage_> storage) : storage_(std::move(storage)) {} |
| |
| static constexpr size_t TagToIndex(::fidl::internal::NaturalDecoder* decoder, ::test_handlesintypes::UnionWithHandle::Tag tag) { |
| switch (tag) { |
| case ::test_handlesintypes::UnionWithHandle::Tag::kH: |
| return 1; |
| default: { |
| return 0; |
| } |
| } |
| } |
| |
| static constexpr std::optional<::test_handlesintypes::UnionWithHandle::Tag> IndexToTag(size_t index) { |
| switch (index) { |
| case 1: |
| return ::test_handlesintypes::UnionWithHandle::Tag::kH; |
| default: |
| return ::test_handlesintypes::UnionWithHandle::Tag::_do_not_handle_this__write_a_default_case_instead; |
| } |
| } |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class HandlesInTypes { |
| private: |
| struct Storage_; |
| |
| public: |
| HandlesInTypes(Storage_ storage) noexcept; |
| HandlesInTypes(::zx::vmo normal_handle, ::std::vector<::zx::vmo> handle_in_vec, ::std::array<::zx::vmo, 5> handle_in_array, ::std::vector<::std::array<::zx::vmo, 5>> handle_in_mixed_vec_array, ::test_handlesintypes::TableWithHandle table_with_handle, ::test_handlesintypes::UnionWithHandle union_with_handle) noexcept; |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |HandlesInTypes| only if all of its members are default constructible. |
| HandlesInTypes() = default; |
| #pragma clang diagnostic pop |
| |
| HandlesInTypes(HandlesInTypes&&) noexcept = default; |
| HandlesInTypes& operator=(HandlesInTypes&&) noexcept = default; |
| |
| const ::zx::vmo& |
| normal_handle() const { |
| return storage_.normal_handle; |
| } |
| |
| ::zx::vmo& normal_handle() { |
| return storage_.normal_handle; |
| } |
| |
| // Setter for normal_handle. |
| // |
| |
| HandlesInTypes& normal_handle(::zx::vmo value); |
| |
| const ::std::vector<::zx::vmo>& |
| handle_in_vec() const { |
| return storage_.handle_in_vec; |
| } |
| |
| ::std::vector<::zx::vmo>& handle_in_vec() { |
| return storage_.handle_in_vec; |
| } |
| |
| // Setter for handle_in_vec. |
| // |
| |
| HandlesInTypes& handle_in_vec(::std::vector<::zx::vmo> value); |
| |
| const ::std::array<::zx::vmo, 5>& |
| handle_in_array() const { |
| return storage_.handle_in_array; |
| } |
| |
| ::std::array<::zx::vmo, 5>& handle_in_array() { |
| return storage_.handle_in_array; |
| } |
| |
| // Setter for handle_in_array. |
| // |
| |
| HandlesInTypes& handle_in_array(::std::array<::zx::vmo, 5> value); |
| |
| const ::std::vector<::std::array<::zx::vmo, 5>>& |
| handle_in_mixed_vec_array() const { |
| return storage_.handle_in_mixed_vec_array; |
| } |
| |
| ::std::vector<::std::array<::zx::vmo, 5>>& handle_in_mixed_vec_array() { |
| return storage_.handle_in_mixed_vec_array; |
| } |
| |
| // Setter for handle_in_mixed_vec_array. |
| // |
| |
| HandlesInTypes& handle_in_mixed_vec_array(::std::vector<::std::array<::zx::vmo, 5>> value); |
| |
| const ::test_handlesintypes::TableWithHandle& |
| table_with_handle() const { |
| return storage_.table_with_handle; |
| } |
| |
| ::test_handlesintypes::TableWithHandle& table_with_handle() { |
| return storage_.table_with_handle; |
| } |
| |
| // Setter for table_with_handle. |
| // |
| |
| HandlesInTypes& table_with_handle(::test_handlesintypes::TableWithHandle value); |
| |
| const ::test_handlesintypes::UnionWithHandle& |
| union_with_handle() const { |
| return storage_.union_with_handle; |
| } |
| |
| ::test_handlesintypes::UnionWithHandle& union_with_handle() { |
| return storage_.union_with_handle; |
| } |
| |
| // Setter for union_with_handle. |
| // |
| |
| HandlesInTypes& union_with_handle(::test_handlesintypes::UnionWithHandle value); |
| |
| HandlesInTypes(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| ::zx::vmo normal_handle; |
| ::std::vector<::zx::vmo> handle_in_vec; |
| ::std::array<::zx::vmo, 5> handle_in_array; |
| ::std::vector<::std::array<::zx::vmo, 5>> handle_in_mixed_vec_array; |
| ::test_handlesintypes::TableWithHandle table_with_handle; |
| ::test_handlesintypes::UnionWithHandle union_with_handle; |
| }; |
| |
| Storage_ storage_; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits<::test_handlesintypes::HandlesInTypes, 96>; |
| friend struct ::fidl::internal::MemberVisitor<::test_handlesintypes::HandlesInTypes>; |
| static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, ::zx::vmo, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>{ |
| &Storage_::normal_handle, 0}, |
| ::fidl::internal::NaturalStructMember<Storage_, ::std::vector<::zx::vmo>, fidl::internal::NaturalCodingConstraintVector<fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>>{&Storage_::handle_in_vec, 8}, ::fidl::internal::NaturalStructMember<Storage_, ::std::array<::zx::vmo, 5>, fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>{&Storage_::handle_in_array, 24}, ::fidl::internal::NaturalStructMember<Storage_, ::std::vector<::std::array<::zx::vmo, 5>>, fidl::internal::NaturalCodingConstraintVector<fidl::internal::NaturalCodingConstraintHandle<ZX_OBJ_TYPE_VMO, 0x80000000, false>>>{&Storage_::handle_in_mixed_vec_array, 48}, ::fidl::internal::NaturalStructMember<Storage_, ::test_handlesintypes::TableWithHandle, fidl::internal::NaturalCodingConstraintEmpty>{&Storage_::table_with_handle, 64}, ::fidl::internal::NaturalStructMember<Storage_, ::test_handlesintypes::UnionWithHandle, fidl::internal::NaturalCodingConstraintEmpty>{&Storage_::union_with_handle, 80}); |
| static constexpr auto kPadding = std::make_tuple(::fidl::internal::NaturalStructPadding<uint64_t>{ |
| .offset = 0, |
| .mask = 0xffffffff00000000, |
| }, |
| ::fidl::internal::NaturalStructPadding<uint64_t>{ |
| .offset = 40, |
| .mask = 0xffffffff00000000, |
| }); |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class EmptyResourceStruct { |
| private: |
| struct Storage_; |
| |
| public: |
| EmptyResourceStruct(Storage_ storage) noexcept; |
| EmptyResourceStruct(uint8_t __reserved) noexcept; |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" |
| // Default constructs a |EmptyResourceStruct| only if all of its members are default constructible. |
| EmptyResourceStruct() = default; |
| #pragma clang diagnostic pop |
| |
| EmptyResourceStruct(EmptyResourceStruct&&) noexcept = default; |
| EmptyResourceStruct& operator=(EmptyResourceStruct&&) noexcept = default; |
| |
| uint8_t |
| __reserved() const { |
| return storage_.__reserved; |
| } |
| |
| uint8_t& __reserved() { |
| return storage_.__reserved; |
| } |
| |
| // Setter for __reserved. |
| // |
| |
| EmptyResourceStruct& __reserved(uint8_t value); |
| |
| EmptyResourceStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| uint8_t __reserved = 0u; |
| }; |
| |
| Storage_ storage_; |
| |
| friend struct ::fidl::internal::NaturalStructCodingTraits<::test_handlesintypes::EmptyResourceStruct, 1>; |
| friend struct ::fidl::internal::MemberVisitor<::test_handlesintypes::EmptyResourceStruct>; |
| static constexpr auto kMembers = std::make_tuple(::fidl::internal::NaturalStructMember<Storage_, uint8_t, fidl::internal::NaturalCodingConstraintEmpty>{ |
| &Storage_::__reserved, 0}); |
| static constexpr auto kPadding = std::make_tuple(); |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class EmptyResourceTable { |
| private: |
| struct Storage_; |
| |
| public: |
| EmptyResourceTable(Storage_ storage) noexcept; |
| EmptyResourceTable() noexcept = default; |
| EmptyResourceTable(EmptyResourceTable&&) noexcept = default; |
| EmptyResourceTable& operator=(EmptyResourceTable&&) noexcept = default; |
| |
| bool IsEmpty() const { |
| return true; |
| } |
| |
| EmptyResourceTable(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag); |
| |
| private: |
| struct Storage_ final { |
| }; |
| |
| // TODO(https://fxbug.dev/42172795): Box the storage. |
| Storage_ storage_; |
| friend struct ::fidl::internal::NaturalTableCodingTraits<::test_handlesintypes::EmptyResourceTable>; |
| friend struct ::fidl::internal::MemberVisitor<::test_handlesintypes::EmptyResourceTable>; |
| static constexpr auto kMembers = std::make_tuple(); |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class EmptyResourceUnion { |
| private: |
| using Storage_ = |
| std::variant< |
| std::monostate>; |
| |
| public: |
| // TODO: share union tag types between wire & natural. |
| enum class Tag : fidl_xunion_tag_t { |
| _do_not_handle_this__write_a_default_case_instead = ::std::numeric_limits<::fidl_union_tag_t>::max(), |
| }; |
| |
| EmptyResourceUnion(EmptyResourceUnion&& other) noexcept |
| : EmptyResourceUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}) { |
| *storage_ = std::move(*other.storage_); |
| } |
| EmptyResourceUnion& operator=(EmptyResourceUnion&& other) noexcept { |
| if (this != &other) { |
| *storage_ = std::move(*other.storage_); |
| } |
| return *this; |
| } |
| constexpr bool IsUnknown() const { |
| return Which() == ::test_handlesintypes::EmptyResourceUnion::Tag::_do_not_handle_this__write_a_default_case_instead; |
| } |
| |
| constexpr ::test_handlesintypes::EmptyResourceUnion::Tag Which() const { |
| return EmptyResourceUnion::IndexToTag(storage_->index()).value(); |
| } |
| |
| EmptyResourceUnion(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) |
| : storage_(std::make_shared<Storage_>()) {} |
| |
| private: |
| std::shared_ptr<Storage_> storage_; |
| friend struct ::fidl::internal::NaturalUnionCodingTraits<::test_handlesintypes::EmptyResourceUnion>; |
| static constexpr auto kMembers = std::make_tuple( |
| ::fidl::internal::NaturalUnionMember<::fidl::internal::NaturalCodingConstraintEmpty>()); |
| |
| explicit EmptyResourceUnion(std::shared_ptr<Storage_> storage) : storage_(std::move(storage)) {} |
| |
| static constexpr size_t TagToIndex(::fidl::internal::NaturalDecoder* decoder, ::test_handlesintypes::EmptyResourceUnion::Tag tag) { |
| switch (tag) { |
| default: { |
| return 0; |
| } |
| } |
| } |
| |
| static constexpr std::optional<::test_handlesintypes::EmptyResourceUnion::Tag> IndexToTag(size_t index) { |
| switch (index) { |
| default: |
| return ::test_handlesintypes::EmptyResourceUnion::Tag::_do_not_handle_this__write_a_default_case_instead; |
| } |
| } |
| }; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| inline TableWithHandle::TableWithHandle(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| |
| inline TableWithHandle::TableWithHandle(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : TableWithHandle(Storage_{}) {} |
| inline TableWithHandle& TableWithHandle::h(std::optional<::zx::vmo> value) { |
| storage_.h = std::move(value); |
| return *this; |
| } |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| inline HandlesInTypes::HandlesInTypes(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline HandlesInTypes::HandlesInTypes(::zx::vmo normal_handle, ::std::vector<::zx::vmo> handle_in_vec, ::std::array<::zx::vmo, 5> handle_in_array, ::std::vector<::std::array<::zx::vmo, 5>> handle_in_mixed_vec_array, ::test_handlesintypes::TableWithHandle table_with_handle, ::test_handlesintypes::UnionWithHandle union_with_handle) noexcept |
| : storage_({.normal_handle = std::move(normal_handle), |
| .handle_in_vec = std::move(handle_in_vec), |
| .handle_in_array = std::move(handle_in_array), |
| .handle_in_mixed_vec_array = std::move(handle_in_mixed_vec_array), |
| .table_with_handle = std::move(table_with_handle), |
| .union_with_handle = std::move(union_with_handle)}) {} |
| |
| inline HandlesInTypes::HandlesInTypes(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : HandlesInTypes(Storage_{ |
| .normal_handle = {}, |
| .handle_in_vec = {}, |
| .handle_in_array = ::fidl::internal::DefaultConstructPossiblyInvalidObject<::std::array<::zx::vmo, 5>>::Make(), |
| .handle_in_mixed_vec_array = {}, |
| .table_with_handle = ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}, |
| .union_with_handle = ::fidl::internal::DefaultConstructPossiblyInvalidObjectTag{}, |
| }) {} |
| inline HandlesInTypes& HandlesInTypes::normal_handle(::zx::vmo value) { |
| storage_.normal_handle = std::move(value); |
| return *this; |
| } |
| inline HandlesInTypes& HandlesInTypes::handle_in_vec(::std::vector<::zx::vmo> value) { |
| storage_.handle_in_vec = std::move(value); |
| return *this; |
| } |
| inline HandlesInTypes& HandlesInTypes::handle_in_array(::std::array<::zx::vmo, 5> value) { |
| storage_.handle_in_array = std::move(value); |
| return *this; |
| } |
| inline HandlesInTypes& HandlesInTypes::handle_in_mixed_vec_array(::std::vector<::std::array<::zx::vmo, 5>> value) { |
| storage_.handle_in_mixed_vec_array = std::move(value); |
| return *this; |
| } |
| inline HandlesInTypes& HandlesInTypes::table_with_handle(::test_handlesintypes::TableWithHandle value) { |
| storage_.table_with_handle = std::move(value); |
| return *this; |
| } |
| inline HandlesInTypes& HandlesInTypes::union_with_handle(::test_handlesintypes::UnionWithHandle value) { |
| storage_.union_with_handle = std::move(value); |
| return *this; |
| } |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| inline EmptyResourceStruct::EmptyResourceStruct(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| inline EmptyResourceStruct::EmptyResourceStruct(uint8_t __reserved) noexcept |
| : storage_({.__reserved = std::move(__reserved)}) {} |
| |
| inline EmptyResourceStruct::EmptyResourceStruct(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : EmptyResourceStruct(Storage_{ |
| .__reserved = 0u, |
| }) {} |
| inline EmptyResourceStruct& EmptyResourceStruct::__reserved(uint8_t value) { |
| storage_.__reserved = std::move(value); |
| return *this; |
| } |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| inline EmptyResourceTable::EmptyResourceTable(Storage_ storage) noexcept : storage_(std::move(storage)) {} |
| |
| inline EmptyResourceTable::EmptyResourceTable(::fidl::internal::DefaultConstructPossiblyInvalidObjectTag) : EmptyResourceTable(Storage_{}) {} |
| |
| #endif // __Fuchsia__ |
| |
| } // namespace test_handlesintypes |
| namespace fidl { |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::HandlesInTypes> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::HandlesInTypes> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::HandlesInTypes> { |
| static constexpr uint32_t kMaxNumHandles = 4294967295; |
| static constexpr uint32_t kMaxDepth = 2; |
| static constexpr uint32_t kPrimarySize = 96; |
| static constexpr uint32_t kMaxOutOfLine = 4294967295; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsStruct<::test_handlesintypes::HandlesInTypes> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::HandlesInTypes, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalStructCodingTraits<::test_handlesintypes::HandlesInTypes, 96> {}; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::EmptyResourceStruct> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::EmptyResourceStruct> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::EmptyResourceStruct> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 0; |
| static constexpr uint32_t kPrimarySize = 1; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsStruct<::test_handlesintypes::EmptyResourceStruct> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::EmptyResourceStruct, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalEmptyStructCodingTraits<::test_handlesintypes::EmptyResourceStruct> {}; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::TableWithHandle> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::TableWithHandle> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::TableWithHandle> { |
| static constexpr uint32_t kMaxNumHandles = 1; |
| static constexpr uint32_t kMaxDepth = 2; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsTable<::test_handlesintypes::TableWithHandle> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::TableWithHandle, ::fidl::internal::NaturalCodingConstraintEmpty> : public ::fidl::internal::NaturalTableCodingTraits<::test_handlesintypes::TableWithHandle> {}; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::EmptyResourceTable> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::EmptyResourceTable> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::EmptyResourceTable> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 1; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsTable<::test_handlesintypes::EmptyResourceTable> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::EmptyResourceTable, ::fidl::internal::NaturalCodingConstraintEmpty> : public ::fidl::internal::NaturalTableCodingTraits<::test_handlesintypes::EmptyResourceTable> {}; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::UnionWithHandle> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::UnionWithHandle> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::UnionWithHandle> { |
| static constexpr uint32_t kMaxNumHandles = 1; |
| static constexpr uint32_t kMaxDepth = 1; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsUnion<::test_handlesintypes::UnionWithHandle> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::UnionWithHandle, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalUnionCodingTraits<::test_handlesintypes::UnionWithHandle> {}; |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct IsResource<::test_handlesintypes::EmptyResourceUnion> : public std::true_type {}; |
| template <> |
| struct IsFidlType<::test_handlesintypes::EmptyResourceUnion> : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_handlesintypes::EmptyResourceUnion> { |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kMaxDepth = 0; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsUnion<::test_handlesintypes::EmptyResourceUnion> : public std::true_type {}; |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::EmptyResourceUnion, ::fidl::internal::NaturalCodingConstraintEmpty> final |
| : public ::fidl::internal::NaturalUnionCodingTraits<::test_handlesintypes::EmptyResourceUnion> {}; |
| |
| #endif // __Fuchsia__ |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_handlesintypes::ObjType, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint32_t); |
| static constexpr bool kIsMemcpyCompatible = false; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_handlesintypes::ObjType* value, size_t offset, size_t recursion_depth) { |
| switch (*value) { |
| case ::test_handlesintypes::ObjType::kNone: |
| case ::test_handlesintypes::ObjType::kVmo: |
| break; |
| default: |
| encoder->SetError(::fidl::internal::kCodingErrorUnknownEnumValue); |
| return; |
| } |
| *encoder->template GetPtr<::test_handlesintypes::ObjType>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_handlesintypes::ObjType* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_handlesintypes::ObjType>(offset); |
| switch (*value) { |
| case ::test_handlesintypes::ObjType::kNone: |
| case ::test_handlesintypes::ObjType::kVmo: |
| break; |
| default: |
| decoder->SetError(::fidl::internal::kCodingErrorUnknownEnumValue); |
| return; |
| } |
| } |
| }; |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace fidl |