| {{/* | |
| // 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 "" }} | |
| template<> | |
| struct {{ .WireTransactionalEvent }} final { | |
| FIDL_ALIGNDECL | |
| fidl_message_header_t header; | |
| {{ if .ResponseArgs }} | |
| {{ .WireEvent }} body; | |
| explicit {{ .WireTransactionalEvent.Self }}({{ RenderParams .ResponseArgs }}); | |
| {{- end }} | |
| {{ .WireTransactionalEvent.Self }}(); | |
| {{- if .Response.IsResource }} | |
| void _CloseHandles(); | |
| {{- end }} | |
| }; | |
| template <bool IsRecursive> | |
| struct ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive> | |
| : public WireStructCodingTraitsBase<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive> { | |
| static constexpr size_t kInlineSize = {{ .Response.TypeShapeV2.InlineSize }} + sizeof(fidl_message_header_t); | |
| static void Encode( | |
| internal::WireEncoder* encoder, {{ .WireTransactionalEvent }}* value, ::fidl::internal::WirePosition position, RecursionDepth<IsRecursive> recursion_depth); | |
| static void Decode( | |
| internal::WireDecoder* decoder, ::fidl::internal::WirePosition position, RecursionDepth<IsRecursive> recursion_depth); | |
| }; | |
| {{- end }} | |
| {{- define "Method:Event:WireMessagingSource" }} | |
| {{- EnsureNamespace "" }} | |
| {{ if .ResponseArgs }} | |
| {{ .WireTransactionalEvent }}::{{ .WireTransactionalEvent.Self }}({{ RenderParams .ResponseArgs }}) | |
| : body{ {{ RenderForwardParams .ResponseArgs }} } { | |
| ::fidl::InitTxnHeader(&header, 0, {{ .OrdinalName }}, {{ .DynamicFlagsName }}); | |
| } | |
| {{- end }} | |
| {{ .WireTransactionalEvent }}::{{ .WireTransactionalEvent.Self }}() { | |
| ::fidl::InitTxnHeader(&header, 0, {{ .OrdinalName }}, {{ .DynamicFlagsName }}); | |
| } | |
| {{- if .Response.IsResource }} | |
| void {{ .WireTransactionalEvent }}::_CloseHandles() { | |
| {{- if .ResponseArgs }} | |
| body._CloseHandles(); | |
| {{- end }} | |
| } | |
| {{- end }} | |
| template <bool IsRecursive> | |
| void ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive>::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 }} | |
| } | |
| template <bool IsRecursive> | |
| void ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, IsRecursive>::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 }} | |
| } | |
| template struct ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, true>; | |
| template struct ::fidl::internal::WireCodingTraits<{{ .WireTransactionalEvent }}, ::fidl::internal::WireCodingConstraintEmpty, false>; | |
| {{- end }} | |
| {{- define "Method:Event:NaturalMessagingHeader" }} | |
| {{- end }} | |
| {{- define "Method:Event:NaturalMessagingSource" }} | |
| {{- end }} | |
| {{- define "Method:Event:Traits:TypeConversionsHeader" }} | |
| {{- end }} | |
| {{- define "Method:Event:Traits:TypeConversionsSource" }} | |
| {{- end }} |