Thrill  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TimedCounter Class Reference

Detailed Description

TimedCounter counts the number of Trigger() invokes. The time points of these invocations are stored.

Definition at line 24 of file timed_counter.hpp.

#include <timed_counter.hpp>

Public Types

using TimePoint = std::chrono::high_resolution_clock::time_point
 

Public Member Functions

 TimedCounter (const TimedCounter &that)=delete
 
 TimedCounter (TimedCounter &&rhs)
 
 TimedCounter ()
 
size_t Count () const
 Returns the number of Occurences on this timer. More...
 
std::vector< TimePointOccurences () const
 Returns the Occurences of this timer. More...
 
TimedCounter operator+ (const TimedCounter &rhs)
 Adds occurences of two instances and sorts them ascending. More...
 
TimedCounteroperator+= (const TimedCounter &rhs)
 
void Reset ()
 Drops all Occurences of this timer. More...
 
void Trigger ()
 Registers a new Occurence on this TimedCounter. More...
 

Private Member Functions

TimePoint timestamp ()
 

Private Attributes

std::vector< TimePointoccurences_
 

Member Typedef Documentation

◆ TimePoint

using TimePoint = std::chrono::high_resolution_clock::time_point

Definition at line 27 of file timed_counter.hpp.

Constructor & Destructor Documentation

◆ TimedCounter() [1/3]

TimedCounter ( const TimedCounter that)
delete

◆ TimedCounter() [2/3]

TimedCounter ( TimedCounter &&  rhs)
inline

Definition at line 32 of file timed_counter.hpp.

References TimedCounter::occurences_.

◆ TimedCounter() [3/3]

TimedCounter ( )
inline

Definition at line 36 of file timed_counter.hpp.

Member Function Documentation

◆ Count()

size_t Count ( ) const
inline

Returns the number of Occurences on this timer.

Definition at line 66 of file timed_counter.hpp.

References TimedCounter::occurences_.

◆ Occurences()

std::vector<TimePoint> Occurences ( ) const
inline

Returns the Occurences of this timer.

Definition at line 71 of file timed_counter.hpp.

References TimedCounter::occurences_.

Referenced by TimedCounter::operator+=().

◆ operator+()

TimedCounter operator+ ( const TimedCounter rhs)
inline

Adds occurences of two instances and sorts them ascending.

Definition at line 48 of file timed_counter.hpp.

◆ operator+=()

TimedCounter& operator+= ( const TimedCounter rhs)
inline

Adds the occurences of another TimedCounter to this instance. Occurences will be sorted to be ascending

Definition at line 40 of file timed_counter.hpp.

References TimedCounter::Occurences(), and TimedCounter::occurences_.

◆ Reset()

void Reset ( )
inline

Drops all Occurences of this timer.

Definition at line 61 of file timed_counter.hpp.

References TimedCounter::occurences_.

◆ timestamp()

TimePoint timestamp ( )
inlineprivate

Definition at line 76 of file timed_counter.hpp.

Referenced by TimedCounter::Trigger().

◆ Trigger()

void Trigger ( )
inline

Registers a new Occurence on this TimedCounter.

Definition at line 56 of file timed_counter.hpp.

References TimedCounter::occurences_, and TimedCounter::timestamp().

Member Data Documentation

◆ occurences_


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