Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Timer Class Reference

A basic timer class to assist in timed operations. More...

#include <timer.h>

+ Inheritance diagram for Mezzanine::Timer:

Public Member Functions

 Timer ()
 Class Constructor.
 
 ~Timer ()
 Class Destructor.
 
Mezzanine::CountMode GetCountMode () const
 Gets the mode the timer is using to increment time. More...
 
Whole GetCurrentTime ()
 Gets the Current time in Microseconds. More...
 
Whole GetCurrentTimeInMilliseconds ()
 Gets the Current time in Milliseconds. More...
 
String GetTimeAsText (const Mezzanine::TimeFormat Format)
 Gets the current time of this Timer as a string. More...
 
Boole IsStopped ()
 Gets whether or not this Timer is currently running. More...
 
Boole IsTicking ()
 Gets whether or not this Timer is currently running. More...
 
void Reset (const Whole StartTime=0)
 Sets the current time to an initial value and stops the Timer if it is running. More...
 
void SetCountMode (const Mezzanine::CountMode Mode)
 Sets the mode the timer should use to increment time. More...
 
void SetCurrentTime (const Whole Current)
 Sets the current time in Microseconds. More...
 
void SetCurrentTimeInMilliseconds (const Whole Current)
 Sets the current time in Milliseconds. The time that resetting sets the Timer to. More...
 
void Start ()
 Activates the Timer.
 
void Stop ()
 Deactivates the Timer.
 

Protected Types

typedef MaxInt(* CountFunct) (const MaxInt, const MaxInt)
 Convenience type for processing the current time. More...
 

Protected Member Functions

MaxInt UpdateTime ()
 Updates the current time being tracked by this timer. More...
 

Protected Attributes

MaxInt CurrentTime
 The current amount of microseconds that has elapsed since starting to track time. More...
 
MaxInt LastStamp
 The time stamp from when the last time the Timer was updated. More...
 
CountFunct TimerCounter
 A pointer to the function currently doing the counting for this Timer. More...
 

Detailed Description

A basic timer class to assist in timed operations.

Definition at line 67 of file timer.h.

Member Typedef Documentation

typedef MaxInt(* Mezzanine::Timer::CountFunct) (const MaxInt, const MaxInt)
protected

Convenience type for processing the current time.

Definition at line 72 of file timer.h.

Member Function Documentation

Mezzanine::CountMode Mezzanine::Timer::GetCountMode ( ) const

Gets the mode the timer is using to increment time.

Returns
Returns a CountMode enum value determining if this timer is counting up or down from it's current time.

Definition at line 107 of file timer.cpp.

Whole Mezzanine::Timer::GetCurrentTime ( )

Gets the Current time in Microseconds.

Returns
Returns a Whole representing the current time in Microseconds.

Definition at line 95 of file timer.cpp.

Whole Mezzanine::Timer::GetCurrentTimeInMilliseconds ( )

Gets the Current time in Milliseconds.

Returns
Returns a Whole representing the current time in Milliseconds.

Definition at line 98 of file timer.cpp.

String Mezzanine::Timer::GetTimeAsText ( const Mezzanine::TimeFormat  Format)

Gets the current time of this Timer as a string.

Parameters
FormatA TimeFormat enum value representing how the current time should be presented.
Returns
Returns a string containing a description of the current time in the specified format.

Definition at line 145 of file timer.cpp.

Boole Mezzanine::Timer::IsStopped ( )

Gets whether or not this Timer is currently running.

Returns
Returns true if this Timer is not currently active, false otherwise.

Definition at line 139 of file timer.cpp.

Boole Mezzanine::Timer::IsTicking ( )

Gets whether or not this Timer is currently running.

Returns
Returns true if this Timer is active, false if it is stopped.

Definition at line 133 of file timer.cpp.

void Mezzanine::Timer::Reset ( const Whole  StartTime = 0)

Sets the current time to an initial value and stops the Timer if it is running.

Parameters
StartTimeThe time in microseconds to be begin the Timer at the next time it is started.

Definition at line 127 of file timer.cpp.

void Mezzanine::Timer::SetCountMode ( const Mezzanine::CountMode  Mode)

Sets the mode the timer should use to increment time.

Parameters
ModeThe mode to be set, see the CountMode enum for more details.

Definition at line 101 of file timer.cpp.

void Mezzanine::Timer::SetCurrentTime ( const Whole  Current)

Sets the current time in Microseconds.

Returns
Returns a reference to this Timer.
Parameters
CurrentThe value to set as current time in Microseconds.

Definition at line 89 of file timer.cpp.

void Mezzanine::Timer::SetCurrentTimeInMilliseconds ( const Whole  Current)

Sets the current time in Milliseconds. The time that resetting sets the Timer to.

Returns
Returns a reference to this Timer.
Parameters
CurrentThe value to set as current time in Milliseconds.

Definition at line 92 of file timer.cpp.

MaxInt Mezzanine::Timer::UpdateTime ( )
protected

Updates the current time being tracked by this timer.

Returns
Returns the updated current time.

Definition at line 72 of file timer.cpp.

Member Data Documentation

MaxInt Mezzanine::Timer::CurrentTime
protected

The current amount of microseconds that has elapsed since starting to track time.

Definition at line 79 of file timer.h.

MaxInt Mezzanine::Timer::LastStamp
protected

The time stamp from when the last time the Timer was updated.

Definition at line 76 of file timer.h.

CountFunct Mezzanine::Timer::TimerCounter
protected

A pointer to the function currently doing the counting for this Timer.

Definition at line 82 of file timer.h.


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