Public Member Functions | Private Types | Private Attributes | Friends | List of all members
PLMD::Stopwatch::Watch Class Reference

Class to store a single stopwatch. More...

#include <Stopwatch.h>

Public Member Functions

long long int getLastCycle () noexcept
 returns the time for the last cycle More...
 
long long int getTotal () noexcept
 returns the total time More...
 
Watchpause ()
 pause the watch More...
 
Watchstart ()
 start the watch More...
 
Handler startPause ()
 returns a start-pause handler More...
 
Handler startStop ()
 returns a start-stop handler More...
 
Watchstop ()
 stop the watch More...
 

Private Types

enum  State { State::started, State::stopped, State::paused }
 

Private Attributes

unsigned cycles = 0
 Total number of cycles. More...
 
long long int lap = 0
 Accumulated time for this lap, in nanoseconds. More...
 
long long int lastLap = 0
 last lap More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > lastStart
 Instant in time when Watch was started last time. More...
 
long long int max = 0
 Slowest lap so far, in nanoseconds. More...
 
long long int min = 0
 Fastest lap so far, in nanoseconds. More...
 
unsigned running = 0
 count how many times Watch was started (+1) or stopped/paused (-1). More...
 
State state = State::stopped
 keep track of state More...
 
long long int total = 0
 Total accumulated time, in nanoseconds. More...
 

Friends

class Stopwatch
 Allows access to internal data. More...
 

Detailed Description

Class to store a single stopwatch.

Class Stopwatch contains a collection of them

Member Enumeration Documentation

◆ State

enum PLMD::Stopwatch::Watch::State
strongprivate
Enumerator
started 
stopped 
paused 

Member Function Documentation

◆ getLastCycle()

long long int PLMD::Stopwatch::Watch::getLastCycle ( )
inlinenoexcept

returns the time for the last cycle

◆ getTotal()

long long int PLMD::Stopwatch::Watch::getTotal ( )
inlinenoexcept

returns the total time

◆ pause()

Stopwatch::Watch & PLMD::Stopwatch::Watch::pause ( )
inline

pause the watch

◆ start()

Stopwatch::Watch & PLMD::Stopwatch::Watch::start ( )
inline

start the watch

◆ startPause()

Stopwatch::Handler PLMD::Stopwatch::Watch::startPause ( )
inline

returns a start-pause handler

◆ startStop()

Stopwatch::Handler PLMD::Stopwatch::Watch::startStop ( )
inline

returns a start-stop handler

◆ stop()

Stopwatch::Watch & PLMD::Stopwatch::Watch::stop ( )
inline

stop the watch

Friends And Related Function Documentation

◆ Stopwatch

friend class Stopwatch
friend

Allows access to internal data.

Member Data Documentation

◆ cycles

unsigned PLMD::Stopwatch::Watch::cycles = 0
private

Total number of cycles.

◆ lap

long long int PLMD::Stopwatch::Watch::lap = 0
private

Accumulated time for this lap, in nanoseconds.

◆ lastLap

long long int PLMD::Stopwatch::Watch::lastLap = 0
private

last lap

◆ lastStart

std::chrono::time_point<std::chrono::high_resolution_clock> PLMD::Stopwatch::Watch::lastStart
private

Instant in time when Watch was started last time.

◆ max

long long int PLMD::Stopwatch::Watch::max = 0
private

Slowest lap so far, in nanoseconds.

◆ min

long long int PLMD::Stopwatch::Watch::min = 0
private

Fastest lap so far, in nanoseconds.

◆ running

unsigned PLMD::Stopwatch::Watch::running = 0
private

count how many times Watch was started (+1) or stopped/paused (-1).

◆ state

State PLMD::Stopwatch::Watch::state = State::stopped
private

keep track of state

◆ total

long long int PLMD::Stopwatch::Watch::total = 0
private

Total accumulated time, in nanoseconds.


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