Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

cxxtimer::Timer Class Reference

This class works as a stopwatch. More...

#include <cxxtimer.hpp>

Public Member Functions

 Timer (bool start=false)
 Constructor. More...
 
 Timer (const Timer &other)=default
 Copy constructor. More...
 
 Timer (Timer &&other)=default
 Transfer constructor. More...
 
virtual ~Timer ()=default
 Destructor. More...
 
Timeroperator= (const Timer &other)=default
 Assignment operator by copy. More...
 
Timeroperator= (Timer &&other)=default
 Assignment operator by transfer. More...
 
void start ()
 Start/resume the timer. More...
 
void stop ()
 Stop/pause the timer. More...
 
void reset ()
 Reset the timer. More...
 
template<class duration_t = std::chrono::milliseconds>
duration_t::rep count () const
 Return the elapsed time. More...
 

Private Attributes

bool started_
 
bool paused_
 
std::chrono::steady_clock::time_point reference_
 
std::chrono::duration< long double > accumulated_
 

Detailed Description

This class works as a stopwatch.

Definition at line 38 of file cxxtimer.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/3]

cxxtimer::Timer::Timer ( bool  start = false)
inline

Constructor.

Parameters
startIf true, the timer is started just after construction. Otherwise, it will not be automatically started.

Definition at line 131 of file cxxtimer.hpp.

References start().

◆ Timer() [2/3]

cxxtimer::Timer::Timer ( const Timer other)
default

Copy constructor.

Parameters
otherThe object to be copied.

◆ Timer() [3/3]

cxxtimer::Timer::Timer ( Timer &&  other)
default

Transfer constructor.

Parameters
otherThe object to be transfered.

◆ ~Timer()

virtual cxxtimer::Timer::~Timer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ count()

◆ operator=() [1/2]

Timer& cxxtimer::Timer::operator= ( const Timer other)
default

Assignment operator by copy.

Parameters
otherThe object to be copied.
Returns
A reference to this object.

◆ operator=() [2/2]

Timer& cxxtimer::Timer::operator= ( Timer &&  other)
default

Assignment operator by transfer.

Parameters
otherThe object to be transferred.
Returns
A reference to this object.

◆ reset()

void cxxtimer::Timer::reset ( )
inline

Reset the timer.

Definition at line 160 of file cxxtimer.hpp.

◆ start()

void cxxtimer::Timer::start ( )
inline

Start/resume the timer.

Definition at line 140 of file cxxtimer.hpp.

Referenced by Timer().

◆ stop()

Member Data Documentation

◆ accumulated_

std::chrono::duration<long double> cxxtimer::Timer::accumulated_
private

Definition at line 125 of file cxxtimer.hpp.

◆ paused_

bool cxxtimer::Timer::paused_
private

Definition at line 123 of file cxxtimer.hpp.

◆ reference_

std::chrono::steady_clock::time_point cxxtimer::Timer::reference_
private

Definition at line 124 of file cxxtimer.hpp.

◆ started_

bool cxxtimer::Timer::started_
private

Definition at line 122 of file cxxtimer.hpp.


The documentation for this class was generated from the following file:
Released under the MIT license