1 /**
2 * Autogenerated by Thrift
3 *
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated
6 */
7
8 #include <src/gen-py3/module/services_wrapper.h>
9 #include <src/gen-py3/module/services_api.h>
10 #include <thrift/lib/cpp2/async/AsyncProcessor.h>
11
12 namespace cpp2 {
13
MyRootWrapper(PyObject * obj,folly::Executor * exc)14 MyRootWrapper::MyRootWrapper(PyObject *obj, folly::Executor* exc)
15 : if_object(obj), executor(exc)
16 {
17 import_module__services();
18 }
19
20
async_tm_do_root(std::unique_ptr<apache::thrift::HandlerCallback<void>> callback)21 void MyRootWrapper::async_tm_do_root(
22 std::unique_ptr<apache::thrift::HandlerCallback<void>> callback) {
23 auto ctx = callback->getRequestContext();
24 folly::via(
25 this->executor,
26 [this, ctx,
27 callback = std::move(callback) ]() mutable {
28 auto [promise, future] = folly::makePromiseContract<folly::Unit>();
29 call_cy_MyRoot_do_root(
30 this->if_object,
31 ctx,
32 std::move(promise) );
33 std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try<folly::Unit>&& t) {
34 (void)t;
35 callback->complete(std::move(t));
36 });
37 });
38 }
MyRootInterface(PyObject * if_object,folly::Executor * exc)39 std::shared_ptr<apache::thrift::ServerInterface> MyRootInterface(PyObject *if_object, folly::Executor *exc) {
40 return std::make_shared<MyRootWrapper>(if_object, exc);
41 }
42
43
MyNodeWrapper(PyObject * obj,folly::Executor * exc)44 MyNodeWrapper::MyNodeWrapper(PyObject *obj, folly::Executor* exc)
45 : ::cpp2::MyRootWrapper(obj, exc)
46 {
47 import_module__services();
48 }
49
async_tm_do_mid(std::unique_ptr<apache::thrift::HandlerCallback<void>> callback)50 void MyNodeWrapper::async_tm_do_mid(
51 std::unique_ptr<apache::thrift::HandlerCallback<void>> callback) {
52 auto ctx = callback->getRequestContext();
53 folly::via(
54 this->executor,
55 [this, ctx,
56 callback = std::move(callback) ]() mutable {
57 auto [promise, future] = folly::makePromiseContract<folly::Unit>();
58 call_cy_MyNode_do_mid(
59 this->if_object,
60 ctx,
61 std::move(promise) );
62 std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try<folly::Unit>&& t) {
63 (void)t;
64 callback->complete(std::move(t));
65 });
66 });
67 }
MyNodeInterface(PyObject * if_object,folly::Executor * exc)68 std::shared_ptr<apache::thrift::ServerInterface> MyNodeInterface(PyObject *if_object, folly::Executor *exc) {
69 return std::make_shared<MyNodeWrapper>(if_object, exc);
70 }
71
72
MyLeafWrapper(PyObject * obj,folly::Executor * exc)73 MyLeafWrapper::MyLeafWrapper(PyObject *obj, folly::Executor* exc)
74 : ::cpp2::MyNodeWrapper(obj, exc)
75 {
76 import_module__services();
77 }
78
async_tm_do_leaf(std::unique_ptr<apache::thrift::HandlerCallback<void>> callback)79 void MyLeafWrapper::async_tm_do_leaf(
80 std::unique_ptr<apache::thrift::HandlerCallback<void>> callback) {
81 auto ctx = callback->getRequestContext();
82 folly::via(
83 this->executor,
84 [this, ctx,
85 callback = std::move(callback) ]() mutable {
86 auto [promise, future] = folly::makePromiseContract<folly::Unit>();
87 call_cy_MyLeaf_do_leaf(
88 this->if_object,
89 ctx,
90 std::move(promise) );
91 std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try<folly::Unit>&& t) {
92 (void)t;
93 callback->complete(std::move(t));
94 });
95 });
96 }
MyLeafInterface(PyObject * if_object,folly::Executor * exc)97 std::shared_ptr<apache::thrift::ServerInterface> MyLeafInterface(PyObject *if_object, folly::Executor *exc) {
98 return std::make_shared<MyLeafWrapper>(if_object, exc);
99 }
100 } // namespace cpp2
101