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/basic-stack-arguments/gen-cpp2/MyService.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::integral, ::std::int64_t*>> MyService_hasDataById_pargs;
15 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, bool*>> MyService_hasDataById_presult;
16 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>> MyService_getDataById_pargs;
17 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::string, ::std::string*>> MyService_getDataById_presult;
18 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_putDataById_pargs;
19 typedef apache::thrift::ThriftPresult<true> MyService_putDataById_presult;
20 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_lobDataById_pargs;
21 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)22 void MyServiceAsyncProcessor::setUpAndProcess_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
23   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
24     return;
25   }
26   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
27   ctx->setRequestExecutionScope(std::move(scope));
28   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_hasDataById<ProtocolIn_, ProtocolOut_>, this);
29 }
30 
31 template <typename ProtocolIn_, typename ProtocolOut_>
process_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)32 void MyServiceAsyncProcessor::process_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
33   if (!req->getShouldStartProcessing()) {
34     apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
35     return;
36   }
37   // make sure getRequestContext is null
38   // so async calls don't accidentally use it
39   iface_->setRequestContext(nullptr);
40   MyService_hasDataById_pargs args;
41   ::std::int64_t uarg_id{0};
42   args.get<0>().value = &uarg_id;
43   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.hasDataById", ctx));
44   try {
45     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
46   }
47   catch (const std::exception& ex) {
48     folly::exception_wrapper ew(std::current_exception(), ex);
49     apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
50         ew, std::move(req), ctx, eb, "hasDataById");
51     return;
52   }
53   auto callback = std::make_unique<apache::thrift::HandlerCallback<bool>>(std::move(req), std::move(ctxStack), return_hasDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_hasDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
54   iface_->async_tm_hasDataById(std::move(callback), args.get<0>().ref());
55 }
56 
57 template <class ProtocolIn_, class ProtocolOut_>
return_hasDataById(apache::thrift::ContextStack * ctx,bool const & _return)58 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_hasDataById(apache::thrift::ContextStack* ctx, bool const& _return) {
59   ProtocolOut_ prot;
60   MyService_hasDataById_presult result;
61   result.get<0>().value = const_cast<bool*>(&_return);
62   result.setIsSet(0, true);
63   return serializeResponse(&prot, ctx, result);
64 }
65 
66 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)67 void MyServiceAsyncProcessor::throw_wrapped_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
68   if (!ew) {
69     return;
70   }
71   {
72     (void)protoSeqId;
73     apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
74         ew, std::move(req), reqCtx, ctx, "hasDataById");
75     return;
76   }
77 }
78 
79 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)80 void MyServiceAsyncProcessor::setUpAndProcess_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
81   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
82     return;
83   }
84   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
85   ctx->setRequestExecutionScope(std::move(scope));
86   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_getDataById<ProtocolIn_, ProtocolOut_>, this);
87 }
88 
89 template <typename ProtocolIn_, typename ProtocolOut_>
process_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)90 void MyServiceAsyncProcessor::process_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
91   if (!req->getShouldStartProcessing()) {
92     apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
93     return;
94   }
95   // make sure getRequestContext is null
96   // so async calls don't accidentally use it
97   iface_->setRequestContext(nullptr);
98   MyService_getDataById_pargs args;
99   ::std::int64_t uarg_id{0};
100   args.get<0>().value = &uarg_id;
101   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.getDataById", ctx));
102   try {
103     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
104   }
105   catch (const std::exception& ex) {
106     folly::exception_wrapper ew(std::current_exception(), ex);
107     apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
108         ew, std::move(req), ctx, eb, "getDataById");
109     return;
110   }
111   auto callback = std::make_unique<apache::thrift::HandlerCallback<::std::string>>(std::move(req), std::move(ctxStack), return_getDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_getDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
112   iface_->async_tm_getDataById(std::move(callback), args.get<0>().ref());
113 }
114 
115 template <class ProtocolIn_, class ProtocolOut_>
return_getDataById(apache::thrift::ContextStack * ctx,::std::string const & _return)116 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_getDataById(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
117   ProtocolOut_ prot;
118   MyService_getDataById_presult result;
119   result.get<0>().value = const_cast<::std::string*>(&_return);
120   result.setIsSet(0, true);
121   return serializeResponse(&prot, ctx, result);
122 }
123 
124 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)125 void MyServiceAsyncProcessor::throw_wrapped_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
126   if (!ew) {
127     return;
128   }
129   {
130     (void)protoSeqId;
131     apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
132         ew, std::move(req), reqCtx, ctx, "getDataById");
133     return;
134   }
135 }
136 
137 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)138 void MyServiceAsyncProcessor::setUpAndProcess_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
139   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
140     return;
141   }
142   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
143   ctx->setRequestExecutionScope(std::move(scope));
144   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_putDataById<ProtocolIn_, ProtocolOut_>, this);
145 }
146 
147 template <typename ProtocolIn_, typename ProtocolOut_>
process_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)148 void MyServiceAsyncProcessor::process_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
149   if (!req->getShouldStartProcessing()) {
150     apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
151     return;
152   }
153   // make sure getRequestContext is null
154   // so async calls don't accidentally use it
155   iface_->setRequestContext(nullptr);
156   MyService_putDataById_pargs args;
157   ::std::int64_t uarg_id{0};
158   args.get<0>().value = &uarg_id;
159   ::std::string uarg_data;
160   args.get<1>().value = &uarg_data;
161   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.putDataById", ctx));
162   try {
163     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
164   }
165   catch (const std::exception& ex) {
166     folly::exception_wrapper ew(std::current_exception(), ex);
167     apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
168         ew, std::move(req), ctx, eb, "putDataById");
169     return;
170   }
171   auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_putDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_putDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
172   iface_->async_tm_putDataById(std::move(callback), args.get<0>().ref(), args.get<1>().ref());
173 }
174 
175 template <class ProtocolIn_, class ProtocolOut_>
return_putDataById(apache::thrift::ContextStack * ctx)176 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_putDataById(apache::thrift::ContextStack* ctx) {
177   ProtocolOut_ prot;
178   MyService_putDataById_presult result;
179   return serializeResponse(&prot, ctx, result);
180 }
181 
182 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)183 void MyServiceAsyncProcessor::throw_wrapped_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
184   if (!ew) {
185     return;
186   }
187   {
188     (void)protoSeqId;
189     apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
190         ew, std::move(req), reqCtx, ctx, "putDataById");
191     return;
192   }
193 }
194 
195 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)196 void MyServiceAsyncProcessor::setUpAndProcess_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
197   if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, iface_)) {
198     return;
199   }
200   auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
201   ctx->setRequestExecutionScope(std::move(scope));
202   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, &MyServiceAsyncProcessor::process_lobDataById<ProtocolIn_, ProtocolOut_>, this);
203 }
204 
205 template <typename ProtocolIn_, typename ProtocolOut_>
process_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)206 void MyServiceAsyncProcessor::process_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
207   // make sure getRequestContext is null
208   // so async calls don't accidentally use it
209   iface_->setRequestContext(nullptr);
210   MyService_lobDataById_pargs args;
211   ::std::int64_t uarg_id{0};
212   args.get<0>().value = &uarg_id;
213   ::std::string uarg_data;
214   args.get<1>().value = &uarg_data;
215   std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.lobDataById", ctx));
216   try {
217     deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
218   }
219   catch (const std::exception& ex) {
220     LOG(ERROR) << ex.what() << " in function lobDataById";
221     eb->runInEventBaseThread([req = std::move(req)] {});
222     return;
223   }
224   auto callback = std::make_unique<apache::thrift::HandlerCallbackBase>(std::move(req), std::move(ctxStack), nullptr, eb, tm, ctx);
225   iface_->async_tm_lobDataById(std::move(callback), args.get<0>().ref(), args.get<1>().ref());
226 }
227 
228 
229 } // cpp2
230