1 /**
2  * Autogenerated by Thrift for src/module.thrift
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated @nocommit
6  */
7 
8 #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service1AsyncClient.h"
9 
10 #include <thrift/lib/cpp2/gen/client_cpp.h>
11 
12 namespace test_cpp2 { namespace cpp_reflection {
13 typedef apache::thrift::ThriftPresult<false> service1_method1_pargs;
14 typedef apache::thrift::ThriftPresult<true> service1_method1_presult;
15 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int32_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service1_method2_pargs;
16 typedef apache::thrift::ThriftPresult<true> service1_method2_presult;
17 typedef apache::thrift::ThriftPresult<false> service1_method3_pargs;
18 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, ::std::int32_t*>> service1_method3_presult;
19 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int32_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service1_method4_pargs;
20 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, ::std::int32_t*>> service1_method4_presult;
21 typedef apache::thrift::ThriftPresult<false> service1_method5_pargs;
22 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct2*>> service1_method5_presult;
23 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int32_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service1_method6_pargs;
24 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct2*>> service1_method6_presult;
25 
26 template <typename Protocol_, typename RpcOptions>
method1T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback)27 void service1AsyncClient::method1T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
28 
29   service1_method1_pargs args;
30   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
31   auto writer = [&](Protocol_* p) { args.write(p); };
32 
33   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
34         new ::apache::thrift::MethodMetadata::Data(
35                 "method1",
36                 ::apache::thrift::FunctionQualifier::Unspecified);
37   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
38 }
39 
40 template <typename Protocol_, typename RpcOptions>
method2T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)41 void service1AsyncClient::method2T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
42 
43   service1_method2_pargs args;
44   args.get<0>().value = &p_x;
45   args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_y);
46   args.get<2>().value = &p_z;
47   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
48   auto writer = [&](Protocol_* p) { args.write(p); };
49 
50   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
51         new ::apache::thrift::MethodMetadata::Data(
52                 "method2",
53                 ::apache::thrift::FunctionQualifier::Unspecified);
54   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
55 }
56 
57 template <typename Protocol_, typename RpcOptions>
method3T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback)58 void service1AsyncClient::method3T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
59 
60   service1_method3_pargs args;
61   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
62   auto writer = [&](Protocol_* p) { args.write(p); };
63 
64   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
65         new ::apache::thrift::MethodMetadata::Data(
66                 "method3",
67                 ::apache::thrift::FunctionQualifier::Unspecified);
68   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
69 }
70 
71 template <typename Protocol_, typename RpcOptions>
method4T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)72 void service1AsyncClient::method4T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
73 
74   service1_method4_pargs args;
75   args.get<0>().value = &p_i;
76   args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_j);
77   args.get<2>().value = &p_k;
78   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
79   auto writer = [&](Protocol_* p) { args.write(p); };
80 
81   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
82         new ::apache::thrift::MethodMetadata::Data(
83                 "method4",
84                 ::apache::thrift::FunctionQualifier::Unspecified);
85   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
86 }
87 
88 template <typename Protocol_, typename RpcOptions>
method5T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback)89 void service1AsyncClient::method5T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
90 
91   service1_method5_pargs args;
92   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
93   auto writer = [&](Protocol_* p) { args.write(p); };
94 
95   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
96         new ::apache::thrift::MethodMetadata::Data(
97                 "method5",
98                 ::apache::thrift::FunctionQualifier::Unspecified);
99   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
100 }
101 
102 template <typename Protocol_, typename RpcOptions>
method6T(Protocol_ * prot,RpcOptions && rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)103 void service1AsyncClient::method6T(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
104 
105   service1_method6_pargs args;
106   args.get<0>().value = &p_l;
107   args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_m);
108   args.get<2>().value = &p_n;
109   auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
110   auto writer = [&](Protocol_* p) { args.write(p); };
111 
112   static ::apache::thrift::MethodMetadata::Data* methodMetadata =
113         new ::apache::thrift::MethodMetadata::Data(
114                 "method6",
115                 ::apache::thrift::FunctionQualifier::Unspecified);
116   apache::thrift::clientSendT<apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, Protocol_>(prot, std::forward<RpcOptions>(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer);
117 }
118 
119 
120 
method1(std::unique_ptr<apache::thrift::RequestCallback> callback)121 void service1AsyncClient::method1(std::unique_ptr<apache::thrift::RequestCallback> callback) {
122   ::apache::thrift::RpcOptions rpcOptions;
123   method1(rpcOptions, std::move(callback));
124 }
125 
method1(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback)126 void service1AsyncClient::method1(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
127   auto [ctx, header] = method1Ctx(&rpcOptions);
128   apache::thrift::RequestCallback::Context callbackContext;
129   callbackContext.protocolId =
130       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
131   auto* contextStack = ctx.get();
132   if (callback) {
133     callbackContext.ctx = std::move(ctx);
134   }
135   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
136   method1Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
137 }
138 
method1Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,bool stealRpcOptions)139 void service1AsyncClient::method1Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) {
140   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
141     case apache::thrift::protocol::T_BINARY_PROTOCOL:
142     {
143       apache::thrift::BinaryProtocolWriter writer;
144       if (stealRpcOptions) {
145         method1T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
146       } else {
147         method1T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
148       }
149       break;
150     }
151     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
152     {
153       apache::thrift::CompactProtocolWriter writer;
154       if (stealRpcOptions) {
155         method1T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
156       } else {
157         method1T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
158       }
159       break;
160     }
161     default:
162     {
163       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
164     }
165   }
166 }
167 
method1Ctx(apache::thrift::RpcOptions * rpcOptions)168 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method1Ctx(apache::thrift::RpcOptions* rpcOptions) {
169   auto header = std::make_shared<apache::thrift::transport::THeader>(
170       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
171   header->setProtocolId(channel_->getProtocolId());
172   if (rpcOptions) {
173     header->setHeaders(rpcOptions->releaseWriteHeaders());
174   }
175 
176   auto ctx = apache::thrift::ContextStack::createWithClientContext(
177       handlers_,
178       getServiceName(),
179       "service1.method1",
180       *header);
181 
182   return {std::move(ctx), std::move(header)};
183 }
184 
sync_method1()185 void service1AsyncClient::sync_method1() {
186   ::apache::thrift::RpcOptions rpcOptions;
187   sync_method1(rpcOptions);
188 }
189 
sync_method1(apache::thrift::RpcOptions & rpcOptions)190 void service1AsyncClient::sync_method1(apache::thrift::RpcOptions& rpcOptions) {
191   apache::thrift::ClientReceiveState returnState;
192   apache::thrift::ClientSyncCallback<false> callback(&returnState);
193   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
194   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
195   auto ctxAndHeader = method1Ctx(&rpcOptions);
196   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
197   callback.waitUntilDone(
198     evb,
199     [&] {
200       method1Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
201     });
202 
203   if (returnState.isException()) {
204     returnState.exception().throw_exception();
205   }
206   returnState.resetProtocolId(protocolId);
207   returnState.resetCtx(std::move(ctxAndHeader.first));
208   SCOPE_EXIT {
209     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
210       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
211     }
212   };
213   return folly::fibers::runInMainContext([&] {
214       recv_method1(returnState);
215   });
216 }
217 
218 
future_method1()219 folly::Future<folly::Unit> service1AsyncClient::future_method1() {
220   ::apache::thrift::RpcOptions rpcOptions;
221   return future_method1(rpcOptions);
222 }
223 
semifuture_method1()224 folly::SemiFuture<folly::Unit> service1AsyncClient::semifuture_method1() {
225   ::apache::thrift::RpcOptions rpcOptions;
226   return semifuture_method1(rpcOptions);
227 }
228 
future_method1(apache::thrift::RpcOptions & rpcOptions)229 folly::Future<folly::Unit> service1AsyncClient::future_method1(apache::thrift::RpcOptions& rpcOptions) {
230   folly::Promise<folly::Unit> promise;
231   auto future = promise.getFuture();
232   auto callback = std::make_unique<apache::thrift::FutureCallback<folly::Unit>>(std::move(promise), recv_wrapped_method1, channel_);
233   method1(rpcOptions, std::move(callback));
234   return future;
235 }
236 
semifuture_method1(apache::thrift::RpcOptions & rpcOptions)237 folly::SemiFuture<folly::Unit> service1AsyncClient::semifuture_method1(apache::thrift::RpcOptions& rpcOptions) {
238   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method1, channel_);
239   auto callback = std::move(callbackAndFuture.first);
240   method1(rpcOptions, std::move(callback));
241   return std::move(callbackAndFuture.second);
242 }
243 
header_future_method1(apache::thrift::RpcOptions & rpcOptions)244 folly::Future<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method1(apache::thrift::RpcOptions& rpcOptions) {
245   folly::Promise<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
246   auto future = promise.getFuture();
247   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<folly::Unit>>(std::move(promise), recv_wrapped_method1, channel_);
248   method1(rpcOptions, std::move(callback));
249   return future;
250 }
251 
header_semifuture_method1(apache::thrift::RpcOptions & rpcOptions)252 folly::SemiFuture<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method1(apache::thrift::RpcOptions& rpcOptions) {
253   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method1, channel_);
254   auto callback = std::move(callbackAndFuture.first);
255   method1(rpcOptions, std::move(callback));
256   return std::move(callbackAndFuture.second);
257 }
258 
method1(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback)259 void service1AsyncClient::method1(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
260   method1(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
261 }
262 
263 #if FOLLY_HAS_COROUTINES
264 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method1(::apache::thrift::ClientReceiveState & state)265 folly::exception_wrapper service1AsyncClient::recv_wrapped_method1(::apache::thrift::ClientReceiveState& state) {
266   if (state.isException()) {
267     return std::move(state.exception());
268   }
269   if (!state.hasResponseBuffer()) {
270     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
271   }
272 
273   using result = service1_method1_presult;
274   switch (state.protocolId()) {
275     case apache::thrift::protocol::T_BINARY_PROTOCOL:
276     {
277       apache::thrift::BinaryProtocolReader reader;
278       return apache::thrift::detail::ac::recv_wrapped<result>(
279           &reader, state);
280     }
281     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
282     {
283       apache::thrift::CompactProtocolReader reader;
284       return apache::thrift::detail::ac::recv_wrapped<result>(
285           &reader, state);
286     }
287     default:
288     {
289     }
290   }
291   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
292 }
293 
recv_method1(::apache::thrift::ClientReceiveState & state)294 void service1AsyncClient::recv_method1(::apache::thrift::ClientReceiveState& state) {
295   auto ew = recv_wrapped_method1(state);
296   if (ew) {
297     ew.throw_exception();
298   }
299 }
300 
recv_instance_method1(::apache::thrift::ClientReceiveState & state)301 void service1AsyncClient::recv_instance_method1(::apache::thrift::ClientReceiveState& state) {
302   recv_method1(state);
303 }
304 
recv_instance_wrapped_method1(::apache::thrift::ClientReceiveState & state)305 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method1(::apache::thrift::ClientReceiveState& state) {
306   return recv_wrapped_method1(state);
307 }
308 
method2(std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)309 void service1AsyncClient::method2(std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
310   ::apache::thrift::RpcOptions rpcOptions;
311   method2(rpcOptions, std::move(callback), p_x, p_y, p_z);
312 }
313 
method2(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)314 void service1AsyncClient::method2(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
315   auto [ctx, header] = method2Ctx(&rpcOptions);
316   apache::thrift::RequestCallback::Context callbackContext;
317   callbackContext.protocolId =
318       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
319   auto* contextStack = ctx.get();
320   if (callback) {
321     callbackContext.ctx = std::move(ctx);
322   }
323   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
324   method2Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_x, p_y, p_z);
325 }
326 
method2Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z,bool stealRpcOptions)327 void service1AsyncClient::method2Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z, bool stealRpcOptions) {
328   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
329     case apache::thrift::protocol::T_BINARY_PROTOCOL:
330     {
331       apache::thrift::BinaryProtocolWriter writer;
332       if (stealRpcOptions) {
333         method2T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
334       } else {
335         method2T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
336       }
337       break;
338     }
339     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
340     {
341       apache::thrift::CompactProtocolWriter writer;
342       if (stealRpcOptions) {
343         method2T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
344       } else {
345         method2T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
346       }
347       break;
348     }
349     default:
350     {
351       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
352     }
353   }
354 }
355 
method2Ctx(apache::thrift::RpcOptions * rpcOptions)356 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method2Ctx(apache::thrift::RpcOptions* rpcOptions) {
357   auto header = std::make_shared<apache::thrift::transport::THeader>(
358       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
359   header->setProtocolId(channel_->getProtocolId());
360   if (rpcOptions) {
361     header->setHeaders(rpcOptions->releaseWriteHeaders());
362   }
363 
364   auto ctx = apache::thrift::ContextStack::createWithClientContext(
365       handlers_,
366       getServiceName(),
367       "service1.method2",
368       *header);
369 
370   return {std::move(ctx), std::move(header)};
371 }
372 
sync_method2(::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)373 void service1AsyncClient::sync_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
374   ::apache::thrift::RpcOptions rpcOptions;
375   sync_method2(rpcOptions, p_x, p_y, p_z);
376 }
377 
sync_method2(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)378 void service1AsyncClient::sync_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
379   apache::thrift::ClientReceiveState returnState;
380   apache::thrift::ClientSyncCallback<false> callback(&returnState);
381   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
382   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
383   auto ctxAndHeader = method2Ctx(&rpcOptions);
384   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
385   callback.waitUntilDone(
386     evb,
387     [&] {
388       method2Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_x, p_y, p_z);
389     });
390 
391   if (returnState.isException()) {
392     returnState.exception().throw_exception();
393   }
394   returnState.resetProtocolId(protocolId);
395   returnState.resetCtx(std::move(ctxAndHeader.first));
396   SCOPE_EXIT {
397     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
398       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
399     }
400   };
401   return folly::fibers::runInMainContext([&] {
402       recv_method2(returnState);
403   });
404 }
405 
406 
future_method2(::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)407 folly::Future<folly::Unit> service1AsyncClient::future_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
408   ::apache::thrift::RpcOptions rpcOptions;
409   return future_method2(rpcOptions, p_x, p_y, p_z);
410 }
411 
semifuture_method2(::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)412 folly::SemiFuture<folly::Unit> service1AsyncClient::semifuture_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
413   ::apache::thrift::RpcOptions rpcOptions;
414   return semifuture_method2(rpcOptions, p_x, p_y, p_z);
415 }
416 
future_method2(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)417 folly::Future<folly::Unit> service1AsyncClient::future_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
418   folly::Promise<folly::Unit> promise;
419   auto future = promise.getFuture();
420   auto callback = std::make_unique<apache::thrift::FutureCallback<folly::Unit>>(std::move(promise), recv_wrapped_method2, channel_);
421   method2(rpcOptions, std::move(callback), p_x, p_y, p_z);
422   return future;
423 }
424 
semifuture_method2(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)425 folly::SemiFuture<folly::Unit> service1AsyncClient::semifuture_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
426   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method2, channel_);
427   auto callback = std::move(callbackAndFuture.first);
428   method2(rpcOptions, std::move(callback), p_x, p_y, p_z);
429   return std::move(callbackAndFuture.second);
430 }
431 
header_future_method2(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)432 folly::Future<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
433   folly::Promise<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
434   auto future = promise.getFuture();
435   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<folly::Unit>>(std::move(promise), recv_wrapped_method2, channel_);
436   method2(rpcOptions, std::move(callback), p_x, p_y, p_z);
437   return future;
438 }
439 
header_semifuture_method2(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)440 folly::SemiFuture<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
441   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method2, channel_);
442   auto callback = std::move(callbackAndFuture.first);
443   method2(rpcOptions, std::move(callback), p_x, p_y, p_z);
444   return std::move(callbackAndFuture.second);
445 }
446 
method2(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback,::std::int32_t p_x,const::test_cpp2::cpp_reflection::struct1 & p_y,double p_z)447 void service1AsyncClient::method2(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
448   method2(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_x, p_y, p_z);
449 }
450 
451 #if FOLLY_HAS_COROUTINES
452 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method2(::apache::thrift::ClientReceiveState & state)453 folly::exception_wrapper service1AsyncClient::recv_wrapped_method2(::apache::thrift::ClientReceiveState& state) {
454   if (state.isException()) {
455     return std::move(state.exception());
456   }
457   if (!state.hasResponseBuffer()) {
458     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
459   }
460 
461   using result = service1_method2_presult;
462   switch (state.protocolId()) {
463     case apache::thrift::protocol::T_BINARY_PROTOCOL:
464     {
465       apache::thrift::BinaryProtocolReader reader;
466       return apache::thrift::detail::ac::recv_wrapped<result>(
467           &reader, state);
468     }
469     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
470     {
471       apache::thrift::CompactProtocolReader reader;
472       return apache::thrift::detail::ac::recv_wrapped<result>(
473           &reader, state);
474     }
475     default:
476     {
477     }
478   }
479   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
480 }
481 
recv_method2(::apache::thrift::ClientReceiveState & state)482 void service1AsyncClient::recv_method2(::apache::thrift::ClientReceiveState& state) {
483   auto ew = recv_wrapped_method2(state);
484   if (ew) {
485     ew.throw_exception();
486   }
487 }
488 
recv_instance_method2(::apache::thrift::ClientReceiveState & state)489 void service1AsyncClient::recv_instance_method2(::apache::thrift::ClientReceiveState& state) {
490   recv_method2(state);
491 }
492 
recv_instance_wrapped_method2(::apache::thrift::ClientReceiveState & state)493 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method2(::apache::thrift::ClientReceiveState& state) {
494   return recv_wrapped_method2(state);
495 }
496 
method3(std::unique_ptr<apache::thrift::RequestCallback> callback)497 void service1AsyncClient::method3(std::unique_ptr<apache::thrift::RequestCallback> callback) {
498   ::apache::thrift::RpcOptions rpcOptions;
499   method3(rpcOptions, std::move(callback));
500 }
501 
method3(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback)502 void service1AsyncClient::method3(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
503   auto [ctx, header] = method3Ctx(&rpcOptions);
504   apache::thrift::RequestCallback::Context callbackContext;
505   callbackContext.protocolId =
506       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
507   auto* contextStack = ctx.get();
508   if (callback) {
509     callbackContext.ctx = std::move(ctx);
510   }
511   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
512   method3Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
513 }
514 
method3Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,bool stealRpcOptions)515 void service1AsyncClient::method3Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) {
516   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
517     case apache::thrift::protocol::T_BINARY_PROTOCOL:
518     {
519       apache::thrift::BinaryProtocolWriter writer;
520       if (stealRpcOptions) {
521         method3T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
522       } else {
523         method3T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
524       }
525       break;
526     }
527     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
528     {
529       apache::thrift::CompactProtocolWriter writer;
530       if (stealRpcOptions) {
531         method3T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
532       } else {
533         method3T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
534       }
535       break;
536     }
537     default:
538     {
539       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
540     }
541   }
542 }
543 
method3Ctx(apache::thrift::RpcOptions * rpcOptions)544 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method3Ctx(apache::thrift::RpcOptions* rpcOptions) {
545   auto header = std::make_shared<apache::thrift::transport::THeader>(
546       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
547   header->setProtocolId(channel_->getProtocolId());
548   if (rpcOptions) {
549     header->setHeaders(rpcOptions->releaseWriteHeaders());
550   }
551 
552   auto ctx = apache::thrift::ContextStack::createWithClientContext(
553       handlers_,
554       getServiceName(),
555       "service1.method3",
556       *header);
557 
558   return {std::move(ctx), std::move(header)};
559 }
560 
sync_method3()561 ::std::int32_t service1AsyncClient::sync_method3() {
562   ::apache::thrift::RpcOptions rpcOptions;
563   return sync_method3(rpcOptions);
564 }
565 
sync_method3(apache::thrift::RpcOptions & rpcOptions)566 ::std::int32_t service1AsyncClient::sync_method3(apache::thrift::RpcOptions& rpcOptions) {
567   apache::thrift::ClientReceiveState returnState;
568   apache::thrift::ClientSyncCallback<false> callback(&returnState);
569   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
570   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
571   auto ctxAndHeader = method3Ctx(&rpcOptions);
572   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
573   callback.waitUntilDone(
574     evb,
575     [&] {
576       method3Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
577     });
578 
579   if (returnState.isException()) {
580     returnState.exception().throw_exception();
581   }
582   returnState.resetProtocolId(protocolId);
583   returnState.resetCtx(std::move(ctxAndHeader.first));
584   SCOPE_EXIT {
585     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
586       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
587     }
588   };
589   return folly::fibers::runInMainContext([&] {
590       return recv_method3(returnState);
591   });
592 }
593 
594 
future_method3()595 folly::Future<::std::int32_t> service1AsyncClient::future_method3() {
596   ::apache::thrift::RpcOptions rpcOptions;
597   return future_method3(rpcOptions);
598 }
599 
semifuture_method3()600 folly::SemiFuture<::std::int32_t> service1AsyncClient::semifuture_method3() {
601   ::apache::thrift::RpcOptions rpcOptions;
602   return semifuture_method3(rpcOptions);
603 }
604 
future_method3(apache::thrift::RpcOptions & rpcOptions)605 folly::Future<::std::int32_t> service1AsyncClient::future_method3(apache::thrift::RpcOptions& rpcOptions) {
606   folly::Promise<::std::int32_t> promise;
607   auto future = promise.getFuture();
608   auto callback = std::make_unique<apache::thrift::FutureCallback<::std::int32_t>>(std::move(promise), recv_wrapped_method3, channel_);
609   method3(rpcOptions, std::move(callback));
610   return future;
611 }
612 
semifuture_method3(apache::thrift::RpcOptions & rpcOptions)613 folly::SemiFuture<::std::int32_t> service1AsyncClient::semifuture_method3(apache::thrift::RpcOptions& rpcOptions) {
614   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method3, channel_);
615   auto callback = std::move(callbackAndFuture.first);
616   method3(rpcOptions, std::move(callback));
617   return std::move(callbackAndFuture.second);
618 }
619 
header_future_method3(apache::thrift::RpcOptions & rpcOptions)620 folly::Future<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method3(apache::thrift::RpcOptions& rpcOptions) {
621   folly::Promise<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
622   auto future = promise.getFuture();
623   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<::std::int32_t>>(std::move(promise), recv_wrapped_method3, channel_);
624   method3(rpcOptions, std::move(callback));
625   return future;
626 }
627 
header_semifuture_method3(apache::thrift::RpcOptions & rpcOptions)628 folly::SemiFuture<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method3(apache::thrift::RpcOptions& rpcOptions) {
629   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method3, channel_);
630   auto callback = std::move(callbackAndFuture.first);
631   method3(rpcOptions, std::move(callback));
632   return std::move(callbackAndFuture.second);
633 }
634 
method3(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback)635 void service1AsyncClient::method3(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
636   method3(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
637 }
638 
639 #if FOLLY_HAS_COROUTINES
640 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method3(::std::int32_t & _return,::apache::thrift::ClientReceiveState & state)641 folly::exception_wrapper service1AsyncClient::recv_wrapped_method3(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
642   if (state.isException()) {
643     return std::move(state.exception());
644   }
645   if (!state.hasResponseBuffer()) {
646     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
647   }
648 
649   using result = service1_method3_presult;
650   switch (state.protocolId()) {
651     case apache::thrift::protocol::T_BINARY_PROTOCOL:
652     {
653       apache::thrift::BinaryProtocolReader reader;
654       return apache::thrift::detail::ac::recv_wrapped<result>(
655           &reader, state, _return);
656     }
657     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
658     {
659       apache::thrift::CompactProtocolReader reader;
660       return apache::thrift::detail::ac::recv_wrapped<result>(
661           &reader, state, _return);
662     }
663     default:
664     {
665     }
666   }
667   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
668 }
669 
recv_method3(::apache::thrift::ClientReceiveState & state)670 ::std::int32_t service1AsyncClient::recv_method3(::apache::thrift::ClientReceiveState& state) {
671   ::std::int32_t _return;
672   auto ew = recv_wrapped_method3(_return, state);
673   if (ew) {
674     ew.throw_exception();
675   }
676   return _return;
677 }
678 
recv_instance_method3(::apache::thrift::ClientReceiveState & state)679 ::std::int32_t service1AsyncClient::recv_instance_method3(::apache::thrift::ClientReceiveState& state) {
680   return recv_method3(state);
681 }
682 
recv_instance_wrapped_method3(::std::int32_t & _return,::apache::thrift::ClientReceiveState & state)683 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method3(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
684   return recv_wrapped_method3(_return, state);
685 }
686 
method4(std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)687 void service1AsyncClient::method4(std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
688   ::apache::thrift::RpcOptions rpcOptions;
689   method4(rpcOptions, std::move(callback), p_i, p_j, p_k);
690 }
691 
method4(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)692 void service1AsyncClient::method4(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
693   auto [ctx, header] = method4Ctx(&rpcOptions);
694   apache::thrift::RequestCallback::Context callbackContext;
695   callbackContext.protocolId =
696       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
697   auto* contextStack = ctx.get();
698   if (callback) {
699     callbackContext.ctx = std::move(ctx);
700   }
701   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
702   method4Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_i, p_j, p_k);
703 }
704 
method4Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k,bool stealRpcOptions)705 void service1AsyncClient::method4Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k, bool stealRpcOptions) {
706   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
707     case apache::thrift::protocol::T_BINARY_PROTOCOL:
708     {
709       apache::thrift::BinaryProtocolWriter writer;
710       if (stealRpcOptions) {
711         method4T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
712       } else {
713         method4T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
714       }
715       break;
716     }
717     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
718     {
719       apache::thrift::CompactProtocolWriter writer;
720       if (stealRpcOptions) {
721         method4T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
722       } else {
723         method4T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
724       }
725       break;
726     }
727     default:
728     {
729       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
730     }
731   }
732 }
733 
method4Ctx(apache::thrift::RpcOptions * rpcOptions)734 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method4Ctx(apache::thrift::RpcOptions* rpcOptions) {
735   auto header = std::make_shared<apache::thrift::transport::THeader>(
736       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
737   header->setProtocolId(channel_->getProtocolId());
738   if (rpcOptions) {
739     header->setHeaders(rpcOptions->releaseWriteHeaders());
740   }
741 
742   auto ctx = apache::thrift::ContextStack::createWithClientContext(
743       handlers_,
744       getServiceName(),
745       "service1.method4",
746       *header);
747 
748   return {std::move(ctx), std::move(header)};
749 }
750 
sync_method4(::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)751 ::std::int32_t service1AsyncClient::sync_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
752   ::apache::thrift::RpcOptions rpcOptions;
753   return sync_method4(rpcOptions, p_i, p_j, p_k);
754 }
755 
sync_method4(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)756 ::std::int32_t service1AsyncClient::sync_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
757   apache::thrift::ClientReceiveState returnState;
758   apache::thrift::ClientSyncCallback<false> callback(&returnState);
759   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
760   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
761   auto ctxAndHeader = method4Ctx(&rpcOptions);
762   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
763   callback.waitUntilDone(
764     evb,
765     [&] {
766       method4Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_i, p_j, p_k);
767     });
768 
769   if (returnState.isException()) {
770     returnState.exception().throw_exception();
771   }
772   returnState.resetProtocolId(protocolId);
773   returnState.resetCtx(std::move(ctxAndHeader.first));
774   SCOPE_EXIT {
775     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
776       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
777     }
778   };
779   return folly::fibers::runInMainContext([&] {
780       return recv_method4(returnState);
781   });
782 }
783 
784 
future_method4(::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)785 folly::Future<::std::int32_t> service1AsyncClient::future_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
786   ::apache::thrift::RpcOptions rpcOptions;
787   return future_method4(rpcOptions, p_i, p_j, p_k);
788 }
789 
semifuture_method4(::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)790 folly::SemiFuture<::std::int32_t> service1AsyncClient::semifuture_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
791   ::apache::thrift::RpcOptions rpcOptions;
792   return semifuture_method4(rpcOptions, p_i, p_j, p_k);
793 }
794 
future_method4(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)795 folly::Future<::std::int32_t> service1AsyncClient::future_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
796   folly::Promise<::std::int32_t> promise;
797   auto future = promise.getFuture();
798   auto callback = std::make_unique<apache::thrift::FutureCallback<::std::int32_t>>(std::move(promise), recv_wrapped_method4, channel_);
799   method4(rpcOptions, std::move(callback), p_i, p_j, p_k);
800   return future;
801 }
802 
semifuture_method4(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)803 folly::SemiFuture<::std::int32_t> service1AsyncClient::semifuture_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
804   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method4, channel_);
805   auto callback = std::move(callbackAndFuture.first);
806   method4(rpcOptions, std::move(callback), p_i, p_j, p_k);
807   return std::move(callbackAndFuture.second);
808 }
809 
header_future_method4(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)810 folly::Future<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
811   folly::Promise<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
812   auto future = promise.getFuture();
813   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<::std::int32_t>>(std::move(promise), recv_wrapped_method4, channel_);
814   method4(rpcOptions, std::move(callback), p_i, p_j, p_k);
815   return future;
816 }
817 
header_semifuture_method4(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)818 folly::SemiFuture<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
819   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method4, channel_);
820   auto callback = std::move(callbackAndFuture.first);
821   method4(rpcOptions, std::move(callback), p_i, p_j, p_k);
822   return std::move(callbackAndFuture.second);
823 }
824 
method4(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback,::std::int32_t p_i,const::test_cpp2::cpp_reflection::struct1 & p_j,double p_k)825 void service1AsyncClient::method4(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
826   method4(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_i, p_j, p_k);
827 }
828 
829 #if FOLLY_HAS_COROUTINES
830 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method4(::std::int32_t & _return,::apache::thrift::ClientReceiveState & state)831 folly::exception_wrapper service1AsyncClient::recv_wrapped_method4(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
832   if (state.isException()) {
833     return std::move(state.exception());
834   }
835   if (!state.hasResponseBuffer()) {
836     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
837   }
838 
839   using result = service1_method4_presult;
840   switch (state.protocolId()) {
841     case apache::thrift::protocol::T_BINARY_PROTOCOL:
842     {
843       apache::thrift::BinaryProtocolReader reader;
844       return apache::thrift::detail::ac::recv_wrapped<result>(
845           &reader, state, _return);
846     }
847     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
848     {
849       apache::thrift::CompactProtocolReader reader;
850       return apache::thrift::detail::ac::recv_wrapped<result>(
851           &reader, state, _return);
852     }
853     default:
854     {
855     }
856   }
857   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
858 }
859 
recv_method4(::apache::thrift::ClientReceiveState & state)860 ::std::int32_t service1AsyncClient::recv_method4(::apache::thrift::ClientReceiveState& state) {
861   ::std::int32_t _return;
862   auto ew = recv_wrapped_method4(_return, state);
863   if (ew) {
864     ew.throw_exception();
865   }
866   return _return;
867 }
868 
recv_instance_method4(::apache::thrift::ClientReceiveState & state)869 ::std::int32_t service1AsyncClient::recv_instance_method4(::apache::thrift::ClientReceiveState& state) {
870   return recv_method4(state);
871 }
872 
recv_instance_wrapped_method4(::std::int32_t & _return,::apache::thrift::ClientReceiveState & state)873 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method4(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
874   return recv_wrapped_method4(_return, state);
875 }
876 
method5(std::unique_ptr<apache::thrift::RequestCallback> callback)877 void service1AsyncClient::method5(std::unique_ptr<apache::thrift::RequestCallback> callback) {
878   ::apache::thrift::RpcOptions rpcOptions;
879   method5(rpcOptions, std::move(callback));
880 }
881 
method5(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback)882 void service1AsyncClient::method5(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
883   auto [ctx, header] = method5Ctx(&rpcOptions);
884   apache::thrift::RequestCallback::Context callbackContext;
885   callbackContext.protocolId =
886       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
887   auto* contextStack = ctx.get();
888   if (callback) {
889     callbackContext.ctx = std::move(ctx);
890   }
891   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
892   method5Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
893 }
894 
method5Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,bool stealRpcOptions)895 void service1AsyncClient::method5Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) {
896   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
897     case apache::thrift::protocol::T_BINARY_PROTOCOL:
898     {
899       apache::thrift::BinaryProtocolWriter writer;
900       if (stealRpcOptions) {
901         method5T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
902       } else {
903         method5T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
904       }
905       break;
906     }
907     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
908     {
909       apache::thrift::CompactProtocolWriter writer;
910       if (stealRpcOptions) {
911         method5T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
912       } else {
913         method5T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
914       }
915       break;
916     }
917     default:
918     {
919       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
920     }
921   }
922 }
923 
method5Ctx(apache::thrift::RpcOptions * rpcOptions)924 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method5Ctx(apache::thrift::RpcOptions* rpcOptions) {
925   auto header = std::make_shared<apache::thrift::transport::THeader>(
926       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
927   header->setProtocolId(channel_->getProtocolId());
928   if (rpcOptions) {
929     header->setHeaders(rpcOptions->releaseWriteHeaders());
930   }
931 
932   auto ctx = apache::thrift::ContextStack::createWithClientContext(
933       handlers_,
934       getServiceName(),
935       "service1.method5",
936       *header);
937 
938   return {std::move(ctx), std::move(header)};
939 }
940 
sync_method5(::test_cpp2::cpp_reflection::struct2 & _return)941 void service1AsyncClient::sync_method5(::test_cpp2::cpp_reflection::struct2& _return) {
942   ::apache::thrift::RpcOptions rpcOptions;
943   sync_method5(rpcOptions, _return);
944 }
945 
sync_method5(apache::thrift::RpcOptions & rpcOptions,::test_cpp2::cpp_reflection::struct2 & _return)946 void service1AsyncClient::sync_method5(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return) {
947   apache::thrift::ClientReceiveState returnState;
948   apache::thrift::ClientSyncCallback<false> callback(&returnState);
949   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
950   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
951   auto ctxAndHeader = method5Ctx(&rpcOptions);
952   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
953   callback.waitUntilDone(
954     evb,
955     [&] {
956       method5Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
957     });
958 
959   if (returnState.isException()) {
960     returnState.exception().throw_exception();
961   }
962   returnState.resetProtocolId(protocolId);
963   returnState.resetCtx(std::move(ctxAndHeader.first));
964   SCOPE_EXIT {
965     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
966       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
967     }
968   };
969   return folly::fibers::runInMainContext([&] {
970       recv_method5(_return, returnState);
971   });
972 }
973 
974 
future_method5()975 folly::Future<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::future_method5() {
976   ::apache::thrift::RpcOptions rpcOptions;
977   return future_method5(rpcOptions);
978 }
979 
semifuture_method5()980 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::semifuture_method5() {
981   ::apache::thrift::RpcOptions rpcOptions;
982   return semifuture_method5(rpcOptions);
983 }
984 
future_method5(apache::thrift::RpcOptions & rpcOptions)985 folly::Future<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::future_method5(apache::thrift::RpcOptions& rpcOptions) {
986   folly::Promise<::test_cpp2::cpp_reflection::struct2> promise;
987   auto future = promise.getFuture();
988   auto callback = std::make_unique<apache::thrift::FutureCallback<::test_cpp2::cpp_reflection::struct2>>(std::move(promise), recv_wrapped_method5, channel_);
989   method5(rpcOptions, std::move(callback));
990   return future;
991 }
992 
semifuture_method5(apache::thrift::RpcOptions & rpcOptions)993 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::semifuture_method5(apache::thrift::RpcOptions& rpcOptions) {
994   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method5, channel_);
995   auto callback = std::move(callbackAndFuture.first);
996   method5(rpcOptions, std::move(callback));
997   return std::move(callbackAndFuture.second);
998 }
999 
header_future_method5(apache::thrift::RpcOptions & rpcOptions)1000 folly::Future<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method5(apache::thrift::RpcOptions& rpcOptions) {
1001   folly::Promise<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
1002   auto future = promise.getFuture();
1003   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<::test_cpp2::cpp_reflection::struct2>>(std::move(promise), recv_wrapped_method5, channel_);
1004   method5(rpcOptions, std::move(callback));
1005   return future;
1006 }
1007 
header_semifuture_method5(apache::thrift::RpcOptions & rpcOptions)1008 folly::SemiFuture<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method5(apache::thrift::RpcOptions& rpcOptions) {
1009   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method5, channel_);
1010   auto callback = std::move(callbackAndFuture.first);
1011   method5(rpcOptions, std::move(callback));
1012   return std::move(callbackAndFuture.second);
1013 }
1014 
method5(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback)1015 void service1AsyncClient::method5(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
1016   method5(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
1017 }
1018 
1019 #if FOLLY_HAS_COROUTINES
1020 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method5(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1021 folly::exception_wrapper service1AsyncClient::recv_wrapped_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1022   if (state.isException()) {
1023     return std::move(state.exception());
1024   }
1025   if (!state.hasResponseBuffer()) {
1026     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
1027   }
1028 
1029   using result = service1_method5_presult;
1030   switch (state.protocolId()) {
1031     case apache::thrift::protocol::T_BINARY_PROTOCOL:
1032     {
1033       apache::thrift::BinaryProtocolReader reader;
1034       return apache::thrift::detail::ac::recv_wrapped<result>(
1035           &reader, state, _return);
1036     }
1037     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1038     {
1039       apache::thrift::CompactProtocolReader reader;
1040       return apache::thrift::detail::ac::recv_wrapped<result>(
1041           &reader, state, _return);
1042     }
1043     default:
1044     {
1045     }
1046   }
1047   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
1048 }
1049 
recv_method5(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1050 void service1AsyncClient::recv_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1051   auto ew = recv_wrapped_method5(_return, state);
1052   if (ew) {
1053     ew.throw_exception();
1054   }
1055 }
1056 
recv_instance_method5(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1057 void service1AsyncClient::recv_instance_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1058   return recv_method5(_return, state);
1059 }
1060 
recv_instance_wrapped_method5(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1061 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1062   return recv_wrapped_method5(_return, state);
1063 }
1064 
method6(std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1065 void service1AsyncClient::method6(std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1066   ::apache::thrift::RpcOptions rpcOptions;
1067   method6(rpcOptions, std::move(callback), p_l, p_m, p_n);
1068 }
1069 
method6(apache::thrift::RpcOptions & rpcOptions,std::unique_ptr<apache::thrift::RequestCallback> callback,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1070 void service1AsyncClient::method6(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1071   auto [ctx, header] = method6Ctx(&rpcOptions);
1072   apache::thrift::RequestCallback::Context callbackContext;
1073   callbackContext.protocolId =
1074       apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
1075   auto* contextStack = ctx.get();
1076   if (callback) {
1077     callbackContext.ctx = std::move(ctx);
1078   }
1079   auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
1080   method6Impl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_l, p_m, p_n);
1081 }
1082 
method6Impl(apache::thrift::RpcOptions & rpcOptions,std::shared_ptr<apache::thrift::transport::THeader> header,apache::thrift::ContextStack * contextStack,apache::thrift::RequestClientCallback::Ptr callback,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n,bool stealRpcOptions)1083 void service1AsyncClient::method6Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n, bool stealRpcOptions) {
1084   switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) {
1085     case apache::thrift::protocol::T_BINARY_PROTOCOL:
1086     {
1087       apache::thrift::BinaryProtocolWriter writer;
1088       if (stealRpcOptions) {
1089         method6T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1090       } else {
1091         method6T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1092       }
1093       break;
1094     }
1095     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1096     {
1097       apache::thrift::CompactProtocolWriter writer;
1098       if (stealRpcOptions) {
1099         method6T(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1100       } else {
1101         method6T(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1102       }
1103       break;
1104     }
1105     default:
1106     {
1107       apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
1108     }
1109   }
1110 }
1111 
method6Ctx(apache::thrift::RpcOptions * rpcOptions)1112 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> service1AsyncClient::method6Ctx(apache::thrift::RpcOptions* rpcOptions) {
1113   auto header = std::make_shared<apache::thrift::transport::THeader>(
1114       apache::thrift::transport::THeader::ALLOW_BIG_FRAMES);
1115   header->setProtocolId(channel_->getProtocolId());
1116   if (rpcOptions) {
1117     header->setHeaders(rpcOptions->releaseWriteHeaders());
1118   }
1119 
1120   auto ctx = apache::thrift::ContextStack::createWithClientContext(
1121       handlers_,
1122       getServiceName(),
1123       "service1.method6",
1124       *header);
1125 
1126   return {std::move(ctx), std::move(header)};
1127 }
1128 
sync_method6(::test_cpp2::cpp_reflection::struct2 & _return,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1129 void service1AsyncClient::sync_method6(::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1130   ::apache::thrift::RpcOptions rpcOptions;
1131   sync_method6(rpcOptions, _return, p_l, p_m, p_n);
1132 }
1133 
sync_method6(apache::thrift::RpcOptions & rpcOptions,::test_cpp2::cpp_reflection::struct2 & _return,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1134 void service1AsyncClient::sync_method6(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1135   apache::thrift::ClientReceiveState returnState;
1136   apache::thrift::ClientSyncCallback<false> callback(&returnState);
1137   auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
1138   auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase();
1139   auto ctxAndHeader = method6Ctx(&rpcOptions);
1140   auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
1141   callback.waitUntilDone(
1142     evb,
1143     [&] {
1144       method6Impl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_l, p_m, p_n);
1145     });
1146 
1147   if (returnState.isException()) {
1148     returnState.exception().throw_exception();
1149   }
1150   returnState.resetProtocolId(protocolId);
1151   returnState.resetCtx(std::move(ctxAndHeader.first));
1152   SCOPE_EXIT {
1153     if (returnState.header() && !returnState.header()->getHeaders().empty()) {
1154       rpcOptions.setReadHeaders(returnState.header()->releaseHeaders());
1155     }
1156   };
1157   return folly::fibers::runInMainContext([&] {
1158       recv_method6(_return, returnState);
1159   });
1160 }
1161 
1162 
future_method6(::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1163 folly::Future<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::future_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1164   ::apache::thrift::RpcOptions rpcOptions;
1165   return future_method6(rpcOptions, p_l, p_m, p_n);
1166 }
1167 
semifuture_method6(::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1168 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::semifuture_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1169   ::apache::thrift::RpcOptions rpcOptions;
1170   return semifuture_method6(rpcOptions, p_l, p_m, p_n);
1171 }
1172 
future_method6(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1173 folly::Future<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::future_method6(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1174   folly::Promise<::test_cpp2::cpp_reflection::struct2> promise;
1175   auto future = promise.getFuture();
1176   auto callback = std::make_unique<apache::thrift::FutureCallback<::test_cpp2::cpp_reflection::struct2>>(std::move(promise), recv_wrapped_method6, channel_);
1177   method6(rpcOptions, std::move(callback), p_l, p_m, p_n);
1178   return future;
1179 }
1180 
semifuture_method6(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1181 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> service1AsyncClient::semifuture_method6(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1182   auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_method6, channel_);
1183   auto callback = std::move(callbackAndFuture.first);
1184   method6(rpcOptions, std::move(callback), p_l, p_m, p_n);
1185   return std::move(callbackAndFuture.second);
1186 }
1187 
header_future_method6(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1188 folly::Future<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_future_method6(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1189   folly::Promise<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> promise;
1190   auto future = promise.getFuture();
1191   auto callback = std::make_unique<apache::thrift::HeaderFutureCallback<::test_cpp2::cpp_reflection::struct2>>(std::move(promise), recv_wrapped_method6, channel_);
1192   method6(rpcOptions, std::move(callback), p_l, p_m, p_n);
1193   return future;
1194 }
1195 
header_semifuture_method6(apache::thrift::RpcOptions & rpcOptions,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1196 folly::SemiFuture<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> service1AsyncClient::header_semifuture_method6(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1197   auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_method6, channel_);
1198   auto callback = std::move(callbackAndFuture.first);
1199   method6(rpcOptions, std::move(callback), p_l, p_m, p_n);
1200   return std::move(callbackAndFuture.second);
1201 }
1202 
method6(folly::Function<void (::apache::thrift::ClientReceiveState &&)> callback,::std::int32_t p_l,const::test_cpp2::cpp_reflection::struct1 & p_m,double p_n)1203 void service1AsyncClient::method6(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1204   method6(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_l, p_m, p_n);
1205 }
1206 
1207 #if FOLLY_HAS_COROUTINES
1208 #endif // FOLLY_HAS_COROUTINES
recv_wrapped_method6(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1209 folly::exception_wrapper service1AsyncClient::recv_wrapped_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1210   if (state.isException()) {
1211     return std::move(state.exception());
1212   }
1213   if (!state.hasResponseBuffer()) {
1214     return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
1215   }
1216 
1217   using result = service1_method6_presult;
1218   switch (state.protocolId()) {
1219     case apache::thrift::protocol::T_BINARY_PROTOCOL:
1220     {
1221       apache::thrift::BinaryProtocolReader reader;
1222       return apache::thrift::detail::ac::recv_wrapped<result>(
1223           &reader, state, _return);
1224     }
1225     case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1226     {
1227       apache::thrift::CompactProtocolReader reader;
1228       return apache::thrift::detail::ac::recv_wrapped<result>(
1229           &reader, state, _return);
1230     }
1231     default:
1232     {
1233     }
1234   }
1235   return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
1236 }
1237 
recv_method6(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1238 void service1AsyncClient::recv_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1239   auto ew = recv_wrapped_method6(_return, state);
1240   if (ew) {
1241     ew.throw_exception();
1242   }
1243 }
1244 
recv_instance_method6(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1245 void service1AsyncClient::recv_instance_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1246   return recv_method6(_return, state);
1247 }
1248 
recv_instance_wrapped_method6(::test_cpp2::cpp_reflection::struct2 & _return,::apache::thrift::ClientReceiveState & state)1249 folly::exception_wrapper service1AsyncClient::recv_instance_wrapped_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1250   return recv_wrapped_method6(_return, state);
1251 }
1252 
1253 
1254 }} // test_cpp2::cpp_reflection
1255