MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 Types inherited from Mezzanine::Timer
enum  TimerType { Normal, StopWatch, Alarm }
 The style of timer 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 bool 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 ()
 Standard Constructor. More...
 
virtual ~Timer ()
 Class Destructor.
 
virtual Whole GetCurrentTime ()
 Gets the Current time in Microseconds. More...
 
virtual Whole GetCurrentTimeInMilliseconds ()
 Gets the Current time in Milliseconds. More...
 
virtual Whole GetInitialTime () const
 Gets the Initial time in Microseconds. More...
 
virtual Whole GetInitialTimeInMilliseconds () const
 Gets the Initial time in Milliseconds. More...
 
virtual Timer::TimerType GetType () const
 Gets the type of timer this is. More...
 
virtual Boolean IsStopped ()
 Gets Whether or not this timer is currently running. More...
 
virtual void SetCurrentTime (const Whole Current)
 Sets the current time in Microseconds. More...
 
virtual void SetCurrentTimeInMilliseconds (const Whole Current)
 Sets the current time in Milliseconds. The time that resetting sets the timer to. More...
 
virtual void SetInitialTime (const Whole Initial)
 Sets the initial time in Microseconds. The time that resetting sets the timer to. More...
 
virtual void SetInitialTimeInMilliseconds (const Whole Initial)
 Sets the initial time in Milliseconds. The time that resetting sets the timer to. More...
 
virtual void Start ()
 Activates the Timer.
 
virtual void Stop ()
 Deactivates the Timer.
 

Protected Member Functions

virtual bool CheckAll (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckDays (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckHours (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckMicroSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckMilliSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckMinutes (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CheckSeconds (const ExtendedTimer::TimeStruct Struct)
 
virtual bool CompareCurrentAndGoal (const Integer Current, const Integer Goal)
 
virtual TimeGetStruct (const ExtendedTimer::TimeStruct Struct)
 
virtual bool 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
virtual void Update ()
 Updates all the timings in 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 InitialTime
 The amount of microseconds elapsed that is considered the starting point for tracking time. More...
 
MaxInt StartStamp
 The time stamp from when the timer first started tracking 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 bool  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: