detail::low_level_solver< void, traits >

Module: Asynchronous Operations

A specialized template of the low_level_solver class that wraps void results.

Template Parameters:

  • traits The traits type.

The low_level_solver provides a low-level API. The user of this class must adhere to the following rules:

#include <async_result_detail.h>

Inherits from std::enable_shared_from_this< low_level_solver< void, traits > >

Public Functions

Name
~low_level_solver()
The destructor.
boolset_propagate_error_callback(err_cb_type && cb)
Sets an error callback.
boolset_error_callback(err_cb_type && cb)
Sets the local error callback.
voidset_callbacks_from(low_level_solver_ptr< void, traits > other)
Chains the current solver with another solver.
boolset_callback(result_cb_type && cb)
Sets a result callback.
voidresolve()
Resolves the solver.
low_level_solver(async_result_tags::low_level_tag )
The constructor.
voidfail(std::exception_ptr && error)
Fails the solver.
template <typename traits >
class dolbyio::comms::detail::low_level_solver< void, traits >;

Public Functions Documentation

function ~low_level_solver

inline ~low_level_solver()

The destructor.

function set_propagate_error_callback

inline bool set_propagate_error_callback(
    err_cb_type && cb
)

Sets an error callback.

Parameters:

  • cb The function object to be called in the case of an error.

Return: True if the function object has been invoked immediately, false otherwise.

If the fail() method has already been called, the error callback is executed immediately. Otherwise, the callback is stored to be executed when the fail() method is called.

function set_error_callback

inline bool set_error_callback(
    err_cb_type && cb
)

Sets the local error callback.

Parameters:

  • cb The function object to be called in the case of an error.

Return: True if the function object has been invoked immediately, false otherwise.

If the fail() method has already been called, the error callback is executed immediately. Otherwise, the callback is stored to be executed when the fail() method is called.

The local error callback differs from the error callback that is set by the set_propagate_error_callback(), where the chaining solvers reset the propagated error callbacks and, in case of errors, only the callback of the last solver is invoked. The local error callbacks are invoked for each solver in the chain.

The set_error_callback() function must not be invoked after set_propagate_error_callback() or set_callbacks_from().

function set_callbacks_from

inline void set_callbacks_from(
    low_level_solver_ptr< void, traits > other
)

Chains the current solver with another solver.

Parameters:

  • other The shared pointer to the next solver.

This method must be used only if the current low_level_solver does not have any callbacks assigned, except for the local error callback. When the current low_level_solver is resolved, the resolve() or fail() method of the chained solver is called. If the current low_level_solver is already resolved, the chained solver is resolved immediately.

function set_callback

inline bool set_callback(
    result_cb_type && cb
)

Sets a result callback.

Parameters:

  • cb The function object to call when the result is resolved.

Return: True if the function object has been invoked immediately, false otherwise.

If the resolve() method has already been called, the callback is executed immediately. Otherwise, the callback is stored to be invoked when the resolve() method is invoked on the solver.

function resolve

inline void resolve()

Resolves the solver.

If there is a callback stored in the solver, the callback is executed immediately. Otherwise, the callback is invoked when it is assigned.

function low_level_solver

inline low_level_solver(
    async_result_tags::low_level_tag 
)

The constructor.

function fail

inline void fail(
    std::exception_ptr && error
)

Fails the solver.

Parameters:

  • error The exception pointer that contains the exception.

If the error callback is set for the solver, it is invoked. If the current solver is chained with another solver, the fail() method of that chained solver is invoked. If the current solver is not chained with the next solver, the error is stored to be propagated later.



Did this page help you?