Class counting pass/fail events. More...
#include <PassCounter.h>
Public Types | |
using | Count_t = Count |
Type used for counters. More... | |
Public Member Functions | |
Access | |
Count_t | passed () const |
Returns the number of events which "passed". More... | |
Count_t | failed () const |
Returns the number of events which "failed". More... | |
Count_t | total () const |
Returns the total number of registered events. More... | |
bool | empty () const |
Returns whether there is no event recorded yet. More... | |
Registration and reset | |
void | add (bool pass) |
Adds a single event, specifying whether it "passes" or not. More... | |
void | addFailed () |
Adds a single event which did not "pass". More... | |
void | addPassed () |
Adds a single event which did "pass". More... | |
void | reset () |
Resets all counts. More... | |
Protected Member Functions | |
Count_t const & | totalRef () const |
Direct read-only access to data members for derived classes. More... | |
Count_t const & | passedRef () const |
Direct read-only access to data members for derived classes. More... | |
Private Attributes | |
Count_t | fTotal {} |
Total entries. More... | |
Count_t | fPassed {} |
Entries which "passed". More... | |
Class counting pass/fail events.
Count | (default: unsigned int ) type of counter |
The class keeps track of events which may fall in one of two categories, called "passed" and "failed". Example of usage:
will print: Counted 7 odd entries and 8 even entries, 15 in total.
.
The type Count
must support:
operator++()
operator-(Count)
Definition at line 15 of file PassCounter.h.
using icarus::ns::util::PassCounter< Count >::Count_t = Count |
Type used for counters.
Definition at line 45 of file PassCounter.h.
void icarus::ns::util::PassCounter< Count >::add | ( | bool | pass | ) |
Adds a single event, specifying whether it "passes" or not.
Definition at line 112 of file PassCounter.h.
|
inline |
Adds a single event which did not "pass".
Definition at line 76 of file PassCounter.h.
|
inline |
Adds a single event which did "pass".
Definition at line 79 of file PassCounter.h.
|
inline |
Returns whether there is no event recorded yet.
Definition at line 63 of file PassCounter.h.
|
inline |
Returns the number of events which "failed".
Definition at line 57 of file PassCounter.h.
|
inline |
Returns the number of events which "passed".
Definition at line 54 of file PassCounter.h.
|
inlineprotected |
Direct read-only access to data members for derived classes.
Definition at line 93 of file PassCounter.h.
void icarus::ns::util::PassCounter< Count >::reset | ( | ) |
Resets all counts.
Definition at line 122 of file PassCounter.h.
|
inline |
|
inlineprotected |
Direct read-only access to data members for derived classes.
Definition at line 90 of file PassCounter.h.
|
private |
Entries which "passed".
Definition at line 100 of file PassCounter.h.
|
private |
Total entries.
Definition at line 99 of file PassCounter.h.