| // WARNING: This file is machine generated by fidlgen. |
| |
| #include <fidl/test/handlesintypes/llcpp/fidl.h> |
| |
| #include <memory> |
| |
| #ifdef __Fuchsia__ |
| |
| auto ::fidl_test_handlesintypes::wire::UnionWithHandle::which() const |
| -> ::fidl_test_handlesintypes::wire::UnionWithHandle::Tag { |
| ZX_ASSERT(!has_invalid_tag()); |
| switch (ordinal_) { |
| case ::fidl_test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: |
| return static_cast< |
| ::fidl_test_handlesintypes::wire::UnionWithHandle::Tag>(ordinal_); |
| default: |
| return ::fidl_test_handlesintypes::wire::UnionWithHandle::Tag::kUnknown; |
| } |
| } |
| |
| void ::fidl_test_handlesintypes::wire::UnionWithHandle:: |
| SizeAndOffsetAssertionHelper() { |
| static_assert(sizeof(UnionWithHandle) == sizeof(fidl_xunion_t)); |
| static_assert(offsetof(UnionWithHandle, ordinal_) == |
| offsetof(fidl_xunion_t, tag)); |
| static_assert(offsetof(UnionWithHandle, envelope_) == |
| offsetof(fidl_xunion_t, envelope)); |
| } |
| void ::fidl_test_handlesintypes::wire::UnionWithHandle::_CloseHandles() { |
| switch (ordinal_) { |
| case ::fidl_test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: { |
| mutable_h().reset(); |
| break; |
| } |
| default: |
| break; |
| } |
| } |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| void ::fidl_test_handlesintypes::wire::TableWithHandle::_CloseHandles() { |
| if (has_h()) { |
| h().reset(); |
| } |
| } |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| void ::fidl_test_handlesintypes::wire::HandlesInTypes::_CloseHandles() { |
| normal_handle.reset(); |
| { |
| ::zx::vmo* handle_in_vec_element = handle_in_vec.mutable_data(); |
| for (uint64_t i = 0; i < handle_in_vec.count(); |
| ++i, ++handle_in_vec_element) { |
| handle_in_vec_element->reset(); |
| } |
| } |
| { |
| ::zx::vmo* handle_in_array_element = handle_in_array.data(); |
| for (size_t i = 0; i < handle_in_array.size(); |
| ++i, ++handle_in_array_element) { |
| handle_in_array_element->reset(); |
| } |
| } |
| { |
| ::fidl::Array<::zx::vmo, 5>* handle_in_mixed_vec_array_element = |
| handle_in_mixed_vec_array.mutable_data(); |
| for (uint64_t i = 0; i < handle_in_mixed_vec_array.count(); |
| ++i, ++handle_in_mixed_vec_array_element) { |
| { |
| ::zx::vmo* handle_in_mixed_vec_array_element_element = |
| (*handle_in_mixed_vec_array_element).data(); |
| for (size_t i = 0; i < (*handle_in_mixed_vec_array_element).size(); |
| ++i, ++handle_in_mixed_vec_array_element_element) { |
| handle_in_mixed_vec_array_element_element->reset(); |
| } |
| } |
| } |
| } |
| table_with_handle._CloseHandles(); |
| union_with_handle._CloseHandles(); |
| } |
| #endif // __Fuchsia__ |