| {{/* |
| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| */}} |
| |
| {{- define "Method:Event:WireMessagingHeader" }} |
| {{- EnsureNamespace "" }} |
| {{- IfdefFuchsia -}} |
| |
| template<> |
| struct {{ .WireTransactionalEvent }} final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t header; |
| |
| {{ if .ResponseArgs }} |
| {{ .WireEvent }} body; |
| |
| explicit {{ .WireTransactionalEvent.Self }}({{ RenderParams .ResponseArgs }}) |
| : body{ {{ RenderForwardParams .ResponseArgs }} } { |
| _InitHeader(); |
| } |
| {{- end }} |
| |
| {{ .WireTransactionalEvent.Self }}() { |
| _InitHeader(); |
| } |
| |
| {{- if .Response.IsResource }} |
| void _CloseHandles() { |
| {{- if .ResponseArgs }} |
| body._CloseHandles(); |
| {{- end }} |
| } |
| {{- end }} |
| |
| private: |
| void _InitHeader(); |
| }; |
| |
| template <bool IsRecursive> |
| struct ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive> |
| : public WireStructCodingTraitsBase<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive> { |
| static constexpr size_t inline_size = {{ .Response.TypeShapeV2.InlineSize }} + sizeof(fidl_message_header_t); |
| |
| static void Encode( |
| internal::WireEncoder* encoder, {{ .WireTransactionalEvent }}* value, ::fidl::internal::WirePosition position, RecursionDepth<IsRecursive> recursion_depth) { |
| *position.As<fidl_message_header_t>() = value->header; |
| {{- if .HasResponsePayload }} |
| WireCodingTraits<{{ .WireEvent }}, WireCodingConstraintEmpty, IsRecursive>::Encode( |
| encoder, &value->body, position + sizeof(fidl_message_header_t), recursion_depth); |
| {{- end }} |
| } |
| static void Decode( |
| internal::WireDecoder* decoder, ::fidl::internal::WirePosition position, RecursionDepth<IsRecursive> recursion_depth) { |
| {{- if .HasResponsePayload }} |
| WireCodingTraits<{{ .WireEvent }}, WireCodingConstraintEmpty, IsRecursive>::Decode( |
| decoder, position + sizeof(fidl_message_header_t), recursion_depth); |
| {{- end }} |
| } |
| }; |
| {{- EndifFuchsia -}} |
| {{- end }} |
| |
| |
| |
| {{- define "Method:Event:WireMessagingSource" }} |
| {{- EnsureNamespace "" }} |
| {{- IfdefFuchsia -}} |
| |
| void {{ .WireTransactionalEvent }}::_InitHeader() { |
| ::fidl::InitTxnHeader(&header, 0, {{ .OrdinalName }}, {{ .DynamicFlagsName }}); |
| } |
| {{- EndifFuchsia -}} |
| {{- end }} |
| |
| |
| |
| {{- define "Method:Event:NaturalMessagingHeader" }} |
| {{- end }} |
| |
| |
| |
| {{- define "Method:Event:NaturalMessagingSource" }} |
| {{- end }} |
| |
| |
| |
| {{- define "Method:Event:Traits:TypeConversionsHeader" }} |
| {{- end }} |
| |
| |
| |
| {{- define "Method:Event:Traits:TypeConversionsSource" }} |
| {{- end }} |