![]() |
VR-Forces Developer's Guide
|
Instances of class DtScheduler maintain a list of DtTimer objects. It ticks all timer objects each time it is ticked. It maintains the DtTimers as a sorted list in order of time to fire, so that once a timer is found that is not ready to fire, none of the others will need to be ticked.

Public Member Functions | |
| DtScheduler () | |
| DtScheduler (DtSimManager *simManager) | |
| DtScheduler (const DtScheduler &orig) | |
| DtScheduler & | operator= (const DtScheduler &orig) |
| virtual | ~DtScheduler () override |
| virtual void | tick () |
| virtual void | addTimer (DtTimer *timer) |
| virtual void | removeTimer (DtTimer *timer) |
| virtual void | reset (bool clearAll=false) |
| void | reSort (DtTimer *timer) |
Protected Member Functions | |
| void | doPendingResorts () |
| void | moveToEnd (DtTimer *timer) |
Protected Attributes | |
| bool | myInTick |
| DtSimManager * | mySimManager |
| tbb::spin_mutex | myMutex |
| DtScheduler::DtScheduler | ( | ) |
constructors A pointer to the simManager is needed to obtain the DtExerciseClock.
| DtScheduler::DtScheduler | ( | DtSimManager * | simManager | ) |
| DtScheduler::DtScheduler | ( | const DtScheduler & | orig | ) |
copy constructor
|
overridevirtual |
destructor
| DtScheduler& DtScheduler::operator= | ( | const DtScheduler & | orig | ) |
assignment operator
|
virtual |
Iterates through list of DtTimers. DtTimers are maintained in chronological order of fire time (sooner to later). If resortIsPending() for a given timer, skips the timer (to be resorted at the end of the tick), otherwise calls the timer's tick() function. If a given timer fires and timer should be deleted upon firing, removes and deletes the timer. At the end of the tick, calls doPendingResorts() to re-sort any timers that require it.
|
virtual |
|
virtual |
If the given timer is non-null and is managed, looks up and removes the timer, and sets the scheduler to null in the timer.
|
virtual |
Removes and deletes out 'deleteAfterFire' timers if clearAll is false. If clearAll is true, removes and deletes 'all' timers.
| void DtScheduler::reSort | ( | DtTimer * | timer | ) |
Moves timers that have fired to the end of the list of timers. Sorts timers in order of sooner to later fire time.
|
protected |
Calls reSort() for any timer for which resortPending() returns true.
|
protected |
Removes timer from its current position and adds it to the end.
|
protected |
If in tick, ReSort() does NOT resort. Instead, it marks the timer as resortPending. These timers will be resorted at the end of the tick function.
|
protected |
|
protected |