| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <exampleusing/cpp/fidl.h> |
| |
| #include "lib/fidl/cpp/internal/header.h" |
| |
| namespace example { |
| |
| #ifdef __Fuchsia__ |
| |
| class ExampleProtocol; |
| using ExampleProtocolPtr = ::fidl::InterfacePtr<ExampleProtocol>; |
| class ExampleProtocol_Proxy; |
| class ExampleProtocol_Stub; |
| class ExampleProtocol_EventSender; |
| class ExampleProtocol_Sync; |
| using ExampleProtocolSyncPtr = ::fidl::SynchronousInterfacePtr<ExampleProtocol>; |
| class ExampleProtocol_SyncProxy; |
| using ExampleProtocolHandle = ::fidl::InterfaceHandle<ExampleProtocol>; |
| namespace internal { |
| constexpr uint64_t kExampleProtocol_Method_Ordinal = 0x1b489f95492fd90elu; |
| |
| } // namespace internal |
| #endif // __Fuchsia__ |
| class ExampleXUnion; |
| class ExampleUnion; |
| class ExampleTable; |
| class ExampleStruct; |
| |
| enum class ExampleEnum : uint32_t { |
| |
| MEMBER = 1u, |
| }; |
| |
| inline zx_status_t Clone(::example::ExampleEnum value, |
| ::example::ExampleEnum* result) { |
| *result = value; |
| return ZX_OK; |
| } |
| |
| enum class ExampleBits : uint32_t { |
| |
| MEMBER = 1u, |
| }; |
| |
| const static ExampleBits ExampleBitsMask = static_cast<ExampleBits>(1u); |
| |
| constexpr inline ::example::ExampleBits operator|(::example::ExampleBits _lhs, |
| ::example::ExampleBits _rhs) { |
| return static_cast<::example::ExampleBits>(static_cast<uint32_t>(_lhs) | |
| static_cast<uint32_t>(_rhs)); |
| } |
| |
| constexpr inline ::example::ExampleBits& operator|=( |
| ::example::ExampleBits& _lhs, ::example::ExampleBits _rhs) { |
| _lhs = _lhs | _rhs; |
| return _lhs; |
| } |
| |
| constexpr inline ::example::ExampleBits operator&(::example::ExampleBits _lhs, |
| ::example::ExampleBits _rhs) { |
| return static_cast<::example::ExampleBits>(static_cast<uint32_t>(_lhs) & |
| static_cast<uint32_t>(_rhs)); |
| } |
| |
| constexpr inline ::example::ExampleBits& operator&=( |
| ::example::ExampleBits& _lhs, ::example::ExampleBits _rhs) { |
| _lhs = _lhs & _rhs; |
| return _lhs; |
| } |
| |
| constexpr inline ::example::ExampleBits operator^(::example::ExampleBits _lhs, |
| ::example::ExampleBits _rhs) { |
| return static_cast<::example::ExampleBits>(static_cast<uint32_t>(_lhs) ^ |
| static_cast<uint32_t>(_rhs)); |
| } |
| |
| constexpr inline ::example::ExampleBits& operator^=( |
| ::example::ExampleBits& _lhs, ::example::ExampleBits _rhs) { |
| _lhs = _lhs ^ _rhs; |
| return _lhs; |
| } |
| |
| constexpr inline ::example::ExampleBits operator~( |
| ::example::ExampleBits _value) { |
| return static_cast<::example::ExampleBits>( |
| ~static_cast<uint32_t>(_value) & static_cast<uint32_t>(ExampleBitsMask)); |
| } |
| |
| inline zx_status_t Clone(::example::ExampleBits value, |
| ::example::ExampleBits* result) { |
| *result = value; |
| return ZX_OK; |
| } |
| #ifdef __Fuchsia__ |
| |
| class ExampleProtocol { |
| public: |
| using Proxy_ = ExampleProtocol_Proxy; |
| using Stub_ = ExampleProtocol_Stub; |
| using EventSender_ = ExampleProtocol_EventSender; |
| using Sync_ = ExampleProtocol_Sync; |
| virtual ~ExampleProtocol(); |
| |
| virtual void Method(::exampleusing::Empty arg) = 0; |
| }; |
| |
| class ExampleProtocol_RequestDecoder { |
| public: |
| ExampleProtocol_RequestDecoder() = default; |
| virtual ~ExampleProtocol_RequestDecoder() = default; |
| static const fidl_type_t* GetType(uint64_t ordinal, bool* out_needs_response); |
| zx_status_t Decode_(::fidl::Message request) { |
| bool needs_response; |
| const fidl_type_t* request_type = |
| GetType(request.ordinal(), &needs_response); |
| if (request_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = request.Decode(request_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(request, request_type, error_msg); |
| return status; |
| } |
| ::fidl::Decoder request_decoder(std::move(request)); |
| switch (request.ordinal()) { |
| case internal::kExampleProtocol_Method_Ordinal: { |
| Method(::fidl::DecodeAs<::exampleusing::Empty>(&request_decoder, 16)); |
| break; |
| } |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| virtual void Method(::exampleusing::Empty arg) = 0; |
| }; |
| |
| class ExampleProtocol_RequestEncoder { |
| public: |
| static ::fidl::Message Method(::fidl::Encoder* _encoder, |
| ::exampleusing::Empty* arg) { |
| fidl_trace(WillHLCPPEncode); |
| _encoder->Alloc(24 - sizeof(fidl_message_header_t)); |
| ::fidl::Encode(_encoder, arg, 16); |
| |
| bool needs_response; // unused |
| fidl_trace(DidHLCPPEncode, |
| ExampleProtocol_RequestDecoder::GetType( |
| internal::kExampleProtocol_Method_Ordinal, &needs_response), |
| _encoder->GetPtr<const char>(0), _encoder->CurrentLength(), |
| _encoder->CurrentHandleCount()); |
| |
| return _encoder->GetMessage(); |
| } |
| }; |
| |
| class ExampleProtocol_ResponseDecoder { |
| public: |
| ExampleProtocol_ResponseDecoder() = default; |
| virtual ~ExampleProtocol_ResponseDecoder() = default; |
| static const fidl_type_t* GetType(uint64_t ordinal); |
| zx_status_t Decode_(::fidl::Message response) { |
| const fidl_type_t* response_type = GetType(response.ordinal()); |
| if (response_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = response.Decode(response_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(response, response_type, error_msg); |
| return status; |
| } |
| ::fidl::Decoder response_decoder(std::move(response)); |
| switch (response.ordinal()) { |
| default: { |
| break; |
| } |
| } |
| return ZX_OK; |
| } |
| }; |
| |
| class ExampleProtocol_ResponseEncoder { |
| public: |
| }; |
| |
| class ExampleProtocol_EventSender { |
| public: |
| virtual ~ExampleProtocol_EventSender(); |
| }; |
| |
| class ExampleProtocol_Sync { |
| public: |
| using Proxy_ = ExampleProtocol_SyncProxy; |
| virtual ~ExampleProtocol_Sync(); |
| virtual zx_status_t Method(::exampleusing::Empty arg) = 0; |
| }; |
| |
| class ExampleProtocol_Proxy final : public ::fidl::internal::Proxy, |
| public ExampleProtocol { |
| public: |
| explicit ExampleProtocol_Proxy(::fidl::internal::ProxyController* controller); |
| ~ExampleProtocol_Proxy() override; |
| |
| zx_status_t Dispatch_(::fidl::Message message) override; |
| void Method(::exampleusing::Empty arg) override; |
| |
| private: |
| ExampleProtocol_Proxy(const ExampleProtocol_Proxy&) = delete; |
| ExampleProtocol_Proxy& operator=(const ExampleProtocol_Proxy&) = delete; |
| |
| ::fidl::internal::ProxyController* controller_; |
| }; |
| |
| class ExampleProtocol_Stub final : public ::fidl::internal::Stub, |
| public ExampleProtocol_EventSender { |
| public: |
| typedef class ::example::ExampleProtocol ExampleProtocol_clazz; |
| explicit ExampleProtocol_Stub(ExampleProtocol_clazz* impl); |
| ~ExampleProtocol_Stub() override; |
| |
| zx_status_t Dispatch_(::fidl::Message message, |
| ::fidl::internal::PendingResponse response) override; |
| |
| private: |
| ExampleProtocol_clazz* impl_; |
| }; |
| |
| class ExampleProtocol_SyncProxy : public ExampleProtocol_Sync { |
| public: |
| explicit ExampleProtocol_SyncProxy(::zx::channel channel); |
| ~ExampleProtocol_SyncProxy() override; |
| zx_status_t Method(::exampleusing::Empty arg) override; |
| |
| private: |
| ::fidl::internal::SynchronousProxy proxy_; |
| friend class ::fidl::SynchronousInterfacePtr<ExampleProtocol>; |
| }; |
| #endif // __Fuchsia__ |
| |
| class ExampleXUnion final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| ExampleXUnion(); |
| ~ExampleXUnion(); |
| |
| ExampleXUnion(ExampleXUnion&&); |
| ExampleXUnion& operator=(ExampleXUnion&&); |
| |
| static ExampleXUnion WithVariant(uint32_t&&); |
| |
| enum __attribute__((enum_extensibility(closed))) Tag : fidl_xunion_tag_t { |
| kUnknown = 0, |
| Empty = kUnknown, // DEPRECATED: use kUnknown instead. |
| |
| kVariant = 1, // 0x1 |
| Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(), |
| }; |
| |
| static inline ::std::unique_ptr<ExampleXUnion> New() { |
| return ::std::make_unique<ExampleXUnion>(); |
| } |
| |
| void Encode(::fidl::Encoder* encoder, size_t offset); |
| static void Decode(::fidl::Decoder* decoder, ExampleXUnion* value, |
| size_t offset); |
| zx_status_t Clone(ExampleXUnion* result) const; |
| |
| bool has_invalid_tag() const { return tag_ == Invalid; } |
| |
| bool is_variant() const { return tag_ == Tag::kVariant; } |
| |
| uint32_t& variant() { |
| EnsureStorageInitialized(Tag::kVariant); |
| return variant_; |
| } |
| |
| const uint32_t& variant() const { |
| ZX_ASSERT(is_variant()); |
| return variant_; |
| } |
| ExampleXUnion& set_variant(uint32_t value); |
| ExampleXUnion& _experimental_set_unknown_data(fidl_xunion_tag_t ordinal, |
| std::vector<uint8_t> bytes); |
| |
| Tag Which() const { |
| switch (tag_) { |
| case Tag::Invalid: |
| case Tag::kVariant: |
| return Tag(tag_); |
| default: |
| return Tag::kUnknown; |
| } |
| } |
| |
| // You probably want to use Which() method instead of Ordinal(). Use Ordinal() |
| // only when you need access to the raw integral ordinal value. |
| fidl_xunion_tag_t Ordinal() const { return tag_; } |
| const std::vector<uint8_t>* UnknownBytes() const { |
| if (Which() != Tag::kUnknown) { |
| return nullptr; |
| } |
| return &unknown_data_.bytes; |
| } |
| |
| friend ::fidl::Equality<::example::ExampleXUnion>; |
| |
| private: |
| void Destroy(); |
| void EnsureStorageInitialized(::fidl_xunion_tag_t tag); |
| |
| ::fidl_xunion_tag_t tag_ = static_cast<fidl_xunion_tag_t>(Tag::Invalid); |
| union { |
| uint32_t variant_; |
| ::fidl::UnknownBytes unknown_data_; |
| }; |
| }; |
| |
| inline zx_status_t Clone(const ::example::ExampleXUnion& value, |
| ::example::ExampleXUnion* result) { |
| return value.Clone(result); |
| } |
| |
| using ExampleXUnionPtr = ::std::unique_ptr<ExampleXUnion>; |
| |
| class ExampleUnion final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| ExampleUnion(); |
| ~ExampleUnion(); |
| |
| ExampleUnion(ExampleUnion&&); |
| ExampleUnion& operator=(ExampleUnion&&); |
| |
| static ExampleUnion WithVariant(uint32_t&&); |
| |
| enum __attribute__((enum_extensibility(closed))) Tag : fidl_xunion_tag_t { |
| |
| kVariant = 1, // 0x1 |
| Invalid = ::std::numeric_limits<::fidl_union_tag_t>::max(), |
| }; |
| |
| static inline ::std::unique_ptr<ExampleUnion> New() { |
| return ::std::make_unique<ExampleUnion>(); |
| } |
| |
| void Encode(::fidl::Encoder* encoder, size_t offset); |
| static void Decode(::fidl::Decoder* decoder, ExampleUnion* value, |
| size_t offset); |
| zx_status_t Clone(ExampleUnion* result) const; |
| |
| bool has_invalid_tag() const { return tag_ == Invalid; } |
| |
| bool is_variant() const { return tag_ == Tag::kVariant; } |
| |
| uint32_t& variant() { |
| EnsureStorageInitialized(Tag::kVariant); |
| return variant_; |
| } |
| |
| const uint32_t& variant() const { |
| ZX_ASSERT(is_variant()); |
| return variant_; |
| } |
| ExampleUnion& set_variant(uint32_t value); |
| |
| Tag Which() const { return Tag(tag_); } |
| |
| // You probably want to use Which() method instead of Ordinal(). Use Ordinal() |
| // only when you need access to the raw integral ordinal value. |
| fidl_xunion_tag_t Ordinal() const { return tag_; } |
| |
| friend ::fidl::Equality<::example::ExampleUnion>; |
| |
| private: |
| void Destroy(); |
| void EnsureStorageInitialized(::fidl_xunion_tag_t tag); |
| |
| ::fidl_xunion_tag_t tag_ = static_cast<fidl_xunion_tag_t>(Tag::Invalid); |
| union { |
| uint32_t variant_; |
| }; |
| }; |
| |
| inline zx_status_t Clone(const ::example::ExampleUnion& value, |
| ::example::ExampleUnion* result) { |
| return value.Clone(result); |
| } |
| |
| using ExampleUnionPtr = ::std::unique_ptr<ExampleUnion>; |
| |
| class ExampleTable final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const uint32_t& member() const { |
| ZX_ASSERT(field_presence_.IsSet<0>()); |
| return member_value_.value; |
| } |
| bool has_member() const { return field_presence_.IsSet<0>(); } |
| |
| uint32_t* mutable_member() { |
| if (!field_presence_.IsSet<0>()) { |
| field_presence_.Set<0>(); |
| Construct(&member_value_.value); |
| } |
| return &member_value_.value; |
| } |
| ExampleTable& set_member(uint32_t _value) { |
| if (!field_presence_.IsSet<0>()) { |
| field_presence_.Set<0>(); |
| Construct(&member_value_.value, std::move(_value)); |
| } else { |
| member_value_.value = std::move(_value); |
| } |
| return *this; |
| } |
| void clear_member() { |
| if (!field_presence_.IsSet<0>()) { |
| return; |
| } |
| field_presence_.Clear<0>(); |
| Destruct(&member_value_.value); |
| } |
| |
| ExampleTable(); |
| ExampleTable(ExampleTable&& other); |
| ~ExampleTable(); |
| ExampleTable& operator=(ExampleTable&& other); |
| |
| static inline ::std::unique_ptr<ExampleTable> New() { |
| return ::std::make_unique<ExampleTable>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, ExampleTable* _value, |
| size_t _offset); |
| zx_status_t Clone(ExampleTable* _result) const; |
| |
| private: |
| template <class T, class... Args> |
| void Construct(T* p, Args&&... args) { |
| new (p) T(std::forward<Args>(args)...); |
| } |
| |
| template <class T> |
| void Destruct(T* p) { |
| p->~T(); |
| } |
| |
| ::fidl::internal::BitSet<1> field_presence_; |
| union ValueUnion_member { |
| ValueUnion_member() {} |
| ~ValueUnion_member() {} |
| |
| uint32_t value; |
| }; |
| ValueUnion_member member_value_; |
| }; |
| |
| using ExampleTablePtr = ::std::unique_ptr<ExampleTable>; |
| |
| class ExampleStruct final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| uint32_t member{}; |
| |
| static inline ::std::unique_ptr<ExampleStruct> New() { |
| return ::std::make_unique<ExampleStruct>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset); |
| static void Decode(::fidl::Decoder* _decoder, ExampleStruct* value, |
| size_t _offset); |
| zx_status_t Clone(ExampleStruct* result) const; |
| }; |
| |
| inline zx_status_t Clone(const ::example::ExampleStruct& _value, |
| ::example::ExampleStruct* _result) { |
| return _value.Clone(_result); |
| } |
| |
| using ExampleStructPtr = ::std::unique_ptr<ExampleStruct>; |
| |
| constexpr uint32_t EXAMPLE_CONST = 0u; |
| } // namespace example |
| namespace fidl { |
| |
| template <> |
| struct IsFidlXUnion<::example::ExampleXUnion> : public std::true_type {}; |
| |
| template <> |
| struct CodingTraits<::example::ExampleXUnion> |
| : public EncodableCodingTraits<::example::ExampleXUnion, 24> {}; |
| |
| template <> |
| struct CodingTraits<std::unique_ptr<::example::ExampleXUnion>> { |
| static constexpr size_t inline_size_v1_no_ee = 24; |
| |
| static void Encode(Encoder* encoder, |
| std::unique_ptr<::example::ExampleXUnion>* value, |
| size_t offset) { |
| auto&& p_xunion = *value; |
| if (p_xunion) { |
| p_xunion->Encode(encoder, offset); |
| } |
| } |
| |
| static void Decode(Decoder* decoder, |
| std::unique_ptr<::example::ExampleXUnion>* value, |
| size_t offset) { |
| fidl_xunion_t* encoded = decoder->GetPtr<fidl_xunion_t>(offset); |
| if (encoded->tag == 0) { |
| value->reset(nullptr); |
| return; |
| } |
| |
| value->reset(new ::example::ExampleXUnion); |
| |
| ::example::ExampleXUnion::Decode(decoder, value->get(), offset); |
| } |
| }; |
| |
| inline zx_status_t Clone(const ::example::ExampleXUnion& value, |
| ::example::ExampleXUnion* result) { |
| return ::example::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::example::ExampleXUnion> { |
| bool operator()(const ::example::ExampleXUnion& _lhs, |
| const ::example::ExampleXUnion& _rhs) const { |
| if (_lhs.Ordinal() != _rhs.Ordinal()) { |
| return false; |
| } |
| |
| switch (_lhs.Ordinal()) { |
| case static_cast<fidl_xunion_tag_t>( |
| ::example::ExampleXUnion::Tag::Invalid): |
| return true; |
| case ::example::ExampleXUnion::Tag::kVariant: |
| return ::fidl::Equals(_lhs.variant_, _rhs.variant_); |
| default: |
| return ::fidl::Equals(_lhs.unknown_data_, _rhs.unknown_data_); |
| } |
| } |
| }; |
| template <> |
| struct IsFidlXUnion<::example::ExampleUnion> : public std::true_type {}; |
| |
| template <> |
| struct CodingTraits<::example::ExampleUnion> |
| : public EncodableCodingTraits<::example::ExampleUnion, 24> {}; |
| |
| template <> |
| struct CodingTraits<std::unique_ptr<::example::ExampleUnion>> { |
| static constexpr size_t inline_size_v1_no_ee = 24; |
| |
| static void Encode(Encoder* encoder, |
| std::unique_ptr<::example::ExampleUnion>* value, |
| size_t offset) { |
| auto&& p_xunion = *value; |
| if (p_xunion) { |
| p_xunion->Encode(encoder, offset); |
| } |
| } |
| |
| static void Decode(Decoder* decoder, |
| std::unique_ptr<::example::ExampleUnion>* value, |
| size_t offset) { |
| fidl_xunion_t* encoded = decoder->GetPtr<fidl_xunion_t>(offset); |
| if (encoded->tag == 0) { |
| value->reset(nullptr); |
| return; |
| } |
| |
| value->reset(new ::example::ExampleUnion); |
| |
| ::example::ExampleUnion::Decode(decoder, value->get(), offset); |
| } |
| }; |
| |
| inline zx_status_t Clone(const ::example::ExampleUnion& value, |
| ::example::ExampleUnion* result) { |
| return ::example::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::example::ExampleUnion> { |
| bool operator()(const ::example::ExampleUnion& _lhs, |
| const ::example::ExampleUnion& _rhs) const { |
| if (_lhs.Ordinal() != _rhs.Ordinal()) { |
| return false; |
| } |
| |
| switch (_lhs.Ordinal()) { |
| case static_cast<fidl_xunion_tag_t>( |
| ::example::ExampleUnion::Tag::Invalid): |
| return true; |
| case ::example::ExampleUnion::Tag::kVariant: |
| return ::fidl::Equals(_lhs.variant_, _rhs.variant_); |
| |
| default: |
| return false; |
| } |
| } |
| }; |
| template <> |
| struct CodingTraits<::example::ExampleTable> |
| : public EncodableCodingTraits<::example::ExampleTable, 16> {}; |
| |
| inline zx_status_t Clone(const ::example::ExampleTable& _value, |
| ::example::ExampleTable* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::example::ExampleTable> { |
| bool operator()(const ::example::ExampleTable& _lhs, |
| const ::example::ExampleTable& _rhs) const { |
| if (_lhs.has_member()) { |
| if (!_rhs.has_member()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.member(), _rhs.member())) { |
| return false; |
| } |
| } else if (_rhs.has_member()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::example::ExampleStruct> |
| : public EncodableCodingTraits<::example::ExampleStruct, 4> {}; |
| |
| template <> |
| struct IsMemcpyCompatible<::example::ExampleStruct> |
| : public internal::BoolConstant< |
| !HasPadding<::example::ExampleStruct>::value && |
| IsMemcpyCompatible<uint32_t>::value> {}; |
| |
| inline zx_status_t Clone(const ::example::ExampleStruct& value, |
| ::example::ExampleStruct* result) { |
| return ::example::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::example::ExampleStruct> { |
| bool operator()(const ::example::ExampleStruct& _lhs, |
| const ::example::ExampleStruct& _rhs) const { |
| if (!::fidl::Equals(_lhs.member, _rhs.member)) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::example::ExampleEnum> { |
| static constexpr size_t inline_size_old = sizeof(::example::ExampleEnum); |
| static constexpr size_t inline_size_v1_no_ee = sizeof(::example::ExampleEnum); |
| static void Encode(Encoder* encoder, ::example::ExampleEnum* value, |
| size_t offset) { |
| uint32_t underlying = static_cast<uint32_t>(*value); |
| ::fidl::Encode(encoder, &underlying, offset); |
| } |
| static void Decode(Decoder* decoder, ::example::ExampleEnum* value, |
| size_t offset) { |
| uint32_t underlying = {}; |
| ::fidl::Decode(decoder, &underlying, offset); |
| *value = static_cast<::example::ExampleEnum>(underlying); |
| } |
| }; |
| |
| inline zx_status_t Clone(::example::ExampleEnum value, |
| ::example::ExampleEnum* result) { |
| return ::example::Clone(value, result); |
| } |
| template <> |
| struct Equality<::example::ExampleEnum> { |
| bool operator()(const ::example::ExampleEnum& _lhs, |
| const ::example::ExampleEnum& _rhs) const { |
| return _lhs == _rhs; |
| } |
| }; |
| |
| template <> |
| struct CodingTraits<::example::ExampleBits> { |
| static constexpr size_t inline_size_old = sizeof(::example::ExampleBits); |
| static constexpr size_t inline_size_v1_no_ee = sizeof(::example::ExampleBits); |
| static void Encode(Encoder* encoder, ::example::ExampleBits* value, |
| size_t offset) { |
| uint32_t underlying = static_cast<uint32_t>(*value); |
| ::fidl::Encode(encoder, &underlying, offset); |
| } |
| static void Decode(Decoder* decoder, ::example::ExampleBits* value, |
| size_t offset) { |
| uint32_t underlying = {}; |
| ::fidl::Decode(decoder, &underlying, offset); |
| *value = static_cast<::example::ExampleBits>(underlying); |
| } |
| }; |
| |
| inline zx_status_t Clone(::example::ExampleBits value, |
| ::example::ExampleBits* result) { |
| return ::example::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::example::ExampleBits> { |
| bool operator()(const ::example::ExampleBits& _lhs, |
| const ::example::ExampleBits& _rhs) const { |
| uint32_t _lhs_underlying = static_cast<uint32_t>(_lhs); |
| uint32_t _rhs_underlying = static_cast<uint32_t>(_rhs); |
| return ::fidl::Equals(_lhs_underlying, _rhs_underlying); |
| } |
| }; |
| } // namespace fidl |