| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <lib/fidl/llcpp/array.h> |
| #include <lib/fidl/llcpp/coding.h> |
| #include <lib/fidl/llcpp/envelope.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/wire_types.h> |
| #include <lib/stdcompat/optional.h> |
| |
| #include <cinttypes> |
| #ifdef __Fuchsia__ |
| #include <lib/zx/channel.h> |
| #include <lib/zx/vmo.h> |
| |
| #endif // __Fuchsia__ |
| |
| #include <fidl/test.nullable/cpp/common_types.h> |
| #include <fidl/test.nullable/cpp/markers.h> |
| |
| namespace test_nullable { |
| namespace wire { |
| struct StructWithNullableVector; |
| |
| struct StructWithNullableUnion; |
| |
| struct StructWithNullableStruct; |
| |
| struct StructWithNullableString; |
| |
| struct StructWithNullableRequest; |
| |
| struct StructWithNullableProtocol; |
| |
| struct StructWithNullableHandle; |
| |
| struct SimpleProtocolAddTopResponse; |
| |
| struct SimpleProtocolAddRequest; |
| |
| struct Int32Wrapper; |
| |
| class SimpleUnion; |
| |
| #ifdef __Fuchsia__ |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableRequestTable; |
| |
| struct StructWithNullableRequest { |
| ::fidl::ServerEnd<::test_nullable::SimpleProtocol> val = {}; |
| |
| void _CloseHandles(); |
| }; |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableProtocolTable; |
| |
| struct StructWithNullableProtocol { |
| ::fidl::ClientEnd<::test_nullable::SimpleProtocol> val = {}; |
| |
| void _CloseHandles(); |
| }; |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableHandleTable; |
| |
| struct StructWithNullableHandle { |
| ::zx::vmo val = {}; |
| |
| void _CloseHandles(); |
| }; |
| #endif // __Fuchsia__ |
| |
| extern "C" const fidl_type_t test_nullable_SimpleProtocolAddTopResponseTable; |
| |
| struct SimpleProtocolAddTopResponse { |
| int32_t sum = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_Int32WrapperTable; |
| |
| struct Int32Wrapper { |
| int32_t val = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_SimpleUnionTable; |
| |
| class SimpleUnion { |
| public: |
| SimpleUnion() |
| : ordinal_(::test_nullable::wire::SimpleUnion::Ordinal::Invalid), |
| envelope_{} {} |
| |
| SimpleUnion(const SimpleUnion&) = default; |
| SimpleUnion& operator=(const SimpleUnion&) = default; |
| SimpleUnion(SimpleUnion&&) = default; |
| SimpleUnion& operator=(SimpleUnion&&) = default; |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kA = 1, // 0x1 |
| kB = 2, // 0x2 |
| }; |
| |
| bool has_invalid_tag() const { |
| return ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::Invalid; |
| } |
| |
| bool is_a() const { |
| return ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kA; |
| } |
| |
| static SimpleUnion WithA(int32_t val) { |
| SimpleUnion result; |
| result.ordinal_ = ::test_nullable::wire::SimpleUnion::Ordinal::kA; |
| result.envelope_.As<int32_t>().set_data(std::move(val)); |
| return result; |
| } |
| |
| int32_t& a() { |
| ZX_ASSERT(ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kA); |
| return envelope_.As<int32_t>().get_data(); |
| } |
| const int32_t& a() const { |
| ZX_ASSERT(ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kA); |
| return envelope_.As<int32_t>().get_data(); |
| } |
| |
| bool is_b() const { |
| return ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kB; |
| } |
| |
| static SimpleUnion WithB(float val) { |
| SimpleUnion result; |
| result.ordinal_ = ::test_nullable::wire::SimpleUnion::Ordinal::kB; |
| result.envelope_.As<float>().set_data(std::move(val)); |
| return result; |
| } |
| |
| float& b() { |
| ZX_ASSERT(ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kB); |
| return envelope_.As<float>().get_data(); |
| } |
| const float& b() const { |
| ZX_ASSERT(ordinal_ == ::test_nullable::wire::SimpleUnion::Ordinal::kB); |
| return envelope_.As<float>().get_data(); |
| } |
| ::test_nullable::wire::SimpleUnion::Tag Which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<::test_nullable::wire::SimpleUnion::Tag>(ordinal_); |
| } |
| |
| private: |
| enum class Ordinal : fidl_xunion_tag_t { |
| Invalid = 0, |
| kA = 1, // 0x1 |
| kB = 2, // 0x2 |
| }; |
| |
| static void SizeAndOffsetAssertionHelper(); |
| ::test_nullable::wire::SimpleUnion::Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::UntypedEnvelope envelope_; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableVectorTable; |
| |
| struct StructWithNullableVector { |
| ::fidl::VectorView<int32_t> val = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableUnionTable; |
| |
| struct StructWithNullableUnion { |
| ::test_nullable::wire::SimpleUnion val = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableStructTable; |
| |
| struct StructWithNullableStruct { |
| ::fidl::ObjectView<::test_nullable::wire::Int32Wrapper> val = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_StructWithNullableStringTable; |
| |
| struct StructWithNullableString { |
| ::fidl::StringView val = {}; |
| }; |
| |
| extern "C" const fidl_type_t test_nullable_SimpleProtocolAddRequestTable; |
| |
| struct SimpleProtocolAddRequest { |
| int32_t a = {}; |
| |
| int32_t b = {}; |
| }; |
| |
| } // namespace wire |
| } // namespace test_nullable |
| namespace fidl { |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableVector> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableVectorTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kPrimarySizeV1 = 16; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 4294967295; |
| static constexpr uint32_t kMaxOutOfLineV1 = 4294967295; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableVector> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableVector> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::StructWithNullableVector>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableVector, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableVector) == |
| TypeTraits<::test_nullable::wire::StructWithNullableVector>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableUnion> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableUnionTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kPrimarySizeV1 = 24; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableUnion> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableUnion> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::StructWithNullableUnion>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableUnion, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableUnion) == |
| TypeTraits<::test_nullable::wire::StructWithNullableUnion>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableStruct> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableStructTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 8; |
| static constexpr uint32_t kPrimarySizeV1 = 8; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 8; |
| static constexpr uint32_t kMaxOutOfLineV1 = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableStruct> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableStruct> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::StructWithNullableStruct>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableStruct, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableStruct) == |
| TypeTraits<::test_nullable::wire::StructWithNullableStruct>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableString> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableStringTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kPrimarySizeV1 = 16; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 4294967295; |
| static constexpr uint32_t kMaxOutOfLineV1 = 4294967295; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableString> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableString> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::StructWithNullableString>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableString, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableString) == |
| TypeTraits<::test_nullable::wire::StructWithNullableString>::kPrimarySize); |
| |
| #ifdef __Fuchsia__ |
| template <> |
| struct IsResource<::test_nullable::wire::StructWithNullableRequest> |
| : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableRequest> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableRequestTable; |
| static constexpr uint32_t kMaxNumHandles = 1; |
| static constexpr uint32_t kPrimarySize = 4; |
| static constexpr uint32_t kPrimarySizeV1 = 4; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableRequest> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_nullable::wire::StructWithNullableRequest>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableRequest, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableRequest) == |
| TypeTraits<::test_nullable::wire::StructWithNullableRequest>::kPrimarySize); |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| template <> |
| struct IsResource<::test_nullable::wire::StructWithNullableProtocol> |
| : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableProtocol> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableProtocolTable; |
| static constexpr uint32_t kMaxNumHandles = 1; |
| static constexpr uint32_t kPrimarySize = 4; |
| static constexpr uint32_t kPrimarySizeV1 = 4; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableProtocol> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableProtocol> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_nullable::wire::StructWithNullableProtocol>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableProtocol, |
| val) == 0); |
| static_assert(sizeof(::test_nullable::wire::StructWithNullableProtocol) == |
| TypeTraits<::test_nullable::wire::StructWithNullableProtocol>:: |
| kPrimarySize); |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| template <> |
| struct IsResource<::test_nullable::wire::StructWithNullableHandle> |
| : public std::true_type {}; |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::StructWithNullableHandle> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_StructWithNullableHandleTable; |
| static constexpr uint32_t kMaxNumHandles = 1; |
| static constexpr uint32_t kPrimarySize = 4; |
| static constexpr uint32_t kPrimarySizeV1 = 4; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::StructWithNullableHandle> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::StructWithNullableHandle> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::StructWithNullableHandle>); |
| static_assert(offsetof(::test_nullable::wire::StructWithNullableHandle, val) == |
| 0); |
| static_assert( |
| sizeof(::test_nullable::wire::StructWithNullableHandle) == |
| TypeTraits<::test_nullable::wire::StructWithNullableHandle>::kPrimarySize); |
| #endif // __Fuchsia__ |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::SimpleProtocolAddTopResponse> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_SimpleProtocolAddTopResponseTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 4; |
| static constexpr uint32_t kPrimarySizeV1 = 4; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::SimpleProtocolAddTopResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::SimpleProtocolAddTopResponse> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_nullable::wire::SimpleProtocolAddTopResponse>); |
| static_assert(offsetof(::test_nullable::wire::SimpleProtocolAddTopResponse, |
| sum) == 0); |
| static_assert(sizeof(::test_nullable::wire::SimpleProtocolAddTopResponse) == |
| TypeTraits<::test_nullable::wire::SimpleProtocolAddTopResponse>:: |
| kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::SimpleProtocolAddRequest> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_SimpleProtocolAddRequestTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 8; |
| static constexpr uint32_t kPrimarySizeV1 = 8; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::SimpleProtocolAddRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_nullable::wire::SimpleProtocolAddRequest> |
| : public std::true_type {}; |
| static_assert( |
| std::is_standard_layout_v<::test_nullable::wire::SimpleProtocolAddRequest>); |
| static_assert(offsetof(::test_nullable::wire::SimpleProtocolAddRequest, a) == |
| 0); |
| static_assert(offsetof(::test_nullable::wire::SimpleProtocolAddRequest, b) == |
| 4); |
| static_assert( |
| sizeof(::test_nullable::wire::SimpleProtocolAddRequest) == |
| TypeTraits<::test_nullable::wire::SimpleProtocolAddRequest>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::Int32Wrapper> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_Int32WrapperTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 4; |
| static constexpr uint32_t kPrimarySizeV1 = 4; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 0; |
| static constexpr bool kHasPointer = false; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::Int32Wrapper> : public std::true_type { |
| }; |
| template <> |
| struct IsStruct<::test_nullable::wire::Int32Wrapper> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::test_nullable::wire::Int32Wrapper>); |
| static_assert(offsetof(::test_nullable::wire::Int32Wrapper, val) == 0); |
| static_assert(sizeof(::test_nullable::wire::Int32Wrapper) == |
| TypeTraits<::test_nullable::wire::Int32Wrapper>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_nullable::wire::SimpleUnion> { |
| static constexpr const fidl_type_t* kType = |
| &::test_nullable::wire::test_nullable_SimpleUnionTable; |
| static constexpr uint32_t kMaxNumHandles = 0; |
| static constexpr uint32_t kPrimarySize = 16; |
| static constexpr uint32_t kPrimarySizeV1 = 24; |
| [[maybe_unused]] static constexpr uint32_t kMaxOutOfLine = 0; |
| static constexpr uint32_t kMaxOutOfLineV1 = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_nullable::wire::SimpleUnion> : public std::true_type { |
| }; |
| template <> |
| struct IsUnion<::test_nullable::wire::SimpleUnion> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::test_nullable::wire::SimpleUnion>); |
| |
| } // namespace fidl |