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