8#include <aws/core/Core_EXPORTS.h>
9#include <aws/core/utils/memory/AWSMemory.h>
10#include <aws/core/utils/memory/stl/AWSAllocator.h>
11#include <aws/core/utils/threading/Executor.h>
22 template<
typename ClientT,
25 typename HandlerContextT,
26 typename OperationFuncT,
29 const ClientT* clientThis,
30 const RequestT& request,
31 const HandlerT& handler,
32 const HandlerContextT& context,
35 std::function<void()> asyncTask =
36 [operationFunc, clientThis, request, handler, context]()
40 (clientThis->*operationFunc)(request),
44 pExecutor->Submit(std::move(asyncTask));
53 template<
typename ClientT,
56 typename HandlerContextT,
57 typename OperationFuncT,
60 const ClientT* clientThis,
62 const HandlerT& handler,
63 const HandlerContextT& context,
66 std::function<void()> asyncTask =
67 [operationFunc, clientThis, &request, handler, context]()
71 (clientThis->*operationFunc)(request),
75 pExecutor->Submit(std::move(asyncTask));
81 template<
typename ClientT,
83 typename HandlerContextT,
84 typename OperationFuncT,
87 const ClientT* clientThis,
88 const HandlerT& handler,
89 const HandlerContextT& context,
92 std::function<void()> asyncTask =
93 [operationFunc, clientThis, handler, context]()
96 (clientThis->*operationFunc)(),
100 pExecutor->Submit(std::move(asyncTask));
106 template<
typename ClientT,
108 typename OperationFuncT,
111 OperationFuncT&& operationFunc,
112 const ClientT* clientThis,
113 const RequestT& request,
114 ExecutorT* pExecutor) -> std::future<
decltype((clientThis->*operationFunc)(request))>
116 using OperationOutcomeT =
decltype((clientThis->*operationFunc)(request));
118 auto task =
Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >(
120 [clientThis, operationFunc, request]()
122 auto futureOutcome = (clientThis->*operationFunc)(request);
123 return futureOutcome;
126 std::function<void()> packagedFunction =
127 [task]() { (*task)(); };
128 pExecutor->Submit(std::move(packagedFunction));
129 return task->get_future();
138 template<
typename ClientT,
140 typename OperationFuncT,
143 OperationFuncT&& operationFunc,
144 const ClientT* clientThis,
146 ExecutorT* pExecutor) -> std::future<
decltype((clientThis->*operationFunc)(request))>
148 using OperationOutcomeT =
decltype((clientThis->*operationFunc)(request));
150 auto task =
Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >(
152 [clientThis, operationFunc, &request]()
154 return (clientThis->*operationFunc)(request);
157 std::function<void()> packagedFunction =
158 [task]() { (*task)(); };
159 pExecutor->Submit(std::move(packagedFunction));
160 return task->get_future();
166 template<
typename ClientT,
167 typename OperationFuncT,
170 OperationFuncT&& operationFunc,
171 const ClientT* clientThis,
172 ExecutorT* pExecutor) -> std::future<
decltype((clientThis->*operationFunc)())>
174 using OperationOutcomeT =
decltype((clientThis->*operationFunc)());
176 auto task =
Aws::MakeShared< std::packaged_task< OperationOutcomeT() > >(
178 [clientThis, operationFunc]()
180 return (clientThis->*operationFunc)();
183 std::function<void()> packagedFunction =
184 [task]() { (*task)(); };
185 pExecutor->Submit(std::move(packagedFunction));
186 return task->get_future();
auto AWS_CORE_LOCAL MakeCallableOperation(const char *ALLOCATION_TAG, OperationFuncT &&operationFunc, const ClientT *clientThis, const RequestT &request, ExecutorT *pExecutor) -> std::future< decltype((clientThis-> *operationFunc)(request))>
void AWS_CORE_LOCAL MakeAsyncOperation(OperationFuncT &&operationFunc, const ClientT *clientThis, const RequestT &request, const HandlerT &handler, const HandlerContextT &context, ExecutorT *pExecutor)
void AWS_CORE_LOCAL MakeAsyncStreamingOperation(OperationFuncT &&operationFunc, const ClientT *clientThis, RequestT &request, const HandlerT &handler, const HandlerContextT &context, ExecutorT *pExecutor)
auto AWS_CORE_LOCAL MakeCallableStreamingOperation(const char *ALLOCATION_TAG, OperationFuncT &&operationFunc, const ClientT *clientThis, RequestT &request, ExecutorT *pExecutor) -> std::future< decltype((clientThis-> *operationFunc)(request))>
std::shared_ptr< T > MakeShared(const char *allocationTag, ArgTypes &&... args)