olp-cpp-sdk  1.22.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
olp::thread::Continuation< ResultType > Class Template Referencefinal

A generic template for Continuation. More...

#include <Continuation.h>

Public Member Functions

 Continuation ()=default
 The default constructor of Continuation<ResultType>.
 
 Continuation (std::shared_ptr< thread::TaskScheduler > scheduler, ExecutionContext context, ContinuationTaskType task)
 Creates the Continuation instance. More...
 
 Continuation (ContinuationImplType continuation)
 Creates the Continuation instance. More...
 
template<typename Callable >
Continuation< internal::DeducedType< Callable > > Then (Callable task)
 Adds the next asynchronous task to the ContinuationImpl instance. More...
 
void Run ()
 Starts the execution of the task continuation chain.
 
client::CancellationToken CancelToken ()
 Provides a token to cancel the task. More...
 
template<typename NewType >
Continuation< internal::RemoveRefAndConst< NewType > > Then (std::function< void(ExecutionContext, ResultType, std::function< void(NewType)>)> execution_func)
 Adds the next asynchronous task to the ContinuationImpl instance. More...
 
ContinuationFinally (FinallyCallbackType finally_callback)
 Handles the finalization of the Continuation instance and sets a callback for it. More...
 

Detailed Description

template<typename ResultType>
class olp::thread::Continuation< ResultType >

A generic template for Continuation.

Constructor & Destructor Documentation

◆ Continuation() [1/2]

template<typename ResultType >
olp::thread::Continuation< ResultType >::Continuation ( std::shared_ptr< thread::TaskScheduler scheduler,
ExecutionContext  context,
ContinuationTaskType  task 
)

Creates the Continuation instance.

Parameters
task_schedulerThe TaskScheduler instance.
contextThe ExecutionContext instance.
taskThe continuation task's callback. It contains the execution context and returns a value for the next task.

◆ Continuation() [2/2]

template<typename ResultType >
olp::thread::Continuation< ResultType >::Continuation ( ContinuationImplType  continuation)

Creates the Continuation instance.

Parameters
continuationThe ContinuationImpl instance.

Member Function Documentation

◆ CancelToken()

template<typename ResultType >
client::CancellationToken olp::thread::Continuation< ResultType >::CancelToken

Provides a token to cancel the task.

Returns
The CancellationToken instance.

◆ Finally()

template<typename ResultType >
Continuation< ResultType > & olp::thread::Continuation< ResultType >::Finally ( FinallyCallbackType  finally_callback)

Handles the finalization of the Continuation instance and sets a callback for it.

Parameters
finally_callbackThe callback that handles successful and unsuccessful results.
Returns
The Continuation instance.

◆ Then() [1/2]

template<typename ResultType >
template<typename Callable >
Continuation< internal::DeducedType< Callable > > olp::thread::Continuation< ResultType >::Then ( Callable  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.

◆ Then() [2/2]

template<typename ResultType >
template<typename NewType >
Continuation< internal::RemoveRefAndConst< NewType > > olp::thread::Continuation< ResultType >::Then ( std::function< void(ExecutionContext, ResultType, std::function< void(NewType)>)>  execution_func)

Adds the next asynchronous task to the ContinuationImpl instance.

Parameters
execution_funcA task that you want to add to the continuation chain.

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