![]() |
VR-Forces 4.6 Class Documentation
|
Instances of DtTimer are used to maintain the information needed to represent some kind of scheduled event. More...

Public Member Functions | |
| DtTimer (const unsigned int type, const DtTime fireTime, const DtTimerCallbackFcn callback, void *usr) | |
| constructor The type parameter is an integer assigned by the caller for debugging purposes. | |
| DtTimer (const DtTimer &orig) | |
| copy constructor | |
| DtTimer & | operator= (const DtTimer &orig) |
| assignment operator | |
| virtual | ~DtTimer () |
| destructor | |
| virtual bool | tick (const DtTime simTime) |
| If time to fire, calls fire and returns true. | |
| virtual void | reset (const DtTime fireTime) |
| Resets the time to fire. | |
| virtual void | cancel () |
| Sets cancelled state to true, fired state to false. | |
| virtual void | fire () |
| Sets off (fires) the timer. | |
| virtual bool | fired () const |
| Returns whether or not timer has fired. | |
| virtual DtTime | fireTime () const |
| Simulation time that timer is scheduled to fire. | |
| virtual unsigned int | timerType () const |
| User-specified integer used to identify the purpose of the timer. | |
| virtual void * | usrData () |
| Pointer to user-specified data to be passed into callback when timer fires. | |
| virtual bool | cancelled () const |
| Returns whether or not timer has been cancelled (if its cancel() member has been called). | |
| virtual void | setResortPending () |
| Resort pending state is used by a DtScheduler as it manages when it wants to resort the timers it is maintaining. | |
| virtual void | clearResortPending () |
| virtual bool | resortPending () const |
| virtual void | setDeleteAfterFire () |
| Designates timer whether or not should be automatically deleted after it has fired. | |
| virtual void | clearDeleteAfterFire () |
| virtual bool | deleteAfterFire () const |
| Indicates if timer has been configured to be automatically deleted upon firing or not (in which case creator of timer is responsible for deleting timer after it has fired). | |
| virtual bool | managed () const |
| Indicates whether or not timer is being managed by a DtScheduler or not. | |
| virtual void | setScheduler (DtScheduler *scheduler) |
| Sets the DtScheduler responsible for managing this timer. | |
Protected Attributes | |
| DtScheduler * | myScheduler |
| const DtTimerCallbackFcn | myCallback |
| const unsigned int | myType |
| void * | myUsrData |
| This pointer is the property of the DtTimer user and should not be modified in any way by DtTimer. | |
| bool | myFired |
| bool | myDeleteAfterFire |
| bool | myCancelled |
| DtTime | myFireTime |
| bool | myResortPending |
Instances of DtTimer are used to maintain the information needed to represent some kind of scheduled event.
The key information it maintains is a callback function to be invoked when the timer fires. It is intended to be used in conjunction with the DtScheduler class, which is responsible for determining when to fire the timer.
Note: A timer can be created, ticked, reset, etc without use of the DtScheduler.
Note: If the DtTimer is used with a DtScheduler, it is the responsibility of the destroyer of a timer to remove it from the DtScheduler before deleting it.
| DtTimer::DtTimer | ( | const unsigned int | type, |
| const DtTime | fireTime, | ||
| const DtTimerCallbackFcn | callback, | ||
| void * | usr | ||
| ) |
constructor The type parameter is an integer assigned by the caller for debugging purposes.
You can use this type when debugging to identify for what purpose the timer was intended. See timerTypes.h for a list of integers already in use by VR-Forces. fireTime is the simulation time the timer should be fired. The usr pointer points to some user-specified data that will be passed into the given callback when the timer fires. The usr pointer is owned by the caller (who is therefore responsible for destroying it) and it should not be modified by this class in any way.
| DtTimer::DtTimer | ( | const DtTimer & | orig | ) |
copy constructor
|
virtual |
destructor
If time to fire, calls fire and returns true.
|
virtual |
Resets the time to fire.
If myScheduler has been set, calls the scheduler's reSort() member passing in this object as the argument. Sets cancelled and fired state to false.
|
virtual |
Sets cancelled state to true, fired state to false.
If myScheduler has been set, calls scheduler's reSort() member passing in this object as the argument.
|
virtual |
Sets off (fires) the timer.
Sets the fired state to true. If a callback exists, invokes the callback. If myScheduler has been set, calls scheduler's reSort() member passing in this object as the argument.
Reimplemented in DtPeriodicTimer, and DtRecurringTimer.
|
virtual |
Returns whether or not timer has fired.
|
virtual |
Simulation time that timer is scheduled to fire.
User-specified integer used to identify the purpose of the timer.
See timerTypes.h for the set of timerType integers aready in use within VR-Forces.
|
virtual |
Pointer to user-specified data to be passed into callback when timer fires.
|
virtual |
Returns whether or not timer has been cancelled (if its cancel() member has been called).
|
virtual |
Resort pending state is used by a DtScheduler as it manages when it wants to resort the timers it is maintaining.
|
virtual |
|
virtual |
|
virtual |
Designates timer whether or not should be automatically deleted after it has fired.
By default, it is up to the creator of the timer to delete the timer after it has fired. Note that if the creator of the timer assumes responsiblity for deleting timer, they cannot delete the timer in the callback (they must do it at some point after the callback has returned).
|
virtual |
|
virtual |
Indicates if timer has been configured to be automatically deleted upon firing or not (in which case creator of timer is responsible for deleting timer after it has fired).
Note that if the creator of the timer assumes responsiblity for deleting timer, they cannot delete the timer in the callback (they must do it at some point after the callback has returned).
|
virtual |
Indicates whether or not timer is being managed by a DtScheduler or not.
(i.e. was setScheduler ever called for this timer object)
|
virtual |
Sets the DtScheduler responsible for managing this timer.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |