VR-Forces 4.2 Class Documentation
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtScheduler Class Reference

class DtScheduler More...

Inheritance diagram for DtScheduler:
Inheritance graph
[legend]

Public Member Functions

 DtScheduler ()
 constructors A pointer to the simManager is needed to obtain the DtExerciseClock.
 DtScheduler (DtSimManager *simManager)
 DtScheduler (const DtScheduler &orig)
 copy constructor
DtScheduleroperator= (const DtScheduler &orig)
 assignment operator
virtual ~DtScheduler ()
 destructor
virtual void tick ()
 Iterates through list of DtTimers.
virtual void addTimer (DtTimer *timer)
 None of the DtTimer * arguments are const, since all of these routines may modify the timerMgrEntry field of a DtTimer.
virtual void removeTimer (DtTimer *timer)
 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 reset (bool clearAll=false)
 Removes and deletes out 'deleteAfterFire' timers if clearAll is false.
void reSort (DtTimer *timer)
 Moves timers that have fired to the end of the list of timers.

Protected Member Functions

void doPendingResorts ()
 Calls reSort() for any timer for which resortPending() returns true.
void moveToEnd (DtTimer *timer)
 Removes timer from its current position and adds it to the end.

Protected Attributes

bool myInTick
 If in tick, ReSort() does NOT resort.
DtSimManagermySimManager

Detailed Description

class DtScheduler

Instances of class DtScheduler maintain a list of DtTimer objects. It ticks all timer objects each time it is ticked. When it finds a 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.

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

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

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)