| // 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> |
| |
| #endif // __Fuchsia__ |
| |
| #include <fidl/test.errorsyntax.parent/cpp/wire_types.h> |
| #include <fidl/test.errorsyntax/cpp/common_types.h> |
| #include <fidl/test.errorsyntax/cpp/markers.h> |
| |
| namespace test_errorsyntax { |
| namespace wire { |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse; |
| |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse; |
| |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResult; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| |
| class ExampleUseOfErrorSyntaxCallWhichMayFailResult { |
| public: |
| using Response = |
| test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse; |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult() |
| : ordinal_(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal:: |
| Invalid), |
| envelope_{} {} |
| |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResult&) = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& operator=( |
| const ExampleUseOfErrorSyntaxCallWhichMayFailResult&) = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult&&) = default; |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult& operator=( |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult&&) = default; |
| |
| enum class Tag : fidl_xunion_tag_t { |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| bool has_invalid_tag() const { |
| return ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::Invalid; |
| } |
| |
| bool is_response() const { |
| return ordinal_ == ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult:: |
| Ordinal::kResponse; |
| } |
| |
| static ExampleUseOfErrorSyntaxCallWhichMayFailResult WithResponse( |
| ::fidl::ObjectView<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse> |
| val) { |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult result; |
| result.ordinal_ = ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kResponse; |
| result.envelope_ |
| .As<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>() |
| .set_data(std::move(val)); |
| return result; |
| } |
| |
| template <typename... Args> |
| static ExampleUseOfErrorSyntaxCallWhichMayFailResult WithResponse( |
| ::fidl::AnyArena& allocator, Args&&... args) { |
| return WithResponse( |
| ::fidl::ObjectView<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>( |
| allocator, std::forward<Args>(args)...)); |
| } |
| |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse& |
| response() { |
| ZX_ASSERT( |
| ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kResponse); |
| return envelope_ |
| .As<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>() |
| .get_data(); |
| } |
| const ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse& |
| response() const { |
| ZX_ASSERT( |
| ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kResponse); |
| return envelope_ |
| .As<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>() |
| .get_data(); |
| } |
| |
| bool is_err() const { |
| return ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kErr; |
| } |
| |
| static ExampleUseOfErrorSyntaxCallWhichMayFailResult WithErr(uint32_t val) { |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult result; |
| result.ordinal_ = ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kErr; |
| result.envelope_.As<uint32_t>().set_data(std::move(val)); |
| return result; |
| } |
| |
| uint32_t& err() { |
| ZX_ASSERT(ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kErr); |
| return envelope_.As<uint32_t>().get_data(); |
| } |
| const uint32_t& err() const { |
| ZX_ASSERT(ordinal_ == |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Ordinal::kErr); |
| return envelope_.As<uint32_t>().get_data(); |
| } |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag |
| Which() const { |
| ZX_ASSERT(!has_invalid_tag()); |
| return static_cast<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult::Tag>( |
| ordinal_); |
| } |
| |
| private: |
| enum class Ordinal : fidl_xunion_tag_t { |
| Invalid = 0, |
| kResponse = 1, // 0x1 |
| kErr = 2, // 0x2 |
| }; |
| |
| static void SizeAndOffsetAssertionHelper(); |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult:: |
| Ordinal ordinal_; |
| FIDL_ALIGNDECL |
| ::fidl::UntypedEnvelope envelope_; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse { |
| int64_t value = {}; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailTopResponseTable; |
| |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse { |
| using Result = |
| test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult; |
| |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult |
| result = {}; |
| }; |
| |
| extern "C" const fidl_type_t |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestTable; |
| |
| struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest { |
| ::fidl::StringView s = {}; |
| }; |
| |
| } // namespace wire |
| } // namespace test_errorsyntax |
| namespace fidl { |
| |
| template <> |
| struct TypeTraits< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> { |
| static constexpr const fidl_type_t* kType = |
| &::test_errorsyntax::wire:: |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| 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_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>); |
| static_assert(offsetof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse, |
| value) == 0); |
| static_assert( |
| sizeof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse) == |
| TypeTraits< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResponse>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse> { |
| static constexpr const fidl_type_t* kType = |
| &::test_errorsyntax::wire:: |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailTopResponseTable; |
| 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 = 8; |
| static constexpr uint32_t kMaxOutOfLineV1 = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct<::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse>); |
| static_assert(offsetof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse, |
| result) == 0); |
| static_assert( |
| sizeof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse) == |
| TypeTraits< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailTopResponse>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> { |
| static constexpr const fidl_type_t* kType = |
| &::test_errorsyntax::wire:: |
| test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestTable; |
| 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_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> |
| : public std::true_type {}; |
| template <> |
| struct IsStruct< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest>); |
| static_assert(offsetof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest, |
| s) == 0); |
| static_assert( |
| sizeof(::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest) == |
| TypeTraits< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailRequest>::kPrimarySize); |
| |
| template <> |
| struct TypeTraits< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult> { |
| static constexpr const fidl_type_t* kType = |
| &::test_errorsyntax::wire:: |
| test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| 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 = 8; |
| static constexpr uint32_t kMaxOutOfLineV1 = 8; |
| static constexpr bool kHasPointer = true; |
| }; |
| |
| template <> |
| struct IsFidlType< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult> |
| : public std::true_type {}; |
| template <> |
| struct IsUnion< |
| ::test_errorsyntax::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResult> |
| : public std::true_type {}; |
| static_assert(std::is_standard_layout_v< |
| ::test_errorsyntax::wire:: |
| ExampleUseOfErrorSyntaxCallWhichMayFailResult>); |
| |
| } // namespace fidl |