| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <zx/cpp/natural_types.h> |
| |
| #include "lib/fidl/cpp/internal/natural_types_header.h" |
| |
| // |
| // Domain objects declarations (i.e. "natural types" in unified bindings). |
| // |
| namespace fidl { |
| namespace test { |
| namespace handles { |
| |
| enum class obj_type : uint32_t { |
| |
| NONE = 0u, |
| |
| PROCESS = 1u, |
| |
| THREAD = 2u, |
| |
| VMO = 3u, |
| |
| CHANNEL = 4u, |
| |
| EVENT = 5u, |
| |
| PORT = 6u, |
| |
| INTERRUPT = 9u, |
| |
| PCI_DEVICE = 11u, |
| |
| LOG = 12u, |
| |
| SOCKET = 14u, |
| |
| RESOURCE = 15u, |
| |
| EVENTPAIR = 16u, |
| |
| JOB = 17u, |
| |
| VMAR = 18u, |
| |
| FIFO = 19u, |
| |
| GUEST = 20u, |
| |
| VCPU = 21u, |
| |
| TIMER = 22u, |
| |
| IOMMU = 23u, |
| |
| BTI = 24u, |
| |
| PROFILE = 25u, |
| |
| PMT = 26u, |
| |
| SUSPEND_TOKEN = 27u, |
| |
| PAGER = 28u, |
| |
| EXCEPTION = 29u, |
| |
| CLOCK = 30u, |
| |
| STREAM = 31u, |
| |
| MSI_ALLOCATION = 32u, |
| |
| MSI_INTERRUPT = 33u, |
| }; |
| |
| inline zx_status_t Clone(::fidl::test::handles::obj_type value, |
| ::fidl::test::handles::obj_type* result) { |
| *result = value; |
| return ZX_OK; |
| } |
| |
| class Handles; |
| |
| #ifdef __Fuchsia__ |
| |
| class SomeProtocol; |
| using SomeProtocolHandle = ::fidl::InterfaceHandle<SomeProtocol>; |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class Handles final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| ::zx::handle plain_handle{}; |
| |
| ::zx::bti bti_handle{}; |
| |
| ::zx::channel channel_handle{}; |
| |
| ::zx::clock clock_handle{}; |
| |
| ::zx::debuglog debuglog_handle{}; |
| |
| ::zx::event event_handle{}; |
| |
| ::zx::eventpair eventpair_handle{}; |
| |
| ::zx::exception exception_handle{}; |
| |
| ::zx::fifo fifo_handle{}; |
| |
| ::zx::guest guest_handle{}; |
| |
| ::zx::interrupt interrupt_handle{}; |
| |
| ::zx::iommu iommu_handle{}; |
| |
| ::zx::job job_handle{}; |
| |
| ::zx::pager pager_handle{}; |
| |
| ::zx::pcidevice pcidevice_handle{}; |
| |
| ::zx::pmt pmt_handle{}; |
| |
| ::zx::port port_handle{}; |
| |
| ::zx::process process_handle{}; |
| |
| ::zx::profile profile_handle{}; |
| |
| ::zx::resource resource_handle{}; |
| |
| ::zx::socket socket_handle{}; |
| |
| ::zx::suspendtoken suspendtoken_handle{}; |
| |
| ::zx::thread thread_handle{}; |
| |
| ::zx::timer timer_handle{}; |
| |
| ::zx::vcpu vcpu_handle{}; |
| |
| ::zx::vmar vmar_handle{}; |
| |
| ::zx::vmo vmo_handle{}; |
| |
| ::zx::vmo rights_handle{}; |
| |
| ::zx::handle aliased_plain_handle_field{}; |
| |
| ::zx::vmo aliased_subtype_handle_field{}; |
| |
| ::zx::vmo aliased_rights_handle_field{}; |
| |
| ::fidl::InterfaceHandle<::fidl::test::handles::SomeProtocol> some_protocol{}; |
| |
| ::fidl::InterfaceRequest<::fidl::test::handles::SomeProtocol> |
| request_some_protocol{}; |
| |
| static inline ::std::unique_ptr<Handles> New() { |
| return ::std::make_unique<Handles>(); |
| } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset, |
| cpp17::optional<::fidl::HandleInformation> maybe_handle_info = |
| cpp17::nullopt); |
| static void Decode(::fidl::Decoder* _decoder, Handles* value, size_t _offset); |
| zx_status_t Clone(Handles* result) const; |
| }; |
| |
| inline zx_status_t Clone(const ::fidl::test::handles::Handles& _value, |
| ::fidl::test::handles::Handles* _result) { |
| return _value.Clone(_result); |
| } |
| |
| using HandlesPtr = ::std::unique_ptr<Handles>; |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| class SomeProtocol_RequestEncoder { |
| public: |
| }; |
| |
| class SomeProtocol_ResponseEncoder { |
| public: |
| }; |
| #endif // __Fuchsia__ |
| |
| } // namespace handles |
| } // namespace test |
| template <> |
| struct CodingTraits<::fidl::test::handles::obj_type> { |
| static constexpr size_t inline_size_old = |
| sizeof(::fidl::test::handles::obj_type); |
| static constexpr size_t inline_size_v1_no_ee = |
| sizeof(::fidl::test::handles::obj_type); |
| static void Encode( |
| Encoder* encoder, ::fidl::test::handles::obj_type* value, size_t offset, |
| cpp17::optional<::fidl::HandleInformation> maybe_handle_info) { |
| ZX_DEBUG_ASSERT(!maybe_handle_info); |
| uint32_t underlying = static_cast<uint32_t>(*value); |
| ::fidl::Encode(encoder, &underlying, offset); |
| } |
| static void Decode(Decoder* decoder, ::fidl::test::handles::obj_type* value, |
| size_t offset) { |
| uint32_t underlying = {}; |
| ::fidl::Decode(decoder, &underlying, offset); |
| *value = static_cast<::fidl::test::handles::obj_type>(underlying); |
| } |
| }; |
| |
| inline zx_status_t Clone(::fidl::test::handles::obj_type value, |
| ::fidl::test::handles::obj_type* result) { |
| return ::fidl::test::handles::Clone(value, result); |
| } |
| template <> |
| struct Equality<::fidl::test::handles::obj_type> { |
| bool operator()(const ::fidl::test::handles::obj_type& _lhs, |
| const ::fidl::test::handles::obj_type& _rhs) const { |
| return _lhs == _rhs; |
| } |
| }; |
| |
| #ifdef __Fuchsia__ |
| |
| template <> |
| struct CodingTraits<::fidl::test::handles::Handles> |
| : public EncodableCodingTraits<::fidl::test::handles::Handles, 132> {}; |
| |
| template <> |
| struct IsMemcpyCompatible<::fidl::test::handles::Handles> |
| : public internal::BoolConstant< |
| !HasPadding<::fidl::test::handles::Handles>::value && |
| IsMemcpyCompatible<::fidl::InterfaceHandle< |
| ::fidl::test::handles::SomeProtocol>>::value && |
| IsMemcpyCompatible<::fidl::InterfaceRequest< |
| ::fidl::test::handles::SomeProtocol>>::value && |
| IsMemcpyCompatible<::zx::bti>::value && |
| IsMemcpyCompatible<::zx::channel>::value && |
| IsMemcpyCompatible<::zx::clock>::value && |
| IsMemcpyCompatible<::zx::debuglog>::value && |
| IsMemcpyCompatible<::zx::event>::value && |
| IsMemcpyCompatible<::zx::eventpair>::value && |
| IsMemcpyCompatible<::zx::exception>::value && |
| IsMemcpyCompatible<::zx::fifo>::value && |
| IsMemcpyCompatible<::zx::guest>::value && |
| IsMemcpyCompatible<::zx::handle>::value && |
| IsMemcpyCompatible<::zx::interrupt>::value && |
| IsMemcpyCompatible<::zx::iommu>::value && |
| IsMemcpyCompatible<::zx::job>::value && |
| IsMemcpyCompatible<::zx::pager>::value && |
| IsMemcpyCompatible<::zx::pcidevice>::value && |
| IsMemcpyCompatible<::zx::pmt>::value && |
| IsMemcpyCompatible<::zx::port>::value && |
| IsMemcpyCompatible<::zx::process>::value && |
| IsMemcpyCompatible<::zx::profile>::value && |
| IsMemcpyCompatible<::zx::resource>::value && |
| IsMemcpyCompatible<::zx::socket>::value && |
| IsMemcpyCompatible<::zx::suspendtoken>::value && |
| IsMemcpyCompatible<::zx::thread>::value && |
| IsMemcpyCompatible<::zx::timer>::value && |
| IsMemcpyCompatible<::zx::vcpu>::value && |
| IsMemcpyCompatible<::zx::vmar>::value && |
| IsMemcpyCompatible<::zx::vmo>::value> {}; |
| |
| inline zx_status_t Clone(const ::fidl::test::handles::Handles& value, |
| ::fidl::test::handles::Handles* result) { |
| return ::fidl::test::handles::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::fidl::test::handles::Handles> { |
| bool operator()(const ::fidl::test::handles::Handles& _lhs, |
| const ::fidl::test::handles::Handles& _rhs) const { |
| if (!::fidl::Equals(_lhs.plain_handle, _rhs.plain_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.bti_handle, _rhs.bti_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.channel_handle, _rhs.channel_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.clock_handle, _rhs.clock_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.debuglog_handle, _rhs.debuglog_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.event_handle, _rhs.event_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.eventpair_handle, _rhs.eventpair_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.exception_handle, _rhs.exception_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.fifo_handle, _rhs.fifo_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.guest_handle, _rhs.guest_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.interrupt_handle, _rhs.interrupt_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.iommu_handle, _rhs.iommu_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.job_handle, _rhs.job_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.pager_handle, _rhs.pager_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.pcidevice_handle, _rhs.pcidevice_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.pmt_handle, _rhs.pmt_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.port_handle, _rhs.port_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.process_handle, _rhs.process_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.profile_handle, _rhs.profile_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.resource_handle, _rhs.resource_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.socket_handle, _rhs.socket_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.suspendtoken_handle, _rhs.suspendtoken_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.thread_handle, _rhs.thread_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.timer_handle, _rhs.timer_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.vcpu_handle, _rhs.vcpu_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.vmar_handle, _rhs.vmar_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.vmo_handle, _rhs.vmo_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.rights_handle, _rhs.rights_handle)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.aliased_plain_handle_field, |
| _rhs.aliased_plain_handle_field)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.aliased_subtype_handle_field, |
| _rhs.aliased_subtype_handle_field)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.aliased_rights_handle_field, |
| _rhs.aliased_rights_handle_field)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.some_protocol, _rhs.some_protocol)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.request_some_protocol, |
| _rhs.request_some_protocol)) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| #endif // __Fuchsia__ |
| |
| } // namespace fidl |