26 #include <olp/core/client/ApiError.h>
27 #include <olp/core/client/ApiResponse.h>
28 #include <olp/core/client/TaskContext.h>
29 #include <olp/core/thread/ExecutionContext.h>
30 #include <olp/core/thread/TypeHelpers.h>
124 std::shared_ptr<thread::TaskScheduler> task_scheduler_;
125 std::deque<ContinuationTask> tasks_;
133 bool change_allowed{
true};
139 template <
typename ResultType>
144 using FinallyCallbackType = std::function<void(
Response)>;
154 using ContinuationTaskType =
186 template <
typename Callable>
206 template <
typename NewType>
209 std::function<
void(NewType)>)>
221 Continuation& Finally(FinallyCallbackType finally_callback);
224 FinallyCallbackType finally_callback_;
248 template <
typename Callable>
261 template <
typename ResultType>
271 template <
typename NewType>
282 #include "Continuation.inl"
A wrapper around an internal error or HTTP status code.
Definition: ApiError.h:37
Represents a request outcome.
Definition: ApiResponse.h:65
Cancels service requests.
Definition: CancellationToken.h:33
Continuation()=delete
Do not create the deleted Continuation constructor as an instance.
A generic template for Continuation.
Definition: Continuation.h:140
Continuation(std::shared_ptr< thread::TaskScheduler > scheduler, ExecutionContext context, ContinuationTaskType task)
Creates the Continuation instance.
Continuation()=default
The default constructor of Continuation<ResultType>.
Handles the cancellation and final mechanisms.
Definition: ExecutionContext.h:31
Provides mechanisms to create a chain of tasks and start, cancel, and finalize an execution.
Definition: Continuation.h:46
std::function< OutResultType(void *)> TaskType
The type of ContinuationType.
Definition: Continuation.h:53
void Clear()
Clears the continuation chain tasks.
ContinuationImpl(std::shared_ptr< TaskScheduler > task_scheduler, ExecutionContext context, ContinuationTask task)
Creates the ContinuationImpl instance.
std::pair< AsyncTaskType, TaskType > ContinuationTask
An alias for a pair of task continuation chain types.
Definition: Continuation.h:61
void SetFailedCallback(FailedCallback callback)
Sets a callback on calling SetError.
std::function< void(client::ApiError)> FailedCallback
An alias for the function that returns an error as a callback.
Definition: Continuation.h:49
std::function< void(void *, bool)> FinalCallbackType
An alias for the processing tasks finalization type.
Definition: Continuation.h:59
std::unique_ptr< UntypedSmartPointer > OutResultType
The return value type of the Continuation task.
Definition: Continuation.h:51
std::function< void(void *)> CallbackType
The generic callback type.
Definition: Continuation.h:55
bool Cancelled() const
Checks whether the CancellationContext instance is cancelled.
ContinuationImpl()=default
The default constructor of ContinuationImpl.
const ExecutionContext & GetExecutionContext() const
Gets the ExecutionContext object.
ContinuationImpl Then(ContinuationTask task)
Adds the next asynchronous task to the ContinuationImpl instance.
std::function< void(void *, CallbackType)> AsyncTaskType
An internal type of tasks in Continuation.
Definition: Continuation.h:57
void Run(FinalCallbackType callback)
Starts the execution of the task continuation chain.
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24