dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
EventPromiseMixin< E, P > Struct Template Reference

Mixin for wrapping Promise method calls for a single event. More...

#include <Promise.hpp>

Public Member Functions

std::shared_ptr< E > getResult () const
 Returns result of computation.
 
std::shared_ptr< E > await () const
 Wait for computation to complete and return its result or throw an exception in case of exceptional completion.
 
std::shared_ptr< E > await (std::int32_t timeoutInMilliseconds) const &
 Wait for computation to complete or timeout and return its result or throw an exception in case of exceptional completion or timeout.
 
std::shared_ptr< E > await (const std::chrono::milliseconds &timeoutInMilliseconds) const &
 Wait for computation to complete or timeout and return its result or throw an exception in case of exceptional completion or timeout.
 

Detailed Description

template<typename E, typename P>
struct EventPromiseMixin< E, P >

Mixin for wrapping Promise method calls for a single event.

Template Parameters
EThe event type.
PThe promise type.

Member Function Documentation

◆ await() [1/3]

template<typename E , typename P >
std::shared_ptr< E > EventPromiseMixin< E, P >::await ( ) const
inline

Wait for computation to complete and return its result or throw an exception in case of exceptional completion.

Returns
result of computation.
Exceptions
CancellationExceptionif computation was cancelled.
PromiseExceptionif computation has completed exceptionally.

◆ await() [2/3]

template<typename E , typename P >
std::shared_ptr< E > EventPromiseMixin< E, P >::await ( const std::chrono::milliseconds & timeoutInMilliseconds) const &
inline

Wait for computation to complete or timeout and return its result or throw an exception in case of exceptional completion or timeout.

Parameters
timeoutInMillisecondsThe timeout.
Returns
The result of computation.
Exceptions
CancellationExceptionif computation was cancelled or timed out.
PromiseExceptionif computation has completed exceptionally.

◆ await() [3/3]

template<typename E , typename P >
std::shared_ptr< E > EventPromiseMixin< E, P >::await ( std::int32_t timeoutInMilliseconds) const &
inline

Wait for computation to complete or timeout and return its result or throw an exception in case of exceptional completion or timeout.

Parameters
timeoutInMillisecondsThe timeout.
Returns
The result of computation.
Exceptions
CancellationExceptionif computation was cancelled or timed out.
PromiseExceptionif computation has completed exceptionally.

◆ getResult()

template<typename E , typename P >
std::shared_ptr< E > EventPromiseMixin< E, P >::getResult ( ) const
inline

Returns result of computation.

If computation has no result, then this method returns std::shared_ptr<E>(nullptr).

Returns
The result of computation.
See also
CommonPromiseMixin::hasResult()