olp-cpp-sdk  1.22.0
Public Types | Public Member Functions | List of all members
olp::thread::internal::ContinuationImpl Class Referencefinal

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 ExecutionContextGetExecutionContext () 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.
 

Detailed Description

Provides mechanisms to create a chain of tasks and start, cancel, and finalize an execution.

Note
It is a private implementation class for internal use only and not bound to any API stability promises. Do not use it directly.

Constructor & Destructor Documentation

◆ ContinuationImpl()

olp::thread::internal::ContinuationImpl::ContinuationImpl ( std::shared_ptr< TaskScheduler task_scheduler,
ExecutionContext  context,
ContinuationTask  task 
)

Creates the ContinuationImpl instance.

Parameters
task_schedulerThe TaskScheduler instance.
contextThe ExecutionContext instance.
taskThe ContinuationTask instance. It represents a task that you want to add to the continuation chain.

Member Function Documentation

◆ Cancelled()

bool olp::thread::internal::ContinuationImpl::Cancelled ( ) const

Checks whether the CancellationContext instance is cancelled.

Returns
True if the CancellationContext instance is cancelled; false otherwise.

◆ GetExecutionContext()

const ExecutionContext& olp::thread::internal::ContinuationImpl::GetExecutionContext ( ) const

Gets the ExecutionContext object.

Returns
The ExecutionContext instance.

◆ Run()

void olp::thread::internal::ContinuationImpl::Run ( FinalCallbackType  callback)

Starts the execution of the task continuation chain.

Parameters
callbackHandles the finalization of the task chain.

◆ SetFailedCallback()

void olp::thread::internal::ContinuationImpl::SetFailedCallback ( FailedCallback  callback)

Sets a callback on calling SetError.

Parameters
callbackHandles the execution finalization of the continuation chain.

◆ Then()

ContinuationImpl olp::thread::internal::ContinuationImpl::Then ( ContinuationTask  task)

Adds the next asynchronous task to the ContinuationImpl instance.

Parameters
taskThe ContinuationTask instance. It represents a task that you want to add to the continuation chain.
Returns
The ContinuationImpl instance.

The documentation for this class was generated from the following file: