Re-sync with internal repository
[hiphop-php.git] / third-party / thrift / src / thrift / compiler / test / fixtures / visitation / gen-cpp2 / service3AsyncClient.cpp
blob8287ea8f01ce7ae3404c704c607ff3e145fcc114
1 /**
2 * Autogenerated by Thrift for src/module.thrift
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated @nocommit
6 */
8 #include "thrift/compiler/test/fixtures/visitation/gen-cpp2/service3AsyncClient.h"
10 #include <thrift/lib/cpp2/gen/client_cpp.h>
12 namespace test_cpp2 { namespace cpp_reflection {
13 typedef apache::thrift::ThriftPresult<false> service3_methodA_pargs;
14 typedef apache::thrift::ThriftPresult<true> service3_methodA_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*>> service3_methodB_pargs;
16 typedef apache::thrift::ThriftPresult<true> service3_methodB_presult;
17 typedef apache::thrift::ThriftPresult<false> service3_methodC_pargs;
18 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, ::std::int32_t*>> service3_methodC_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*>> service3_methodD_pargs;
20 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, ::std::int32_t*>> service3_methodD_presult;
21 typedef apache::thrift::ThriftPresult<false> service3_methodE_pargs;
22 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct2*>> service3_methodE_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*>> service3_methodF_pargs;
24 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct3*>> service3_methodF_presult;
25 }} // test_cpp2::cpp_reflection
26 template <typename Protocol_, typename RpcOptions>
27 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodAT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
29 ::test_cpp2::cpp_reflection::service3_methodA_pargs args;
30 auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
31 auto writer = [&](Protocol_* p) { args.write(p); };
33 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
34 new ::apache::thrift::MethodMetadata::Data(
35 "methodA",
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);
40 template <typename Protocol_, typename RpcOptions>
41 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodBT(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) {
43 ::test_cpp2::cpp_reflection::service3_methodB_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); };
50 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
51 new ::apache::thrift::MethodMetadata::Data(
52 "methodB",
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);
57 template <typename Protocol_, typename RpcOptions>
58 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodCT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
60 ::test_cpp2::cpp_reflection::service3_methodC_pargs args;
61 auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
62 auto writer = [&](Protocol_* p) { args.write(p); };
64 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
65 new ::apache::thrift::MethodMetadata::Data(
66 "methodC",
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);
71 template <typename Protocol_, typename RpcOptions>
72 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodDT(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) {
74 ::test_cpp2::cpp_reflection::service3_methodD_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); };
81 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
82 new ::apache::thrift::MethodMetadata::Data(
83 "methodD",
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);
88 template <typename Protocol_, typename RpcOptions>
89 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodET(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback) {
91 ::test_cpp2::cpp_reflection::service3_methodE_pargs args;
92 auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); };
93 auto writer = [&](Protocol_* p) { args.write(p); };
95 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
96 new ::apache::thrift::MethodMetadata::Data(
97 "methodE",
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);
102 template <typename Protocol_, typename RpcOptions>
103 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodFT(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) {
105 ::test_cpp2::cpp_reflection::service3_methodF_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); };
112 static ::apache::thrift::MethodMetadata::Data* methodMetadata =
113 new ::apache::thrift::MethodMetadata::Data(
114 "methodF",
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);
121 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodA(std::unique_ptr<apache::thrift::RequestCallback> callback) {
122 ::apache::thrift::RpcOptions rpcOptions;
123 methodA(rpcOptions, std::move(callback));
126 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodA(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
127 auto [ctx, header] = methodACtx(&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);
135 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
136 methodAImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
139 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodAImpl(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:
143 apache::thrift::BinaryProtocolWriter writer;
144 if (stealRpcOptions) {
145 methodAT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
146 } else {
147 methodAT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
149 break;
151 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
153 apache::thrift::CompactProtocolWriter writer;
154 if (stealRpcOptions) {
155 methodAT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
156 } else {
157 methodAT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
159 break;
161 default:
163 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
168 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodACtx(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());
176 auto ctx = apache::thrift::ContextStack::createWithClientContext(
177 handlers_,
178 getServiceName(),
179 "service3.methodA",
180 *header);
182 return {std::move(ctx), std::move(header)};
185 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodA() {
186 ::apache::thrift::RpcOptions rpcOptions;
187 sync_methodA(rpcOptions);
190 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodA(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 = methodACtx(&rpcOptions);
196 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
197 callback.waitUntilDone(
198 evb,
199 [&] {
200 methodAImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
203 if (returnState.isException()) {
204 returnState.exception().throw_exception();
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());
213 return folly::fibers::runInMainContext([&] {
214 recv_methodA(returnState);
219 folly::Future<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodA() {
220 ::apache::thrift::RpcOptions rpcOptions;
221 return future_methodA(rpcOptions);
224 folly::SemiFuture<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodA() {
225 ::apache::thrift::RpcOptions rpcOptions;
226 return semifuture_methodA(rpcOptions);
229 folly::Future<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodA(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_methodA, channel_);
233 methodA(rpcOptions, std::move(callback));
234 return future;
237 folly::SemiFuture<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodA(apache::thrift::RpcOptions& rpcOptions) {
238 auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodA, channel_);
239 auto callback = std::move(callbackAndFuture.first);
240 methodA(rpcOptions, std::move(callback));
241 return std::move(callbackAndFuture.second);
244 folly::Future<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodA(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_methodA, channel_);
248 methodA(rpcOptions, std::move(callback));
249 return future;
252 folly::SemiFuture<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodA(apache::thrift::RpcOptions& rpcOptions) {
253 auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodA, channel_);
254 auto callback = std::move(callbackAndFuture.first);
255 methodA(rpcOptions, std::move(callback));
256 return std::move(callbackAndFuture.second);
259 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodA(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
260 methodA(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
263 #if FOLLY_HAS_COROUTINES
264 #endif // FOLLY_HAS_COROUTINES
265 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodA(::apache::thrift::ClientReceiveState& state) {
266 if (state.isException()) {
267 return std::move(state.exception());
269 if (!state.hasResponseBuffer()) {
270 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
273 using result = ::test_cpp2::cpp_reflection::service3_methodA_presult;
274 switch (state.protocolId()) {
275 case apache::thrift::protocol::T_BINARY_PROTOCOL:
277 apache::thrift::BinaryProtocolReader reader;
278 return apache::thrift::detail::ac::recv_wrapped<result>(
279 &reader, state);
281 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
283 apache::thrift::CompactProtocolReader reader;
284 return apache::thrift::detail::ac::recv_wrapped<result>(
285 &reader, state);
287 default:
291 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
294 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodA(::apache::thrift::ClientReceiveState& state) {
295 auto ew = recv_wrapped_methodA(state);
296 if (ew) {
297 ew.throw_exception();
301 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodA(::apache::thrift::ClientReceiveState& state) {
302 recv_methodA(state);
305 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodA(::apache::thrift::ClientReceiveState& state) {
306 return recv_wrapped_methodA(state);
309 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodB(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 methodB(rpcOptions, std::move(callback), p_x, p_y, p_z);
314 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodB(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] = methodBCtx(&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);
323 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
324 methodBImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_x, p_y, p_z);
327 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodBImpl(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:
331 apache::thrift::BinaryProtocolWriter writer;
332 if (stealRpcOptions) {
333 methodBT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
334 } else {
335 methodBT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
337 break;
339 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
341 apache::thrift::CompactProtocolWriter writer;
342 if (stealRpcOptions) {
343 methodBT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
344 } else {
345 methodBT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_x, p_y, p_z);
347 break;
349 default:
351 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
356 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodBCtx(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());
364 auto ctx = apache::thrift::ContextStack::createWithClientContext(
365 handlers_,
366 getServiceName(),
367 "service3.methodB",
368 *header);
370 return {std::move(ctx), std::move(header)};
373 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
374 ::apache::thrift::RpcOptions rpcOptions;
375 sync_methodB(rpcOptions, p_x, p_y, p_z);
378 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodB(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 = methodBCtx(&rpcOptions);
384 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
385 callback.waitUntilDone(
386 evb,
387 [&] {
388 methodBImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_x, p_y, p_z);
391 if (returnState.isException()) {
392 returnState.exception().throw_exception();
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());
401 return folly::fibers::runInMainContext([&] {
402 recv_methodB(returnState);
407 folly::Future<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
408 ::apache::thrift::RpcOptions rpcOptions;
409 return future_methodB(rpcOptions, p_x, p_y, p_z);
412 folly::SemiFuture<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
413 ::apache::thrift::RpcOptions rpcOptions;
414 return semifuture_methodB(rpcOptions, p_x, p_y, p_z);
417 folly::Future<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodB(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_methodB, channel_);
421 methodB(rpcOptions, std::move(callback), p_x, p_y, p_z);
422 return future;
425 folly::SemiFuture<folly::Unit> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodB(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_methodB, channel_);
427 auto callback = std::move(callbackAndFuture.first);
428 methodB(rpcOptions, std::move(callback), p_x, p_y, p_z);
429 return std::move(callbackAndFuture.second);
432 folly::Future<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodB(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_methodB, channel_);
436 methodB(rpcOptions, std::move(callback), p_x, p_y, p_z);
437 return future;
440 folly::SemiFuture<std::pair<folly::Unit, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodB(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_methodB, channel_);
442 auto callback = std::move(callbackAndFuture.first);
443 methodB(rpcOptions, std::move(callback), p_x, p_y, p_z);
444 return std::move(callbackAndFuture.second);
447 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodB(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) {
448 methodB(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_x, p_y, p_z);
451 #if FOLLY_HAS_COROUTINES
452 #endif // FOLLY_HAS_COROUTINES
453 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodB(::apache::thrift::ClientReceiveState& state) {
454 if (state.isException()) {
455 return std::move(state.exception());
457 if (!state.hasResponseBuffer()) {
458 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
461 using result = ::test_cpp2::cpp_reflection::service3_methodB_presult;
462 switch (state.protocolId()) {
463 case apache::thrift::protocol::T_BINARY_PROTOCOL:
465 apache::thrift::BinaryProtocolReader reader;
466 return apache::thrift::detail::ac::recv_wrapped<result>(
467 &reader, state);
469 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
471 apache::thrift::CompactProtocolReader reader;
472 return apache::thrift::detail::ac::recv_wrapped<result>(
473 &reader, state);
475 default:
479 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
482 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodB(::apache::thrift::ClientReceiveState& state) {
483 auto ew = recv_wrapped_methodB(state);
484 if (ew) {
485 ew.throw_exception();
489 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodB(::apache::thrift::ClientReceiveState& state) {
490 recv_methodB(state);
493 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodB(::apache::thrift::ClientReceiveState& state) {
494 return recv_wrapped_methodB(state);
497 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodC(std::unique_ptr<apache::thrift::RequestCallback> callback) {
498 ::apache::thrift::RpcOptions rpcOptions;
499 methodC(rpcOptions, std::move(callback));
502 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodC(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
503 auto [ctx, header] = methodCCtx(&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);
511 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
512 methodCImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
515 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodCImpl(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:
519 apache::thrift::BinaryProtocolWriter writer;
520 if (stealRpcOptions) {
521 methodCT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
522 } else {
523 methodCT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
525 break;
527 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
529 apache::thrift::CompactProtocolWriter writer;
530 if (stealRpcOptions) {
531 methodCT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
532 } else {
533 methodCT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
535 break;
537 default:
539 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
544 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodCCtx(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());
552 auto ctx = apache::thrift::ContextStack::createWithClientContext(
553 handlers_,
554 getServiceName(),
555 "service3.methodC",
556 *header);
558 return {std::move(ctx), std::move(header)};
561 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodC() {
562 ::apache::thrift::RpcOptions rpcOptions;
563 return sync_methodC(rpcOptions);
566 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodC(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 = methodCCtx(&rpcOptions);
572 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
573 callback.waitUntilDone(
574 evb,
575 [&] {
576 methodCImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
579 if (returnState.isException()) {
580 returnState.exception().throw_exception();
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());
589 return folly::fibers::runInMainContext([&] {
590 return recv_methodC(returnState);
595 folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodC() {
596 ::apache::thrift::RpcOptions rpcOptions;
597 return future_methodC(rpcOptions);
600 folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodC() {
601 ::apache::thrift::RpcOptions rpcOptions;
602 return semifuture_methodC(rpcOptions);
605 folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodC(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_methodC, channel_);
609 methodC(rpcOptions, std::move(callback));
610 return future;
613 folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodC(apache::thrift::RpcOptions& rpcOptions) {
614 auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodC, channel_);
615 auto callback = std::move(callbackAndFuture.first);
616 methodC(rpcOptions, std::move(callback));
617 return std::move(callbackAndFuture.second);
620 folly::Future<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodC(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_methodC, channel_);
624 methodC(rpcOptions, std::move(callback));
625 return future;
628 folly::SemiFuture<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodC(apache::thrift::RpcOptions& rpcOptions) {
629 auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodC, channel_);
630 auto callback = std::move(callbackAndFuture.first);
631 methodC(rpcOptions, std::move(callback));
632 return std::move(callbackAndFuture.second);
635 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodC(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
636 methodC(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
639 #if FOLLY_HAS_COROUTINES
640 #endif // FOLLY_HAS_COROUTINES
641 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
642 if (state.isException()) {
643 return std::move(state.exception());
645 if (!state.hasResponseBuffer()) {
646 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
649 using result = ::test_cpp2::cpp_reflection::service3_methodC_presult;
650 switch (state.protocolId()) {
651 case apache::thrift::protocol::T_BINARY_PROTOCOL:
653 apache::thrift::BinaryProtocolReader reader;
654 return apache::thrift::detail::ac::recv_wrapped<result>(
655 &reader, state, _return);
657 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
659 apache::thrift::CompactProtocolReader reader;
660 return apache::thrift::detail::ac::recv_wrapped<result>(
661 &reader, state, _return);
663 default:
667 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
670 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodC(::apache::thrift::ClientReceiveState& state) {
671 ::std::int32_t _return;
672 auto ew = recv_wrapped_methodC(_return, state);
673 if (ew) {
674 ew.throw_exception();
676 return _return;
679 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodC(::apache::thrift::ClientReceiveState& state) {
680 return recv_methodC(state);
683 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
684 return recv_wrapped_methodC(_return, state);
687 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodD(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 methodD(rpcOptions, std::move(callback), p_i, p_j, p_k);
692 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodD(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] = methodDCtx(&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);
701 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
702 methodDImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_i, p_j, p_k);
705 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodDImpl(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:
709 apache::thrift::BinaryProtocolWriter writer;
710 if (stealRpcOptions) {
711 methodDT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
712 } else {
713 methodDT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
715 break;
717 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
719 apache::thrift::CompactProtocolWriter writer;
720 if (stealRpcOptions) {
721 methodDT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
722 } else {
723 methodDT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_i, p_j, p_k);
725 break;
727 default:
729 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
734 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodDCtx(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());
742 auto ctx = apache::thrift::ContextStack::createWithClientContext(
743 handlers_,
744 getServiceName(),
745 "service3.methodD",
746 *header);
748 return {std::move(ctx), std::move(header)};
751 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
752 ::apache::thrift::RpcOptions rpcOptions;
753 return sync_methodD(rpcOptions, p_i, p_j, p_k);
756 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodD(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 = methodDCtx(&rpcOptions);
762 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
763 callback.waitUntilDone(
764 evb,
765 [&] {
766 methodDImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_i, p_j, p_k);
769 if (returnState.isException()) {
770 returnState.exception().throw_exception();
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());
779 return folly::fibers::runInMainContext([&] {
780 return recv_methodD(returnState);
785 folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
786 ::apache::thrift::RpcOptions rpcOptions;
787 return future_methodD(rpcOptions, p_i, p_j, p_k);
790 folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
791 ::apache::thrift::RpcOptions rpcOptions;
792 return semifuture_methodD(rpcOptions, p_i, p_j, p_k);
795 folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodD(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_methodD, channel_);
799 methodD(rpcOptions, std::move(callback), p_i, p_j, p_k);
800 return future;
803 folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodD(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_methodD, channel_);
805 auto callback = std::move(callbackAndFuture.first);
806 methodD(rpcOptions, std::move(callback), p_i, p_j, p_k);
807 return std::move(callbackAndFuture.second);
810 folly::Future<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodD(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_methodD, channel_);
814 methodD(rpcOptions, std::move(callback), p_i, p_j, p_k);
815 return future;
818 folly::SemiFuture<std::pair<::std::int32_t, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodD(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_methodD, channel_);
820 auto callback = std::move(callbackAndFuture.first);
821 methodD(rpcOptions, std::move(callback), p_i, p_j, p_k);
822 return std::move(callbackAndFuture.second);
825 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodD(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) {
826 methodD(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_i, p_j, p_k);
829 #if FOLLY_HAS_COROUTINES
830 #endif // FOLLY_HAS_COROUTINES
831 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
832 if (state.isException()) {
833 return std::move(state.exception());
835 if (!state.hasResponseBuffer()) {
836 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
839 using result = ::test_cpp2::cpp_reflection::service3_methodD_presult;
840 switch (state.protocolId()) {
841 case apache::thrift::protocol::T_BINARY_PROTOCOL:
843 apache::thrift::BinaryProtocolReader reader;
844 return apache::thrift::detail::ac::recv_wrapped<result>(
845 &reader, state, _return);
847 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
849 apache::thrift::CompactProtocolReader reader;
850 return apache::thrift::detail::ac::recv_wrapped<result>(
851 &reader, state, _return);
853 default:
857 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
860 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodD(::apache::thrift::ClientReceiveState& state) {
861 ::std::int32_t _return;
862 auto ew = recv_wrapped_methodD(_return, state);
863 if (ew) {
864 ew.throw_exception();
866 return _return;
869 ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodD(::apache::thrift::ClientReceiveState& state) {
870 return recv_methodD(state);
873 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) {
874 return recv_wrapped_methodD(_return, state);
877 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodE(std::unique_ptr<apache::thrift::RequestCallback> callback) {
878 ::apache::thrift::RpcOptions rpcOptions;
879 methodE(rpcOptions, std::move(callback));
882 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodE(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback) {
883 auto [ctx, header] = methodECtx(&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);
891 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
892 methodEImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback));
895 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodEImpl(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:
899 apache::thrift::BinaryProtocolWriter writer;
900 if (stealRpcOptions) {
901 methodET(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
902 } else {
903 methodET(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
905 break;
907 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
909 apache::thrift::CompactProtocolWriter writer;
910 if (stealRpcOptions) {
911 methodET(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback));
912 } else {
913 methodET(&writer, rpcOptions, std::move(header), contextStack, std::move(callback));
915 break;
917 default:
919 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
924 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodECtx(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());
932 auto ctx = apache::thrift::ContextStack::createWithClientContext(
933 handlers_,
934 getServiceName(),
935 "service3.methodE",
936 *header);
938 return {std::move(ctx), std::move(header)};
941 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodE(::test_cpp2::cpp_reflection::struct2& _return) {
942 ::apache::thrift::RpcOptions rpcOptions;
943 sync_methodE(rpcOptions, _return);
946 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodE(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 = methodECtx(&rpcOptions);
952 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
953 callback.waitUntilDone(
954 evb,
955 [&] {
956 methodEImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback));
959 if (returnState.isException()) {
960 returnState.exception().throw_exception();
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());
969 return folly::fibers::runInMainContext([&] {
970 recv_methodE(_return, returnState);
975 folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodE() {
976 ::apache::thrift::RpcOptions rpcOptions;
977 return future_methodE(rpcOptions);
980 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodE() {
981 ::apache::thrift::RpcOptions rpcOptions;
982 return semifuture_methodE(rpcOptions);
985 folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodE(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_methodE, channel_);
989 methodE(rpcOptions, std::move(callback));
990 return future;
993 folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodE(apache::thrift::RpcOptions& rpcOptions) {
994 auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodE, channel_);
995 auto callback = std::move(callbackAndFuture.first);
996 methodE(rpcOptions, std::move(callback));
997 return std::move(callbackAndFuture.second);
1000 folly::Future<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodE(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_methodE, channel_);
1004 methodE(rpcOptions, std::move(callback));
1005 return future;
1008 folly::SemiFuture<std::pair<::test_cpp2::cpp_reflection::struct2, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodE(apache::thrift::RpcOptions& rpcOptions) {
1009 auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodE, channel_);
1010 auto callback = std::move(callbackAndFuture.first);
1011 methodE(rpcOptions, std::move(callback));
1012 return std::move(callbackAndFuture.second);
1015 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodE(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback) {
1016 methodE(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)));
1019 #if FOLLY_HAS_COROUTINES
1020 #endif // FOLLY_HAS_COROUTINES
1021 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1022 if (state.isException()) {
1023 return std::move(state.exception());
1025 if (!state.hasResponseBuffer()) {
1026 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
1029 using result = ::test_cpp2::cpp_reflection::service3_methodE_presult;
1030 switch (state.protocolId()) {
1031 case apache::thrift::protocol::T_BINARY_PROTOCOL:
1033 apache::thrift::BinaryProtocolReader reader;
1034 return apache::thrift::detail::ac::recv_wrapped<result>(
1035 &reader, state, _return);
1037 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1039 apache::thrift::CompactProtocolReader reader;
1040 return apache::thrift::detail::ac::recv_wrapped<result>(
1041 &reader, state, _return);
1043 default:
1047 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
1050 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1051 auto ew = recv_wrapped_methodE(_return, state);
1052 if (ew) {
1053 ew.throw_exception();
1057 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1058 return recv_methodE(_return, state);
1061 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) {
1062 return recv_wrapped_methodE(_return, state);
1065 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodF(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 methodF(rpcOptions, std::move(callback), p_l, p_m, p_n);
1070 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodF(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] = methodFCtx(&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);
1079 auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext));
1080 methodFImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_l, p_m, p_n);
1083 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodFImpl(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:
1087 apache::thrift::BinaryProtocolWriter writer;
1088 if (stealRpcOptions) {
1089 methodFT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1090 } else {
1091 methodFT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1093 break;
1095 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1097 apache::thrift::CompactProtocolWriter writer;
1098 if (stealRpcOptions) {
1099 methodFT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1100 } else {
1101 methodFT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_l, p_m, p_n);
1103 break;
1105 default:
1107 apache::thrift::detail::ac::throw_app_exn("Could not find Protocol");
1112 std::pair<std::unique_ptr<::apache::thrift::ContextStack>, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodFCtx(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());
1120 auto ctx = apache::thrift::ContextStack::createWithClientContext(
1121 handlers_,
1122 getServiceName(),
1123 "service3.methodF",
1124 *header);
1126 return {std::move(ctx), std::move(header)};
1129 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1130 ::apache::thrift::RpcOptions rpcOptions;
1131 sync_methodF(rpcOptions, _return, p_l, p_m, p_n);
1134 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::sync_methodF(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct3& _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 = methodFCtx(&rpcOptions);
1140 auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback);
1141 callback.waitUntilDone(
1142 evb,
1143 [&] {
1144 methodFImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_l, p_m, p_n);
1147 if (returnState.isException()) {
1148 returnState.exception().throw_exception();
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());
1157 return folly::fibers::runInMainContext([&] {
1158 recv_methodF(_return, returnState);
1163 folly::Future<::test_cpp2::cpp_reflection::struct3> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1164 ::apache::thrift::RpcOptions rpcOptions;
1165 return future_methodF(rpcOptions, p_l, p_m, p_n);
1168 folly::SemiFuture<::test_cpp2::cpp_reflection::struct3> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1169 ::apache::thrift::RpcOptions rpcOptions;
1170 return semifuture_methodF(rpcOptions, p_l, p_m, p_n);
1173 folly::Future<::test_cpp2::cpp_reflection::struct3> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::future_methodF(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::struct3> promise;
1175 auto future = promise.getFuture();
1176 auto callback = std::make_unique<apache::thrift::FutureCallback<::test_cpp2::cpp_reflection::struct3>>(std::move(promise), recv_wrapped_methodF, channel_);
1177 methodF(rpcOptions, std::move(callback), p_l, p_m, p_n);
1178 return future;
1181 folly::SemiFuture<::test_cpp2::cpp_reflection::struct3> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::semifuture_methodF(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_methodF, channel_);
1183 auto callback = std::move(callbackAndFuture.first);
1184 methodF(rpcOptions, std::move(callback), p_l, p_m, p_n);
1185 return std::move(callbackAndFuture.second);
1188 folly::Future<std::pair<::test_cpp2::cpp_reflection::struct3, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_future_methodF(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::struct3, 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::struct3>>(std::move(promise), recv_wrapped_methodF, channel_);
1192 methodF(rpcOptions, std::move(callback), p_l, p_m, p_n);
1193 return future;
1196 folly::SemiFuture<std::pair<::test_cpp2::cpp_reflection::struct3, std::unique_ptr<apache::thrift::transport::THeader>>> apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::header_semifuture_methodF(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_methodF, channel_);
1198 auto callback = std::move(callbackAndFuture.first);
1199 methodF(rpcOptions, std::move(callback), p_l, p_m, p_n);
1200 return std::move(callbackAndFuture.second);
1203 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::methodF(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) {
1204 methodF(std::make_unique<apache::thrift::FunctionReplyCallback>(std::move(callback)), p_l, p_m, p_n);
1207 #if FOLLY_HAS_COROUTINES
1208 #endif // FOLLY_HAS_COROUTINES
1209 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_wrapped_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::apache::thrift::ClientReceiveState& state) {
1210 if (state.isException()) {
1211 return std::move(state.exception());
1213 if (!state.hasResponseBuffer()) {
1214 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("recv_ called without result");
1217 using result = ::test_cpp2::cpp_reflection::service3_methodF_presult;
1218 switch (state.protocolId()) {
1219 case apache::thrift::protocol::T_BINARY_PROTOCOL:
1221 apache::thrift::BinaryProtocolReader reader;
1222 return apache::thrift::detail::ac::recv_wrapped<result>(
1223 &reader, state, _return);
1225 case apache::thrift::protocol::T_COMPACT_PROTOCOL:
1227 apache::thrift::CompactProtocolReader reader;
1228 return apache::thrift::detail::ac::recv_wrapped<result>(
1229 &reader, state, _return);
1231 default:
1235 return folly::make_exception_wrapper<apache::thrift::TApplicationException>("Could not find Protocol");
1238 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::apache::thrift::ClientReceiveState& state) {
1239 auto ew = recv_wrapped_methodF(_return, state);
1240 if (ew) {
1241 ew.throw_exception();
1245 void apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::apache::thrift::ClientReceiveState& state) {
1246 return recv_methodF(_return, state);
1249 folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service3>::recv_instance_wrapped_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::apache::thrift::ClientReceiveState& state) {
1250 return recv_wrapped_methodF(_return, state);