Resilient
|
Combine a group of detector, detecting a failure if any of them detect a failure. More...
#include <any.hpp>
Public Types | |
using | failure_types = detail::unique_types_tuple_t< detail::tuple_flatten_t< typename std::remove_reference_t< Detectors >::failure_types... >> |
Type required by the Detector concept. More... | |
template<typename Detector > | |
using | after_adding_t = Any< Detectors..., Detector > |
Define the type of the Any detector if we added a new detector to the current one. More... | |
Public Member Functions | |
Any (std::tuple< Detectors... > &&detectors) | |
Construct an instance with a sequence of detectors. More... | |
template<typename Detector > | |
after_adding_t< Detector > | addDetector (Detector &&detector)&& |
Create a new Any detector with an additional detector added after all the currently existing ones. More... | |
auto | preRun () |
Call preRun*() on all the detectors. More... | |
template<typename... States, typename T > | |
returned_failure_t< failure_types > | postRun (std::tuple< States... > &&state, ICallResult< T > &result) |
Detect failures using the detectors added to this class. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename... Detectors> | |
Any< Detectors... > | anyOf (Detectors &&...detectors) |
Create a detector which uses the provided detectors in order to detect failures. More... | |
Combine a group of detector, detecting a failure if any of them detect a failure.
The order in which the detectors are invoked is the same as the order in which they are added to the Any detector.
preRun()
and postRun()
are always called on each detector, in the order in which they are added.
Detectors... | The detectors used to check the failure. |
using resilient::Any< Detectors >::after_adding_t = Any<Detectors..., Detector> |
Define the type of the Any detector if we added a new detector to the current one.
In other words, define what is going to be the type returned by addDetector()
.
Detector | The new detector to add. |
using resilient::Any< Detectors >::failure_types = detail::unique_types_tuple_t< detail::tuple_flatten_t<typename std::remove_reference_t<Detectors>::failure_types...>> |
Type required by the Detector concept.
The failure_types
are any of the possible failure types returned by the detectors composing it.
|
inlineexplicit |
Construct an instance with a sequence of detectors.
detectors | The detectors to use. |
|
inline |
|
inline |
Detect failures using the detectors added to this class.
States | A tuple containing the state of all the detectors. |
T | The type returned by the detected function. |
state | See States . |
result | The result of invoking the detected function. |
|
inline |
Call preRun*()
on all the detectors.
|
related |
Create a detector which uses the provided detectors in order to detect failures.
Detectors | The types of the detectors to use. |
detectors | The detectors to use. |