Resilient
Public Member Functions | List of all members
resilient::StatelessDetector< Detector > Struct Template Reference

An helper base detector to simplify writing stateless detectors. More...

#include <basedetector.hpp>

Public Member Functions

NoState preRun ()
 Does nothing. More...
 
template<typename T >
decltype(auto) postRun (NoState, ICallResult< T > &result)
 Detect failures by invoking the Detector. More...
 
template<typename T >
decltype(auto) postRun (NoState, ICallResult< T > &result) const
 

Detailed Description

template<typename Detector>
struct resilient::StatelessDetector< Detector >

An helper base detector to simplify writing stateless detectors.

It uses the CRT pattern to define the Detector concept, calling the derived Detector detect() method to detect failures.

The detectors which derive from the StatelessDetector need only to define a detect() function which takes the ICallResult.

How to use it

struct MyStatelessDetector : FailureDetectorTag<MyFailure>,
StatelessDetector<MyStatelessDetector>
{
auto detect(ICallResult<T>& result)
{
...
}
}
Template Parameters
DetectorThe type of the detector

Member Function Documentation

template<typename Detector>
template<typename T >
decltype(auto) resilient::StatelessDetector< Detector >::postRun ( NoState  ,
ICallResult< T > &  result 
)
inline

Detect failures by invoking the Detector.

Template Parameters
TThe type returned by the detected function.
Parameters
resultThe result of invoking the detected function.
Returns
The result of invoking detect() on the Detector
template<typename Detector>
template<typename T >
decltype(auto) resilient::StatelessDetector< Detector >::postRun ( NoState  ,
ICallResult< T > &  result 
) const
inline
See also
postRun().
template<typename Detector>
NoState resilient::StatelessDetector< Detector >::preRun ( )
inline

Does nothing.

Returns
NoState.

The documentation for this struct was generated from the following file: