Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Chrono Class Reference

Elapsed real-time timer. More...

#include <Chrono.h>

Public Member Functions

 Chrono ()
 default constructor More...
 
 Chrono (double)
 new chrono that starts directly at the given time More...
 
double get () const
 if running, get the value (start time - now) without stopping the chrono, else get (start time - stop time) value this method is declared to be const, because we need to call it in << (and of course, no data member is modified More...
 
void hold (bool)
 pause the chrono if the parameter is true More...
 
void reset ()
 reset to zero More...
 
void start ()
 start at zero More...
 
void start (double)
 start at a given value More...
 
double stop ()
 stop chrono More...
 
 ~Chrono ()
 

Private Member Functions

double getTimeInMilliseconds () const
 in milliseconds More...
 

Private Attributes

double accumulatedTime
 
bool running
 
double startValue
 
double stopValue
 

Friends

std::ostream & operator<< (std::ostream &, const Chrono)
 print the value of the chrono on the stream More...
 

Detailed Description

Elapsed real-time timer.

Allows one to measure elapsed real time. You can start, stop, reset and of course get and print the current values of this chronometer.

Constructor & Destructor Documentation

Chrono::Chrono ( )

default constructor

References accumulatedTime, running, startValue, and stopValue.

Chrono::Chrono ( double  init)

new chrono that starts directly at the given time

References accumulatedTime, init(), running, startValue, and stopValue.

Chrono::~Chrono ( )

Member Function Documentation

double Chrono::get ( ) const

if running, get the value (start time - now) without stopping the chrono, else get (start time - stop time) value this method is declared to be const, because we need to call it in << (and of course, no data member is modified

References accumulatedTime, getTimeInMilliseconds(), running, startValue, and stopValue.

Referenced by operator<<().

double Chrono::getTimeInMilliseconds ( ) const
private

in milliseconds

Referenced by get(), start(), and stop().

void Chrono::hold ( bool  pause)

pause the chrono if the parameter is true

References accumulatedTime, start(), and stop().

void Chrono::reset ( )

reset to zero

References accumulatedTime, running, startValue, and stopValue.

void Chrono::start ( )
void Chrono::start ( double  init)

start at a given value

References init(), running, start(), startValue, and stopValue.

double Chrono::stop ( )

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const Chrono  c 
)
friend

print the value of the chrono on the stream

Member Data Documentation

double Chrono::accumulatedTime
private

Referenced by Chrono(), get(), hold(), reset(), start(), and stop().

bool Chrono::running
private

Referenced by Chrono(), get(), reset(), start(), and stop().

double Chrono::startValue
private

Referenced by Chrono(), get(), reset(), start(), and stop().

double Chrono::stopValue
private

Referenced by Chrono(), get(), reset(), start(), and stop().


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