hpp::statistics::SuccessBin Class Reference

This class count the number of success and failure. More...

#include <hpp/statistics/success-bin.hh>

Inheritance diagram for hpp::statistics::SuccessBin:
[legend]
Collaboration diagram for hpp::statistics::SuccessBin:
[legend]

Classes

struct  Reason
 In case of failure, you can provide a reason. More...
 

Public Member Functions

 SuccessBin (const bool success, const Reason &r=REASON_UNKNOWN)
 Constructor. More...
 
bool isSuccess () const
 Value of the bin. More...
 
const Reasonreason () const
 If this bin represents 'failure', returns the reason. More...
 
const std::string & reasonString () const
 If this bin represents 'failure', returns the reason as a string. More...
 
bool operator== (const SuccessBin &other) const
 Check for equality. More...
 
bool operator< (const SuccessBin &other) const
 Comparison. More...
 
- Public Member Functions inherited from hpp::statistics::Bin
const std::size_t & freq () const
 Return the number of element in the bin. More...
 
std::size_t operator++ ()
 Add an occurence. More...
 
std::size_t operator++ (int)
 Add an occurence. More...
 
virtual std::ostream & print (std::ostream &os) const
 Print the bin. More...
 

Static Public Member Functions

static Reason createReason (const std::string &what)
 Create a new Reason. More...
 

Static Public Attributes

static const Reason REASON_UNKNOWN
 The default reason for 'failure'. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hpp::statistics::Bin
 Bin ()
 Constructor. More...
 

Detailed Description

This class count the number of success and failure.

Constructor & Destructor Documentation

hpp::statistics::SuccessBin::SuccessBin ( const bool  success,
const Reason r = REASON_UNKNOWN 
)
inline

Constructor.

Member Function Documentation

static Reason hpp::statistics::SuccessBin::createReason ( const std::string &  what)
inlinestatic

Create a new Reason.

Parameters
whatThe text associated with the reason.

References hpp::statistics::SuccessBin::Reason::what.

bool hpp::statistics::SuccessBin::isSuccess ( ) const
inline

Value of the bin.

Returns
True is it counts "success", False otherwise.
bool hpp::statistics::SuccessBin::operator< ( const SuccessBin other) const
inline

Comparison.

Returns
the comparison of their reason id. 'success' has a reason id of INT_MIN.

References hpp::statistics::SuccessBin::Reason::id, and reason().

bool hpp::statistics::SuccessBin::operator== ( const SuccessBin other) const
inline

Check for equality.

Returns
True if both are 'success' or if they are both 'failure' with the same Reason.

References hpp::statistics::SuccessBin::Reason::id, and reason().

const Reason& hpp::statistics::SuccessBin::reason ( ) const
inline

If this bin represents 'failure', returns the reason.

Referenced by operator<(), and operator==().

const std::string& hpp::statistics::SuccessBin::reasonString ( ) const
inline

If this bin represents 'failure', returns the reason as a string.

Member Data Documentation

const Reason hpp::statistics::SuccessBin::REASON_UNKNOWN
static

The default reason for 'failure'.