Resilient
Public Member Functions | Related Functions | List of all members
resilient::Returns< T > Class Template Reference

A detector which detect whether a function returns a specific value. More...

#include <returns.hpp>

Inheritance diagram for resilient::Returns< T >:
[legend]

Public Member Functions

 Returns (T &&failureValue)
 Construct an instance of Returns. More...
 
template<typename Q >
returned_failure_t< failure_typesdetect (ICallResult< Q > &result)
 Check whether the result contains the expected value. More...
 
- Public Member Functions inherited from resilient::StatelessDetector< Returns< T > >
NoState preRun ()
 Does nothing. More...
 
decltype(auto) postRun (NoState, ICallResult< T > &result)
 Detect failures by invoking the Detector. More...
 
decltype(auto) postRun (NoState, ICallResult< T > &result) const
 

Related Functions

(Note that these are not member functions.)

template<typename T >
Returns< T > returns (T &&value)
 Return an instance of Returns with the provided value.
 

Additional Inherited Members

- Public Types inherited from resilient::FailureDetectorTag< ErrorReturn >
using failure_types = std::tuple< FailureTypes... >
 Tuple composed of the possible failure types the detector can detect. More...
 

Detailed Description

template<typename T>
class resilient::Returns< T >

A detector which detect whether a function returns a specific value.

If the detected function returns the specified value then this class returns ErrorReturn.

Template Parameters
TThe type of the value used to compare against the returned value of the function.
Note
The type T can be different from the returned type, as long as they can be compared for equality.

Constructor & Destructor Documentation

template<typename T >
resilient::Returns< T >::Returns ( T &&  failureValue)
inline

Construct an instance of Returns.

Parameters
failureValueThe value used to compare against the return value of the function.

Member Function Documentation

template<typename T >
template<typename Q >
returned_failure_t<failure_types> resilient::Returns< T >::detect ( ICallResult< Q > &  result)
inline

Check whether the result contains the expected value.

Template Parameters
QThe return type of the detected function
Parameters
resultThe result of invoking the detected function.
Returns
ErrorReturn if the returned type is equal to the expected type, NoFailure otherwise.

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