| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include "lib/fidl/cpp/internal/header.h" |
| |
| namespace test { |
| namespace time { |
| |
| // |
| // Domain objects declarations |
| // |
| |
| class AllInstants; |
| |
| class ComplexInstants; |
| |
| class AllInstants final { |
| public: |
| static const fidl_type_t* FidlType; |
| |
| ::fidl::basic_time<ZX_CLOCK_MONOTONIC> monotonic{}; |
| |
| ::fidl::basic_time<ZX_CLOCK_BOOT> boot{}; |
| |
| ::fidl::basic_ticks<ZX_CLOCK_MONOTONIC> monotonic_ticks{}; |
| |
| ::fidl::basic_ticks<ZX_CLOCK_BOOT> boot_ticks{}; |
| |
| static inline ::std::unique_ptr<AllInstants> New() { return ::std::make_unique<AllInstants>(); } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset, |
| std::optional<::fidl::HandleInformation> maybe_handle_info = std::nullopt); |
| static void Decode(::fidl::Decoder* _decoder, AllInstants* value, size_t _offset); |
| zx_status_t Clone(AllInstants* result) const; |
| }; |
| |
| inline zx_status_t Clone(const ::test::time::AllInstants& _value, |
| ::test::time::AllInstants* _result) { |
| return _value.Clone(_result); |
| } |
| |
| using AllInstantsPtr = ::std::unique_ptr<AllInstants>; |
| |
| class ComplexInstants final { |
| public: |
| static const fidl_type_t* FidlType; |
| /// Returns whether no field is set. |
| bool IsEmpty() const; |
| |
| const ::std::array<::fidl::basic_time<ZX_CLOCK_MONOTONIC>, 10>& monotonic() const { |
| ZX_ASSERT(field_presence_.IsSet<0>()); |
| return monotonic_value_.value; |
| } |
| bool has_monotonic() const { |
| return field_presence_.IsSet<0>(); |
| } |
| |
| ::std::array<::fidl::basic_time<ZX_CLOCK_MONOTONIC>, 10>* mutable_monotonic() { |
| if (!field_presence_.IsSet<0>()) { |
| field_presence_.Set<0>(); |
| Construct(&monotonic_value_.value); |
| } |
| return &monotonic_value_.value; |
| } |
| ComplexInstants& set_monotonic(::std::array<::fidl::basic_time<ZX_CLOCK_MONOTONIC>, 10> _value); |
| void clear_monotonic() { |
| if (!field_presence_.IsSet<0>()) { |
| return; |
| } |
| field_presence_.Clear<0>(); |
| Destruct(&monotonic_value_.value); |
| } |
| |
| const ::std::vector<::fidl::basic_time<ZX_CLOCK_BOOT>>& boot() const { |
| ZX_ASSERT(field_presence_.IsSet<1>()); |
| return boot_value_.value; |
| } |
| bool has_boot() const { |
| return field_presence_.IsSet<1>(); |
| } |
| |
| ::std::vector<::fidl::basic_time<ZX_CLOCK_BOOT>>* mutable_boot() { |
| if (!field_presence_.IsSet<1>()) { |
| field_presence_.Set<1>(); |
| Construct(&boot_value_.value); |
| } |
| return &boot_value_.value; |
| } |
| ComplexInstants& set_boot(::std::vector<::fidl::basic_time<ZX_CLOCK_BOOT>> _value); |
| void clear_boot() { |
| if (!field_presence_.IsSet<1>()) { |
| return; |
| } |
| field_presence_.Clear<1>(); |
| Destruct(&boot_value_.value); |
| } |
| |
| const ::std::array<::fidl::basic_ticks<ZX_CLOCK_MONOTONIC>, 10>& monotonic_ticks() const { |
| ZX_ASSERT(field_presence_.IsSet<2>()); |
| return monotonic_ticks_value_.value; |
| } |
| bool has_monotonic_ticks() const { |
| return field_presence_.IsSet<2>(); |
| } |
| |
| ::std::array<::fidl::basic_ticks<ZX_CLOCK_MONOTONIC>, 10>* mutable_monotonic_ticks() { |
| if (!field_presence_.IsSet<2>()) { |
| field_presence_.Set<2>(); |
| Construct(&monotonic_ticks_value_.value); |
| } |
| return &monotonic_ticks_value_.value; |
| } |
| ComplexInstants& set_monotonic_ticks(::std::array<::fidl::basic_ticks<ZX_CLOCK_MONOTONIC>, 10> _value); |
| void clear_monotonic_ticks() { |
| if (!field_presence_.IsSet<2>()) { |
| return; |
| } |
| field_presence_.Clear<2>(); |
| Destruct(&monotonic_ticks_value_.value); |
| } |
| |
| const ::std::array<::fidl::basic_ticks<ZX_CLOCK_BOOT>, 10>& boot_ticks() const { |
| ZX_ASSERT(field_presence_.IsSet<3>()); |
| return boot_ticks_value_.value; |
| } |
| bool has_boot_ticks() const { |
| return field_presence_.IsSet<3>(); |
| } |
| |
| ::std::array<::fidl::basic_ticks<ZX_CLOCK_BOOT>, 10>* mutable_boot_ticks() { |
| if (!field_presence_.IsSet<3>()) { |
| field_presence_.Set<3>(); |
| Construct(&boot_ticks_value_.value); |
| } |
| return &boot_ticks_value_.value; |
| } |
| ComplexInstants& set_boot_ticks(::std::array<::fidl::basic_ticks<ZX_CLOCK_BOOT>, 10> _value); |
| void clear_boot_ticks() { |
| if (!field_presence_.IsSet<3>()) { |
| return; |
| } |
| field_presence_.Clear<3>(); |
| Destruct(&boot_ticks_value_.value); |
| } |
| |
| ComplexInstants(); |
| ComplexInstants(ComplexInstants&& other); |
| ~ComplexInstants(); |
| ComplexInstants& operator=(ComplexInstants&& other); |
| |
| static inline ::std::unique_ptr<ComplexInstants> New() { return ::std::make_unique<ComplexInstants>(); } |
| |
| void Encode(::fidl::Encoder* _encoder, size_t _offset, |
| std::optional<::fidl::HandleInformation> maybe_handle_info = std::nullopt); |
| static void Decode(::fidl::Decoder* _decoder, ComplexInstants* _value, size_t _offset); |
| zx_status_t Clone(ComplexInstants* _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(); |
| } |
| |
| size_t MaxOrdinal() const { |
| return static_cast<size_t>(field_presence_.MaxSetIndex()) + std::size_t{1}; |
| } |
| |
| static bool IsOrdinalKnown(uint64_t ordinal) { |
| switch (ordinal) { |
| case 1: |
| case 2: |
| case 3: |
| case 4: |
| return true; |
| default: |
| return false; |
| } |
| } |
| |
| ::fidl::internal::BitSet<4> field_presence_; |
| union ValueUnion_monotonic { |
| ValueUnion_monotonic() {} |
| ~ValueUnion_monotonic() {} |
| |
| ::std::array<::fidl::basic_time<ZX_CLOCK_MONOTONIC>, 10> value; |
| }; |
| ValueUnion_monotonic monotonic_value_; |
| union ValueUnion_boot { |
| ValueUnion_boot() {} |
| ~ValueUnion_boot() {} |
| |
| ::std::vector<::fidl::basic_time<ZX_CLOCK_BOOT>> value; |
| }; |
| ValueUnion_boot boot_value_; |
| union ValueUnion_monotonic_ticks { |
| ValueUnion_monotonic_ticks() {} |
| ~ValueUnion_monotonic_ticks() {} |
| |
| ::std::array<::fidl::basic_ticks<ZX_CLOCK_MONOTONIC>, 10> value; |
| }; |
| ValueUnion_monotonic_ticks monotonic_ticks_value_; |
| union ValueUnion_boot_ticks { |
| ValueUnion_boot_ticks() {} |
| ~ValueUnion_boot_ticks() {} |
| |
| ::std::array<::fidl::basic_ticks<ZX_CLOCK_BOOT>, 10> value; |
| }; |
| ValueUnion_boot_ticks boot_ticks_value_; |
| }; |
| |
| using ComplexInstantsPtr = ::std::unique_ptr<ComplexInstants>; |
| |
| } // namespace time |
| } // namespace test |
| namespace fidl { |
| |
| template <> |
| struct CodingTraits<::test::time::AllInstants> |
| : public EncodableCodingTraits<::test::time::AllInstants, 32> {}; |
| |
| template <> |
| struct IsMemcpyCompatible<::test::time::AllInstants> : public internal::BoolConstant< |
| !HasPadding<::test::time::AllInstants>::value && IsMemcpyCompatible<::fidl::basic_time<ZX_CLOCK_MONOTONIC>>::value && IsMemcpyCompatible<::fidl::basic_time<ZX_CLOCK_BOOT>>::value && IsMemcpyCompatible<::fidl::basic_ticks<ZX_CLOCK_MONOTONIC>>::value && IsMemcpyCompatible<::fidl::basic_ticks<ZX_CLOCK_BOOT>>::value> {}; |
| |
| inline zx_status_t Clone(const ::test::time::AllInstants& value, |
| ::test::time::AllInstants* result) { |
| return ::test::time::Clone(value, result); |
| } |
| |
| template <> |
| struct Equality<::test::time::AllInstants> { |
| bool operator()(const ::test::time::AllInstants& _lhs, const ::test::time::AllInstants& _rhs) const { |
| if (!::fidl::Equals(_lhs.monotonic, _rhs.monotonic)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.boot, _rhs.boot)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.monotonic_ticks, _rhs.monotonic_ticks)) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.boot_ticks, _rhs.boot_ticks)) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| template <> |
| struct CodingTraits<::test::time::ComplexInstants> |
| : public EncodableCodingTraits<::test::time::ComplexInstants, 16> {}; |
| |
| inline zx_status_t Clone(const ::test::time::ComplexInstants& _value, |
| ::test::time::ComplexInstants* result) { |
| return _value.Clone(result); |
| } |
| template <> |
| struct Equality<::test::time::ComplexInstants> { |
| bool operator()(const ::test::time::ComplexInstants& _lhs, const ::test::time::ComplexInstants& _rhs) const { |
| if (_lhs.has_monotonic()) { |
| if (!_rhs.has_monotonic()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.monotonic(), _rhs.monotonic())) { |
| return false; |
| } |
| } else if (_rhs.has_monotonic()) { |
| return false; |
| } |
| if (_lhs.has_boot()) { |
| if (!_rhs.has_boot()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.boot(), _rhs.boot())) { |
| return false; |
| } |
| } else if (_rhs.has_boot()) { |
| return false; |
| } |
| if (_lhs.has_monotonic_ticks()) { |
| if (!_rhs.has_monotonic_ticks()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.monotonic_ticks(), _rhs.monotonic_ticks())) { |
| return false; |
| } |
| } else if (_rhs.has_monotonic_ticks()) { |
| return false; |
| } |
| if (_lhs.has_boot_ticks()) { |
| if (!_rhs.has_boot_ticks()) { |
| return false; |
| } |
| if (!::fidl::Equals(_lhs.boot_ticks(), _rhs.boot_ticks())) { |
| return false; |
| } |
| } else if (_rhs.has_boot_ticks()) { |
| return false; |
| } |
| return true; |
| } |
| }; |
| |
| // |
| // Proxies and stubs declarations |
| // |
| } // namespace fidl |