VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtScheduler Class Reference

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.

Inheritance diagram for DtScheduler:
Inheritance graph
[legend]

Public Member Functions

 DtScheduler ()
 
 DtScheduler (DtSimManager *simManager)
 
 DtScheduler (const DtScheduler &orig)
 
DtScheduleroperator= (const DtScheduler &orig)
 
virtual ~DtScheduler ()
 
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
 
DtSimManagermySimManager
 
tbb::spin_mutex myMutex
 

Constructor & Destructor Documentation

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

virtual DtScheduler::~DtScheduler ( )
virtual

destructor

Member Function Documentation

DtScheduler& DtScheduler::operator= ( const DtScheduler orig)

assignment operator

virtual void DtScheduler::tick ( )
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 void DtScheduler::addTimer ( DtTimer timer)
virtual

None of the DtTimer * arguments are const, since all of these routines may modify the timerMgrEntry field of a DtTimer.

Adds a given timer to the scheduler. Sets a pointer to the instance of the scehduler in the given timer, adds the timer, and then calls resort().

virtual void DtScheduler::removeTimer ( DtTimer timer)
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 void DtScheduler::reset ( bool  clearAll = false)
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.

void DtScheduler::doPendingResorts ( )
protected

Calls reSort() for any timer for which resortPending() returns true.

void DtScheduler::moveToEnd ( DtTimer timer)
protected

Removes timer from its current position and adds it to the end.

Member Data Documentation

bool DtScheduler::myInTick
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.

DtSimManager* DtScheduler::mySimManager
protected
tbb::spin_mutex DtScheduler::myMutex
protected

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

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)