STIR  6.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
stir::Timer Class Referenceabstract

A general base class for timers. Interface is like a stop watch. More...

#include "stir/Timer.h"

Inheritance diagram for stir::Timer:
Inheritance graph
[legend]

Public Member Functions

void start (bool do_reset=false)
 start stopwatch, optionally resetting first More...
 
void stop ()
 stop stopwatch
 
void reset ()
 reset stopwatch More...
 
double value () const
 return value is undefined when start() is not called first.
 

Protected Member Functions

virtual double get_current_value () const =0
 

Protected Attributes

bool running
 
double previous_value
 
double previous_total_value
 

Detailed Description

A general base class for timers. Interface is like a stop watch.

Example of usage:
DerivedFromTimer t;
t.start();
// do things
cerr << t.value();
// do things
t.stop();
// do things
t.reset()
// etc

Derived classes simply have to implement the virtual function double get_current_value()

Member Function Documentation

◆ start()

void stir::Timer::start ( bool  do_reset = false)
inline

◆ reset()

void stir::Timer::reset ( void  )
inline

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