All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Private Types | List of all members
icarus::ns::util::AtomicPassCounter< Count > Class Template Reference

Class counting pass/fail events. More...

#include <AtomicPassCounter.h>

Inheritance diagram for icarus::ns::util::AtomicPassCounter< Count >:
icarus::ns::util::PassCounter< std::atomic< Count > >

Public Types

using Count_t = Count
 Type used for counters. More...
 
- Public Types inherited from icarus::ns::util::PassCounter< std::atomic< Count > >
using Count_t = std::atomic< 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...
 
- Public Member Functions inherited from icarus::ns::util::PassCounter< std::atomic< Count > >
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...
 
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...
 

Private Types

using Base_t = icarus::ns::util::PassCounter< std::atomic< Count >>
 

Additional Inherited Members

- Protected Member Functions inherited from icarus::ns::util::PassCounter< std::atomic< Count > >
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...
 

Detailed Description

template<typename Count>
class icarus::ns::util::AtomicPassCounter< Count >

Class counting pass/fail events.

Template Parameters
Count(default: unsigned int) type of counter
See Also
icarus::ns::util::PassCounter

This is an implementation of icarus::ns::util::PassCounter using atomic counters, inherently thread-safe. Only Count types that are lock-free (``) are supported.

This class exposes an interface equivalent to PassCounter: see its documentation for usage details.

Definition at line 22 of file AtomicPassCounter.h.

Member Typedef Documentation

template<typename Count >
using icarus::ns::util::AtomicPassCounter< Count >::Base_t = icarus::ns::util::PassCounter<std::atomic<Count>>
private

Definition at line 45 of file AtomicPassCounter.h.

template<typename Count >
using icarus::ns::util::AtomicPassCounter< Count >::Count_t = Count

Type used for counters.

Definition at line 48 of file AtomicPassCounter.h.

Member Function Documentation

template<typename Count >
bool icarus::ns::util::AtomicPassCounter< Count >::empty ( ) const
inline

Returns whether there is no event recorded yet.

Definition at line 66 of file AtomicPassCounter.h.

66 { return total() == Count_t{}; }
Count_t total() const
Returns the total number of registered events.
Count Count_t
Type used for counters.
template<typename Count >
Count_t icarus::ns::util::AtomicPassCounter< Count >::failed ( ) const
inline

Returns the number of events which "failed".

Definition at line 60 of file AtomicPassCounter.h.

60 { return total() - passed(); }
Count_t total() const
Returns the total number of registered events.
Count_t passed() const
Returns the number of events which &quot;passed&quot;.
template<typename Count >
Count_t icarus::ns::util::AtomicPassCounter< Count >::passed ( ) const
inline

Returns the number of events which "passed".

Definition at line 57 of file AtomicPassCounter.h.

57 { return Base_t::passedRef().load(); }
Count_t const & passedRef() const
Direct read-only access to data members for derived classes.
Definition: PassCounter.h:93
template<typename Count >
Count_t icarus::ns::util::AtomicPassCounter< Count >::total ( ) const
inline

Returns the total number of registered events.

Definition at line 63 of file AtomicPassCounter.h.

63 { return Base_t::totalRef().load(); }
Count_t const & totalRef() const
Direct read-only access to data members for derived classes.
Definition: PassCounter.h:90

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