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 #pragma once
8 
9 #include "thrift/compiler/test/fixtures/split/gen-cpp2/DbMixedStackArguments.h"
10 
11 #include <thrift/lib/cpp2/gen/service_tcc.h>
12 
13 namespace cpp2 {
14 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::string, ::std::string*>> DbMixedStackArguments_getDataByKey0_pargs;
15 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::binary, ::std::string*>> DbMixedStackArguments_getDataByKey0_presult;
16 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::string, ::std::string*>> DbMixedStackArguments_getDataByKey1_pargs;
17 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::binary, ::std::string*>> DbMixedStackArguments_getDataByKey1_presult;
18 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)19 void DbMixedStackArgumentsAsyncProcessor::setUpAndProcess_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
20   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
21     return;
22   }
23   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
24   ctx->setRequestExecutionScope(std::move(scope));
25   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &DbMixedStackArgumentsAsyncProcessor::process_getDataByKey0<ProtocolIn_, ProtocolOut_>, this);
26 }
27 
28 template <typename ProtocolIn_, typename ProtocolOut_>
process_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)29 void DbMixedStackArgumentsAsyncProcessor::process_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
30   if (!req->getShouldStartProcessing()) {
31     apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
32     return;
33   }
34   // make sure getRequestContext is null
35   // so async calls don't accidentally use it
36   iface_->setRequestContext(nullptr);
37   DbMixedStackArguments_getDataByKey0_pargs args;
38   auto uarg_key = std::make_unique<::std::string>();
39   args.get<0>().value = uarg_key.get();
40   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "DbMixedStackArguments.getDataByKey0", ctx));
41   try {
42     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
43   }
44   catch (const std::exception& ex) {
45     folly::exception_wrapper ew(std::current_exception(), ex);
46     apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
47         ew, std::move(req), ctx, eb, "getDataByKey0");
48     return;
49   }
50   auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_getDataByKey0<ProtocolIn_,ProtocolOut_>, throw_wrapped_getDataByKey0<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
51   iface_->async_tm_getDataByKey0(std::move(callback), std::move(uarg_key));
52 }
53 
54 template <class ProtocolIn_, class ProtocolOut_>
return_getDataByKey0(apache::thrift::ContextStack * ctx,::std::string const & _return)55 apache::thrift::SerializedResponse DbMixedStackArgumentsAsyncProcessor::return_getDataByKey0(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
56   ProtocolOut_ prot;
57   DbMixedStackArguments_getDataByKey0_presult result;
58   result.get<0>().value = const_cast<::std::string*>(&_return);
59   result.setIsSet(0, true);
60   return serializeResponse(&prot, ctx, result);
61 }
62 
63 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)64 void DbMixedStackArgumentsAsyncProcessor::throw_wrapped_getDataByKey0(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
65   if (!ew) {
66     return;
67   }
68   {
69     (void)protoSeqId;
70     apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
71         ew, std::move(req), reqCtx, ctx, "getDataByKey0");
72     return;
73   }
74 }
75 
76 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)77 void DbMixedStackArgumentsAsyncProcessor::setUpAndProcess_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
78   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
79     return;
80   }
81   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
82   ctx->setRequestExecutionScope(std::move(scope));
83   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &DbMixedStackArgumentsAsyncProcessor::process_getDataByKey1<ProtocolIn_, ProtocolOut_>, this);
84 }
85 
86 template <typename ProtocolIn_, typename ProtocolOut_>
process_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)87 void DbMixedStackArgumentsAsyncProcessor::process_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
88   if (!req->getShouldStartProcessing()) {
89     apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
90     return;
91   }
92   // make sure getRequestContext is null
93   // so async calls don't accidentally use it
94   iface_->setRequestContext(nullptr);
95   DbMixedStackArguments_getDataByKey1_pargs args;
96   auto uarg_key = std::make_unique<::std::string>();
97   args.get<0>().value = uarg_key.get();
98   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "DbMixedStackArguments.getDataByKey1", ctx));
99   try {
100     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
101   }
102   catch (const std::exception& ex) {
103     folly::exception_wrapper ew(std::current_exception(), ex);
104     apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
105         ew, std::move(req), ctx, eb, "getDataByKey1");
106     return;
107   }
108   auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_getDataByKey1<ProtocolIn_,ProtocolOut_>, throw_wrapped_getDataByKey1<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
109   iface_->async_tm_getDataByKey1(std::move(callback), std::move(uarg_key));
110 }
111 
112 template <class ProtocolIn_, class ProtocolOut_>
return_getDataByKey1(apache::thrift::ContextStack * ctx,::std::string const & _return)113 apache::thrift::SerializedResponse DbMixedStackArgumentsAsyncProcessor::return_getDataByKey1(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
114   ProtocolOut_ prot;
115   DbMixedStackArguments_getDataByKey1_presult result;
116   result.get<0>().value = const_cast<::std::string*>(&_return);
117   result.setIsSet(0, true);
118   return serializeResponse(&prot, ctx, result);
119 }
120 
121 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)122 void DbMixedStackArgumentsAsyncProcessor::throw_wrapped_getDataByKey1(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
123   if (!ew) {
124     return;
125   }
126   {
127     (void)protoSeqId;
128     apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
129         ew, std::move(req), reqCtx, ctx, "getDataByKey1");
130     return;
131   }
132 }
133 
134 
135 } // cpp2
136