dxFeed Graal CXX API v4.3.1
|
A class that represents a promise-based implementation often used for handling asynchronous operations. More...
#include <Promises.hpp>
Static Public Member Functions | |
template<typename Collection> | |
static std::shared_ptr< Promise< void > > | allOf (const Collection &collection) |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally. | |
template<typename Collection> | |
static std::shared_ptr< Promise< void > > | allOf (std::shared_ptr< Collection > collection) |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally. | |
template<typename Collection> | |
static std::shared_ptr< Promise< void > > | allOf (std::unique_ptr< Collection > collection) |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally. | |
A class that represents a promise-based implementation often used for handling asynchronous operations.
This class provides a framework for handling asynchronous tasks by encapsulating the eventual success (resolution) or failure (rejection) of an operation. It enables chaining of asynchronous operations using methods like then, catch, and finally.
The Promises class is designed to streamline the processing of asynchronous workflows, reducing callback nesting and improving readability and maintainability of asynchronous code.
The functionality includes:
The Promises class follows the native promise behavior in programming languages like JavaScript to facilitate deferred computation and eventual state handling.
|
inlinestatic |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally.
The results of the given promises are not reflected in the returned promise, but may be obtained by inspecting them individually. If no promises are provided, returns a promise completed with the value void
. When the resulting promise completes for any reason (is canceled, for example), then all the promises from the given array are canceled.
Collection | The collection type. For example, PromiseList<LastingEvent> (i.e., std::vector<Promise<std::shared_ptr<LastingEvent>>>) or std::vector<std::shared_ptr<Promise<std::shared_ptr<LastingEvent>>>>. |
collection | The collection of promises or collection of pointer-likes of promises |
|
inlinestatic |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally.
The results of the given promises are not reflected in the returned promise, but may be obtained by inspecting them individually. If no promises are provided, returns a promise completed with the value void
. When the resulting promise completes for any reason (is canceled, for example), then all the promises from the given array are canceled.
Collection | The collection type. For example, PromiseList<LastingEvent> (i.e., std::vector<Promise<std::shared_ptr<LastingEvent>>>) or std::vector<std::shared_ptr<Promise<std::shared_ptr<LastingEvent>>>>. |
collection | The smart pointer to the collection of promises or collection of pointer-likes of promises |
|
inlinestatic |
Returns a new promise that completes when all promises from the given collection complete normally or exceptionally.
The results of the given promises are not reflected in the returned promise, but may be obtained by inspecting them individually. If no promises are provided, returns a promise completed with the value void
. When the resulting promise completes for any reason (is canceled, for example), then all the promises from the given array are canceled.
Collection | The collection type. For example, PromiseList<LastingEvent> (i.e. std::vector<Promise<std::shared_ptr<LastingEvent>>>) or std::vector<std::shared_ptr<Promise<std::shared_ptr<LastingEvent>>>>. |
collection | The smart pointer to the collection of promises or collection of pointer-likes of promises |