| {{/* |
| // Copyright 2020 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 "Protocol:ClientImpl:WireMessagingHeader" }} |
| {{- IfdefFuchsia -}} |
| {{- EnsureNamespace "" }} |
| template<> |
| class {{ .WireWeakOnewayClientImpl }} : public ::fidl::internal::ClientImplBase { |
| public: |
| using ClientImplBase::ClientImplBase; |
| |
| {{- range .OneWayMethods }} |
| {{- template "Method:WireWeakOnewayClientImpl:WireMessagingHeader" . }} |
| {{- end }} |
| }; |
| |
| template<> |
| class {{ .WireWeakAsyncClientImpl }} final : public {{ .WireWeakOnewayClientImpl }} { |
| public: |
| using {{ .WireWeakOnewayClientImpl.Self }}::{{ .WireWeakOnewayClientImpl.Self }}; |
| |
| {{- range .TwoWayMethods }} |
| {{- template "Method:WireWeakAsyncClientImpl:WireMessagingHeader" . }} |
| {{- end }} |
| }; |
| |
| template<> |
| class {{ .WireWeakOnewayBufferClientImpl }} : public ::fidl::internal::BufferClientImplBase { |
| public: |
| using BufferClientImplBase::BufferClientImplBase; |
| |
| {{- range .OneWayMethods }} |
| {{- template "Method:ClientImplOnewayBuffer:WireMessagingHeader" . }} |
| {{- end }} |
| }; |
| |
| template<> |
| class {{ .WireWeakAsyncBufferClientImpl }} final : public {{ .WireWeakOnewayBufferClientImpl }} { |
| public: |
| using {{ .WireWeakOnewayBufferClientImpl.Self }}::{{ .WireWeakOnewayBufferClientImpl.Self }}; |
| |
| {{- range .TwoWayMethods }} |
| {{- template "Method:ClientImplAsyncBuffer:WireMessagingHeader" . }} |
| {{- end }} |
| }; |
| |
| {{- if .Transport.HasSyncClient }} |
| template<> |
| class {{ .WireWeakSyncClientImpl }} final : public {{ .WireWeakOnewayClientImpl }} { |
| public: |
| using {{ .WireWeakOnewayClientImpl.Self }}::{{ .WireWeakOnewayClientImpl.Self }}; |
| |
| {{- range .TwoWayMethods }} |
| {{- template "Method:WireWeakSyncClientImpl:WireMessagingHeader" . }} |
| {{- end }} |
| }; |
| {{- end }} |
| |
| {{- EndifFuchsia -}} |
| {{- end }} |
| |
| |
| |
| {{- define "Protocol:ClientImpl:WireMessagingSource" }} |
| {{ EnsureNamespace ""}} |
| {{- IfdefFuchsia -}} |
| |
| {{- range .OneWayMethods }} |
| {{- template "Method:WireWeakOnewayClientImpl:WireMessagingSource" . }} |
| {{- end }} |
| {{- range .TwoWayMethods }} |
| {{- template "Method:WireWeakAsyncClientImpl:WireMessagingSource" . }} |
| {{- end }} |
| {{- range .OneWayMethods }} |
| {{- template "Method:ClientImplOnewayBuffer:WireMessagingSource" . }} |
| {{- end }} |
| {{- range .TwoWayMethods }} |
| {{- template "Method:ClientImplAsyncBuffer:WireMessagingSource" . }} |
| {{- end }} |
| |
| {{- if .Transport.HasSyncClient }} |
| {{- range .TwoWayMethods }} |
| {{- template "Method:WireWeakSyncClientImpl:WireMessagingSource" . }} |
| {{- end }} |
| {{- end }} |
| |
| {{- EndifFuchsia -}} |
| {{- end }} |
| |
| |
| |
| {{- define "Protocol:Client:NaturalMessagingHeader" }} |
| {{- IfdefFuchsia -}} |
| |
| {{- range .Events }} |
| {{- template "Method:Event:NaturalMessagingHeader" . }} |
| {{- end }} |
| |
| {{- range .TwoWayMethods }} |
| |
| {{- template "Method:Response:NaturalMessagingHeader" . }} |
| |
| {{- EnsureNamespace "" }} |
| template <> |
| class {{ .NaturalResult }} final : public {{ .NaturalResultBase }} { |
| public: |
| using {{ .NaturalResultBase }}::result; |
| |
| protected: |
| {{ .NaturalResult.Self }}() = default; |
| }; |
| {{ end }} |
| |
| {{- EnsureNamespace "" }} |
| template<> |
| class {{ .NaturalClientImpl }} final : public ::fidl::internal::NaturalClientBase { |
| public: |
| using NaturalClientBase::NaturalClientBase; |
| |
| {{- range .TwoWayMethods }} |
| {{- .Docs }} |
| {{ .NaturalThenable }} {{ .Name }}({{ .NaturalRequestArg "request" }}) const; |
| {{ "" }} |
| {{- end }} |
| |
| {{- range .OneWayMethods }} |
| {{- .Docs }} |
| ::fitx::result<::fidl::Error> {{ .Name }}({{ .NaturalRequestArg "request" }}) const; |
| {{ "" }} |
| {{- end }} |
| }; |
| |
| {{- EndifFuchsia -}} |
| {{- end }} |
| |
| |
| |
| {{- define "Protocol:Client:NaturalMessagingSource" }} |
| {{- IfdefFuchsia }} |
| |
| {{- range .Events }} |
| {{- template "Method:Event:NaturalMessagingSource" . }} |
| {{- end }} |
| |
| {{- range .TwoWayMethods }} |
| |
| {{- template "Method:Response:NaturalMessagingSource" . }} |
| |
| {{- EnsureNamespace "" }} |
| {{ .NaturalThenable }} |
| {{ $.NaturalClientImpl.NoLeading }}::{{ .Name }}({{ .NaturalRequestArg "request" }}) const { |
| ::fidl::internal::NaturalMessageEncoder _encoder{ |
| &::fidl::internal::ChannelTransport::VTable, {{ .OrdinalName }}, {{ .DynamicFlagsName }} }; |
| {{- if .HasRequestPayload }} |
| _encoder.EncodeBody( |
| {{ .NaturalRequestConverter }}::IntoDomainObject(std::move(request))); |
| {{- end }} |
| return {{ .NaturalThenable }}( |
| &client_base(), {}, std::move(_encoder), |
| [] ( |
| ::fidl::internal::ThenableBase* base, |
| ::fidl::internal::NaturalMessageEncoder& encoder, |
| ::fidl::internal::ResponseContext* response_context |
| ) { |
| ::fidl::OutgoingMessage msg = encoder.GetMessage(); |
| return base->SendTwoWay(msg, response_context); |
| }); |
| } |
| |
| {{ end }} |
| |
| {{- range .OneWayMethods }} |
| |
| {{- EnsureNamespace "" }} |
| ::fitx::result<::fidl::Error> |
| {{ $.NaturalClientImpl.NoLeading }}::{{ .Name }}({{ .NaturalRequestArg "request" }}) const { |
| ::fidl::internal::NaturalMessageEncoder _encoder{ |
| &::fidl::internal::ChannelTransport::VTable, {{ .OrdinalName }}, {{ .DynamicFlagsName }} }; |
| {{- if .HasRequestPayload }} |
| _encoder.EncodeBody( |
| {{ .NaturalRequestConverter }}::IntoDomainObject(std::move(request))); |
| {{ end }} |
| ::fidl::OutgoingMessage _encoded_message = _encoder.GetMessage(); |
| ::fidl::Status status = client_base().SendOneWay(_encoded_message); |
| return ::fidl::internal::ToFitxResult(status); |
| } |
| {{ end }} |
| |
| |
| |
| {{- EndifFuchsia }} |
| {{- end }} |