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

Public Member Functions

 Timer ()
 
 ~Timer ()
 
bool start ()
 
bool start (unsigned long countDownTime, unsigned long prepTime=0)
 
bool stop ()
 
signed long getMilliSeconds ()
 
Float getSeconds ()
 
bool running ()
 
bool getTimerRunning ()
 
bool getTimerReached ()
 
bool getInPrepState () const
 
bool getInCountdownState () const
 
bool timerReached ()
 

Static Public Member Functions

static unsigned long getSystemTime ()
 

Protected Types

enum  TimerMode { NORMAL_MODE =0, COUNTDOWN_MODE }
 
enum  TimerState { NOT_RUNNING =0, RUNNING, COUNTDOWN_STATE, PREP_STATE }
 

Protected Attributes

unsigned long startTime
 
unsigned long countDownTime
 
unsigned long prepTime
 
bool timerRunning
 
TimerMode timerMode
 
TimerState timerState
 

Detailed Description

Definition at line 43 of file Timer.h.

Constructor & Destructor Documentation

Timer::Timer ( )
inline

Default constructor.

Definition at line 48 of file Timer.h.

Timer::~Timer ( )
inline

Default destructor.

Definition at line 57 of file Timer.h.

Member Function Documentation

signed long Timer::getMilliSeconds ( )
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 117 of file Timer.h.

Float Timer::getSeconds ( )
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 153 of file Timer.h.

static unsigned long Timer::getSystemTime ( )
inlinestatic

Gets if the current system time.

Returns
returns the current system time.

Definition at line 211 of file Timer.h.

bool Timer::getTimerReached ( )
inline

Gets if the countdown time has been reached.

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

Definition at line 183 of file Timer.h.

bool Timer::getTimerRunning ( )
inline

Gets if the timer is running.

Returns
returns true if the timer is running, false otherwise

Definition at line 170 of file Timer.h.

bool Timer::running ( )
inline

Gets if the timer is running.

Returns
returns true if the timer is running, false otherwise

Definition at line 163 of file Timer.h.

bool 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 64 of file Timer.h.

bool Timer::start ( unsigned long  countDownTime,
unsigned long  prepTime = 0 
)
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. The second option controls the preperation time, this is useful if you are recording a gesture and want to have a short pause after triggering the recording before data is actually recorded/tagged. If the prepTime parameter is larger than zero, then the timer will enter the PREP_STATE for the specified prepTime before entering the COUNTDOWN_STATE.

Parameters
countDownTimesets 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 81 of file Timer.h.

bool Timer::stop ( )
inline

Stops the timer.

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

Definition at line 105 of file Timer.h.

bool Timer::timerReached ( )
inline

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

Definition at line 202 of file Timer.h.


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