GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
GRT::Timer Class Reference

Public Member Functions

 Timer ()
 
 ~Timer ()
 
bool start ()
 
bool start (unsigned long countDownTime)
 
bool stop ()
 
signed long getMilliSeconds () const
 
double getSeconds () const
 
bool running () const
 
bool getTimerReached () const
 
bool timerReached () const
 

Static Public Member Functions

static unsigned long getSystemTime ()
 

Protected Types

enum  TimerModes { NORMAL_MODE =0, COUNTDOWN_MODE }
 

Protected Attributes

unsigned long startTime
 
unsigned long countDownTime
 
unsigned int timerMode
 
bool timerRunning
 

Detailed Description

Definition at line 42 of file Timer.h.

Constructor & Destructor Documentation

GRT::Timer::Timer ( )
inline

Default constructor.

Definition at line 47 of file Timer.h.

GRT::Timer::~Timer ( )
inline

Default destructor.

Definition at line 52 of file Timer.h.

Member Function Documentation

signed long GRT::Timer::getMilliSeconds ( ) const
inline

Gets the current time in milliseconds. If the timer is in NORMAL_MODE then this value will be the time since the timer was started. If the timer was in COUNTDOWN_MODE then this value will be the countdown time, minus the time since the timer started.

Returns
returns the current time elapsed in milliseconds (1000 milliseconds == 1 second) or 0 if the timer is not running

Definition at line 100 of file Timer.h.

double GRT::Timer::getSeconds ( ) const
inline

Gets the current time in seconds. If the timer is in NORMAL_MODE then this value will be the time since the timer was started. If the timer was in COUNTDOWN_MODE then this value will be the countdown time, minus the time since the timer started. Unlike the getMilliSeconds() function, in which 1.0 represents 1 millisecond; this function represents 1.0 as 1 second (so 0.5 is 500 milliseconds).

Returns
returns the current time elapsed in seconds or 0 if the timer is not running

Definition at line 128 of file Timer.h.

static unsigned long GRT::Timer::getSystemTime ( )
inlinestatic

Gets if the current system time.

Returns
returns the current system time.

Definition at line 165 of file Timer.h.

bool GRT::Timer::getTimerReached ( ) const
inline

Gets if the countdown time has been reached.

Returns
returns true if the countdown time has been reached, false otherwise

Definition at line 145 of file Timer.h.

bool GRT::Timer::running ( ) const
inline

Gets if the timer is running.

Returns
returns true if the timer is running, false otherwise

Definition at line 138 of file Timer.h.

bool GRT::Timer::start ( )
inline

Starts the timer. This starts the timer in NORMAL_MODE, in this mode the timer will run forever.

Returns
returns true if the timer was started successfully, false otherwise

Definition at line 59 of file Timer.h.

bool GRT::Timer::start ( unsigned long  countDownTime)
inline

Starts the timer. This starts the timer in COUNTDOWN_MODE, in this mode the timer will start at the specified countdown time and count down until it reaches zero. At zero, the timer will set its state to timerRunning = false, however the timer will continue to countdown resulting in a negative query time.

Parameters
unsignedlong countDownTime: sets the countdown time, this should be in milliseconds (i.e. start(5000) would start the timer with a countdown time of 5 seconds)
Returns
returns true if the timer was started successfully, false otherwise

Definition at line 73 of file Timer.h.

bool GRT::Timer::stop ( )
inline

Stops the timer.

Returns
returns true if the timer was stopped successfully, false otherwise

Definition at line 89 of file Timer.h.

bool GRT::Timer::timerReached ( ) const
inline

This function is now deprecated, you should use getTimerReached() instead.

Definition at line 156 of file Timer.h.


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