An enhanced timer class that can store and track many units of time. More...
#include <extendedtimer.h>
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 ExtendedTimer & | SetAutoReset (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 ExtendedTimer & | SetDays (Integer Day, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current) |
Sets the value for Days of the specified struct. More... | |
virtual ExtendedTimer & | SetHours (Integer Hr, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current) |
Sets the value for Hours of the specified struct. More... | |
virtual ExtendedTimer & | SetMicroseconds (Integer MS, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current) |
Sets the value for Microseconds of the specified struct. More... | |
virtual ExtendedTimer & | SetMilliseconds (Integer MS, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current) |
Sets the value for Milliseconds of the specified struct. More... | |
virtual ExtendedTimer & | SetMinutes (Integer Min, const ExtendedTimer::TimeStruct Struct=ExtendedTimer::Current) |
Sets the value for Minutes of the specified struct. More... | |
virtual ExtendedTimer & | SetSeconds (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 Time & | GetStruct (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... | |
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.
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.
Mezzanine::ExtendedTimer::ExtendedTimer | ( | const Timer::TimerStyle | style | ) |
Standard Constructor.
style | The styling/type of timer to be constructed. |
Definition at line 48 of file extendedtimer.cpp.
|
virtual |
Gets the current internal Day count.
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 367 of file extendedtimer.cpp.
|
virtual |
Gets the current internal Hour count.
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 362 of file extendedtimer.cpp.
|
virtual |
Gets the current internal Millisecond count.
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 347 of file extendedtimer.cpp.
|
virtual |
Gets the current internal Minute count.
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 357 of file extendedtimer.cpp.
|
virtual |
Gets the current internal Second count.
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 352 of file extendedtimer.cpp.
|
virtual |
Sets whether or not the Timer should reset if it reaches it's goal.
Ex. If a stopwatch reaches 0.
Definition at line 294 of file extendedtimer.cpp.
|
virtual |
Sets the value for Days of the specified struct.
Day | The number of Days to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 341 of file extendedtimer.cpp.
|
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.
Hr | The number of Hours to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 334 of file extendedtimer.cpp.
|
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.
MS | The number of Microseconds to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 300 of file extendedtimer.cpp.
|
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.
MS | The number of Milliseconds to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 307 of file extendedtimer.cpp.
|
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.
Min | The number of Minutes to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 326 of file extendedtimer.cpp.
|
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.
Sec | The number of Seconds to set. |
Struct | The Kind of TimeStructure this timer should use, defaults to ExtendedTimer::Current |
Definition at line 317 of file extendedtimer.cpp.