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

An enhanced timer class that can store and track many units of time. More...

#include <extendedtimer.h>

+ Inheritance diagram for Mezzanine::ExtendedTimer:
+ Collaboration diagram for Mezzanine::ExtendedTimer:

Public Types

enum  TimeStruct { Current, Goal, Initial }
 The internal time struct to be used... More...
 

Public Member Functions

 ExtendedTimer (const Timer::TimerStyle style)
 Standard Constructor. More...
 
virtual ~ExtendedTimer ()
 Class destructor.
 
virtual Integer GetDays (const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Gets the current internal Day count. More...
 
virtual Integer GetHours (const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Gets the current internal Hour count. More...
 
virtual Integer GetMilliseconds (const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Gets the current internal Millisecond count. More...
 
virtual Integer GetMinutes (const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Gets the current internal Minute count. More...
 
virtual Integer GetSeconds (const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Gets the current internal Second count. More...
 
virtual void Reset ()
 Sets the current values to their initial values.
 
virtual ExtendedTimerSetAutoReset (const Boole AutoReset)
 Sets whether or not the Timer should reset if it reaches it's goal.
Ex. If a stopwatch reaches 0. More...
 
virtual ExtendedTimerSetDays (Integer Day, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Days of the specified struct. More...
 
virtual ExtendedTimerSetHours (Integer Hr, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Hours of the specified struct. More...
 
virtual ExtendedTimerSetMicroseconds (Integer MS, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Microseconds of the specified struct. More...
 
virtual ExtendedTimerSetMilliseconds (Integer MS, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Milliseconds of the specified struct. More...
 
virtual ExtendedTimerSetMinutes (Integer Min, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Minutes of the specified struct. More...
 
virtual ExtendedTimerSetSeconds (Integer Sec, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current)
 Sets the value for Seconds of the specified struct. More...
 
- Public Member Functions inherited from Mezzanine::Timer
 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 Member Functions

virtual Boole CheckAll (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckDays (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckHours (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckMicroSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckMilliSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckMinutes (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CheckSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole CompareCurrentAndGoal (const Integer Current, const Integer Goal)
 
virtual TimeGetStruct (const ExtendedTimer::TimeStruct Struct)
 
virtual Boole GoalReached ()
 
virtual void Update (const Whole MicroSecondsElapsed)
 
virtual void UpdateAsNormal (const Whole MicroSecondsElapsed)
 
virtual void UpdateAsStopWatch (const Whole MicroSecondsElapsed)
 
- Protected Member Functions inherited from Mezzanine::Timer
MaxInt UpdateTime ()
 Updates the current time being tracked by this timer. More...
 

Protected Attributes

Time CurrentTime
 
Time GoalTime
 
Time InitialTime
 
- Protected Attributes inherited from Mezzanine::Timer
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...
 

Additional Inherited Members

- Protected Types inherited from Mezzanine::Timer
typedef MaxInt(* CountFunct) (const MaxInt, const MaxInt)
 Convenience type for processing the current time. More...
 

Detailed Description

An enhanced timer class that can store and track many units of time.

This timer class should be used only for longer periods, such as tracking game uptime. For shorter periods of time look at the SimpleTimer class.

Definition at line 72 of file extendedtimer.h.

Member Enumeration Documentation

The internal time struct to be used...

Enumerator
Current 

Current description.

Goal 

Goal description.

Initial 

Initial description.

Definition at line 76 of file extendedtimer.h.

Constructor & Destructor Documentation

Mezzanine::ExtendedTimer::ExtendedTimer ( const Timer::TimerStyle  style)

Standard Constructor.

Parameters
styleThe styling/type of timer to be constructed.

Definition at line 48 of file extendedtimer.cpp.

Member Function Documentation

Integer Mezzanine::ExtendedTimer::GetDays ( const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current)
virtual

Gets the current internal Day count.

Returns
Returns an Integer representing the current Day count of this Timer.
Parameters
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 367 of file extendedtimer.cpp.

Integer Mezzanine::ExtendedTimer::GetHours ( const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current)
virtual

Gets the current internal Hour count.

Returns
Returns an Integer representing the current Hour count of this Timer.
Parameters
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 362 of file extendedtimer.cpp.

Integer Mezzanine::ExtendedTimer::GetMilliseconds ( const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current)
virtual

Gets the current internal Millisecond count.

Returns
Returns an Integer representing the current Millisecond count of this Timer.
Parameters
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 347 of file extendedtimer.cpp.

Integer Mezzanine::ExtendedTimer::GetMinutes ( const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current)
virtual

Gets the current internal Minute count.

Returns
Returns an Integer representing the current Minute count of this Timer.
Parameters
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 357 of file extendedtimer.cpp.

Integer Mezzanine::ExtendedTimer::GetSeconds ( const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current)
virtual

Gets the current internal Second count.

Returns
Returns an Integer representing the current Second count of this Timer.
Parameters
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 352 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetAutoReset ( const Boole  AutoReset)
virtual

Sets whether or not the Timer should reset if it reaches it's goal.
Ex. If a stopwatch reaches 0.

Returns
Returns a reference to this timer.

Definition at line 294 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetDays ( Integer  Day,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Days of the specified struct.

Returns
Returns a reference to this timer.
Parameters
DayThe number of Days to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 341 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetHours ( Integer  Hr,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Hours of the specified struct.

If a number greater then 23 is passed in, it will be reduced to 23.

Returns
Returns a reference to this timer.
Parameters
HrThe number of Hours to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 334 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetMicroseconds ( Integer  MS,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Microseconds of the specified struct.

If a number greater then 999 is passed in, it will be reduced to 999.

Returns
Returns a reference to this timer.
Parameters
MSThe number of Microseconds to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 300 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetMilliseconds ( Integer  MS,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Milliseconds of the specified struct.

If a number greater then 999 is passed in, it will be reduced to 999.

Returns
Returns a reference to this timer.
Parameters
MSThe number of Milliseconds to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 307 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetMinutes ( Integer  Min,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Minutes of the specified struct.

If a number greater then 59 is passed in, it will be reduced to 59.

Returns
Returns a reference to this timer.
Parameters
MinThe number of Minutes to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 326 of file extendedtimer.cpp.

ExtendedTimer & Mezzanine::ExtendedTimer::SetSeconds ( Integer  Sec,
const ExtendedTimer::TimeStruct  Struct = ExtendedTimer::Current 
)
virtual

Sets the value for Seconds of the specified struct.

If a number greater then 59 is passed in, it will be reduced to 59.

Returns
Returns a reference to this timer.
Parameters
SecThe number of Seconds to set.
StructThe Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current

Definition at line 317 of file extendedtimer.cpp.


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