olp-cpp-sdk
1.22.0
|
Provides mechanisms to create a chain of tasks and start, cancel, and finalize an execution. More...
#include <Continuation.h>
Public Types | |
using | FailedCallback = std::function< void(client::ApiError)> |
An alias for the function that returns an error as a callback. | |
using | OutResultType = std::unique_ptr< UntypedSmartPointer > |
The return value type of the Continuation task. | |
using | TaskType = std::function< OutResultType(void *)> |
The type of ContinuationType . | |
using | CallbackType = std::function< void(void *)> |
The generic callback type. | |
using | AsyncTaskType = std::function< void(void *, CallbackType)> |
An internal type of tasks in Continuation . | |
using | FinalCallbackType = std::function< void(void *, bool)> |
An alias for the processing tasks finalization type. | |
using | ContinuationTask = std::pair< AsyncTaskType, TaskType > |
An alias for a pair of task continuation chain types. | |
Public Member Functions | |
ContinuationImpl ()=default | |
The default constructor of ContinuationImpl . | |
ContinuationImpl (std::shared_ptr< TaskScheduler > task_scheduler, ExecutionContext context, ContinuationTask task) | |
Creates the ContinuationImpl instance. More... | |
ContinuationImpl | Then (ContinuationTask task) |
Adds the next asynchronous task to the ContinuationImpl instance. More... | |
void | Run (FinalCallbackType callback) |
Starts the execution of the task continuation chain. More... | |
const ExecutionContext & | GetExecutionContext () const |
Gets the ExecutionContext object. More... | |
bool | Cancelled () const |
Checks whether the CancellationContext instance is cancelled. More... | |
void | SetFailedCallback (FailedCallback callback) |
Sets a callback on calling SetError . More... | |
void | Clear () |
Clears the continuation chain tasks. | |
Provides mechanisms to create a chain of tasks and start, cancel, and finalize an execution.
olp::thread::internal::ContinuationImpl::ContinuationImpl | ( | std::shared_ptr< TaskScheduler > | task_scheduler, |
ExecutionContext | context, | ||
ContinuationTask | task | ||
) |
Creates the ContinuationImpl
instance.
task_scheduler | The TaskScheduler instance. |
context | The ExecutionContext instance. |
task | The ContinuationTask instance. It represents a task that you want to add to the continuation chain. |
bool olp::thread::internal::ContinuationImpl::Cancelled | ( | ) | const |
Checks whether the CancellationContext
instance is cancelled.
CancellationContext
instance is cancelled; false otherwise. const ExecutionContext& olp::thread::internal::ContinuationImpl::GetExecutionContext | ( | ) | const |
Gets the ExecutionContext
object.
ExecutionContext
instance. void olp::thread::internal::ContinuationImpl::Run | ( | FinalCallbackType | callback | ) |
Starts the execution of the task continuation chain.
callback | Handles the finalization of the task chain. |
void olp::thread::internal::ContinuationImpl::SetFailedCallback | ( | FailedCallback | callback | ) |
Sets a callback on calling SetError
.
callback | Handles the execution finalization of the continuation chain. |
ContinuationImpl olp::thread::internal::ContinuationImpl::Then | ( | ContinuationTask | task | ) |
Adds the next asynchronous task to the ContinuationImpl
instance.
task | The ContinuationTask instance. It represents a task that you want to add to the continuation chain. |
ContinuationImpl
instance.